diff --git a/html/ajax_misc.php b/html/ajax_misc.php index e3d97138d..5e1261b5b 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -346,6 +346,10 @@ $path = array( 'operation_exercice+transfer'=>"ajax_operation_exercice", // view list of followup for a card "view_followup_card"=>"ajax_follow_up", + //list filter for followup + 'list_filter_followup'=>"ajax_follow_up", + //delete a filter for followup + 'delete_filter_followup'=>"ajax_follow_up", ) ; if (array_key_exists($op, $path)) { diff --git a/html/image/logo9000.png b/html/image/logo9000.png index a5d1eee8c..88b84c503 100644 Binary files a/html/image/logo9000.png and b/html/image/logo9000.png differ diff --git a/html/js/gestion.js b/html/js/gestion.js index 66e65f200..4e0258ed7 100644 --- a/html/js/gestion.js +++ b/html/js/gestion.js @@ -398,4 +398,66 @@ function action_save_short() alert_box('action_add ' + e.message); } return false; +} + +/** + * list of filter for follow up + * @param p_dossier int dossier id + * @param access_code string access_code + */ +function list_filter_followup(p_dossier,access_code) +{ + var queryString={ + "gDossier":p_dossier, + "op":"list_filter_followup", + "ctl":"filter_followup_id", + "ac":access_code + }; + var action=new Ajax.Request ( + "ajax_misc.php", + { + method:'get', + parameters:queryString, + onSuccess:function(responseHtml) + { + var posy=calcy(250) + var div = create_div({"id":"filter_followup_id", + 'cssclass': "inner_box", 'style': 'width:90%,right:5%;top:'+posy+"px"}); + div.update(responseHtml.responseText); + div.show(); + } + } + + ); +} + +/** + * @brief delete a filter of follow-up + * @param p_dossier int dossier id + * @param filter_id int table: action_gestion_comment.af_id + */ +function delete_filter_followup(p_dossier,filter_id) +{ + smoke.confirm(content[47], function (e) { + if (e) { + + var queryString = { + "gDossier": p_dossier, + "op": "delete_filter_followup", + "ctl": "filter_followup_id", + "filter_id": filter_id + }; + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', + parameters: queryString, + onSuccess: function (responseHtml) { + $('item_fu' + filter_id).remove(); + } + } + ); + } + } + ); } \ No newline at end of file diff --git a/include/action.common.inc.php b/include/action.common.inc.php index ea1f14b7d..6725f0607 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -312,6 +312,16 @@ if ($sub_action == "list") echo HtmlInput::hidden("export_type", "detail"); echo HtmlInput::submit("follow_up_csv", _("Export CSV détaillé"),'','smallbutton'); echo ""; + //if filter_name exists then we save the $_GET into the DB as a JSON object + $filter_name=$http->get("filter_name","string",null); + if ( noalyss_trim($filter_name) != "" ) { + // save filter + // $follow_up_filter=new Follow_Up_Filter($cn); + $a_content=json_encode($_GET); + $action_gestion_filter=new Follow_Up_Filter($filter_name,$a_content); + $action_gestion_filter->save(); + } + // si filtered on charge la DB Follow_Up::show_action_list($cn, $base); } //-------------------------------------------------------------------------------- diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 267872812..d534a6b39 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -169,6 +169,12 @@ case 'dc': } if ( ! isset ($nohistory))$html.=HtmlInput::history_card_button($f->id,_('Historique')); if ( ! isset ($nofollowup))$html.=HtmlInput::followup_card_button($f->id,_('Suivi')); + $button_pdf=HtmlInput::button_anchor(_("PDF"),"export.php?".http_build_query([ + "act"=>"PDF:card", + "card_id"=>$f->id, + "gDossier"=>Dossier::id() + ])); + $html.=$button_pdf; // Display a remove button if not used and can modify card if ( $can_modify == 1 && $f->is_used()==FALSE) { diff --git a/include/ajax/ajax_follow_up.php b/include/ajax/ajax_follow_up.php index 51c416e9d..b5554c410 100644 --- a/include/ajax/ajax_follow_up.php +++ b/include/ajax/ajax_follow_up.php @@ -142,7 +142,7 @@ if ($op == 'followup_comment_oneedit') { } /************************************************************************** - * See list of follow-up evebt + * See list of follow-up event *************************************************************************/ if ($op =="view_followup_card") { @@ -154,4 +154,18 @@ if ($op =="view_followup_card") echo $followup->view_list($query); echo \HtmlInput::button_close($div); return; -} \ No newline at end of file +} +/******************************************************************************************************************** + * list the existing filter for followup + ******************************************************************************************************************/ +if ( $op == 'list_filter_followup') { + $followup_filter=Follow_Up_Filter::display_list($g_user->getLogin()); + return; +} +/******************************************************************************************************************* + * delete_filter_followup(p_dossier,filter_id) + *******************************************************************************************************************/ +if ( $op == 'delete_filter_followup') { + $cn->exec_delete("delete from action_gestion_id where af_id=$1 and af_user=$2", + [$http->get("filter_id","number"),$g_user->getLogin()]); +} diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 9722f4ee7..cc1f2cdd6 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -920,8 +920,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger $this->db->exec_sql('update quant_purchase set qp_internal = $1 where j_id in (select j_id from jrnx where j_grpt=$2)', array($internal,$seq)); - /**= e_pj then do not increment sequence */ - if ( strcmp($e_pj,$e_pj_suggest) == 0 && noalyss_strlentrim($e_pj) != 0 ) + /**= e_pj then do not increment sequence , if the given receipt number is equal to one computed then increment */ + if ($e_pj == $this->pj && noalyss_strlentrim($e_pj) != 0) { $this->inc_seq_pj(); } diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php index bfee92fa6..7358c3ff9 100644 --- a/include/class/acc_ledger_sale.class.php +++ b/include/class/acc_ledger_sale.class.php @@ -619,12 +619,13 @@ class Acc_Ledger_Sale extends Acc_Ledger { $this->pj = $acc_operation->set_pj(); - /* * = e_pj then do not increment sequence */ - /* and e_pj is not null */ - if (strcmp($e_pj, $e_pj_suggest) == 0 && noalyss_strlentrim($e_pj) != 0) { + /** + * + * if the given receipt number is equal to one computed then increment + */ + if ($e_pj == $this->pj && noalyss_strlentrim($e_pj) != 0) { $this->inc_seq_pj(); } - $this->db->exec_sql("update jrn set jr_internal=$1 where jr_grpt_id = $2" ,[$internal,$seq]); diff --git a/include/class/card_pdf.class.php b/include/class/card_pdf.class.php new file mode 100644 index 000000000..59971489d --- /dev/null +++ b/include/class/card_pdf.class.php @@ -0,0 +1,71 @@ +card=new \Fiche ($cn,$p_card_id); + $this->card->load(); + parent::__construct($cn, "P"); + $this->setDossierInfo($this->card->strAttribut(ATTR_DEF_QUICKCODE)); + } + + /** + * @return mixed + */ + public function getCardId() + { + return $this->card->get_id(); + } + + /** + * @param mixed $card_id + */ + public function setCardId($card_id) + { + $this->card->set_id($card_id); + $this->card->load(); + } + + public function export() + { + $nb_attribut = count($this->card->attribut); +// var_dump( +// $this->card->attribut +// ); + if ($nb_attribut == 0) { + throw new \Exception(_("card_pdf.044 , card_inexistante")); + } + $this->setTitle($this->card->get_quick_code()." ".strtoupper($this->card->strAttribut(1)) + ." ".$this->card->strAttribut(32), true); + $this->SetAuthor('NOALYSS'); + $this->AliasNbPages(); + $this->AddPage(); + + $this->setFont("DejaVu", '', 7); + $this->SetDrawColor(214, 209, 209); + for ($i=0;$i<$nb_attribut;$i++) + { + $border="B"; + $this->write_cell(60,5,$this->card->attribut[$i]->ad_text,$border); + $this->write_cell(100,5,$this->card->attribut[$i]->av_text,$border); + $this->line_new(5); + } + + + $filename=$this->card->strAttribut(1)."-".$this->card->strAttribut(32).".pdf"; + $filename=sanitize_filename($filename); + $this->Output($filename,"D"); + } + +} \ No newline at end of file diff --git a/include/class/follow_up_filter.class.php b/include/class/follow_up_filter.class.php new file mode 100644 index 000000000..9612ab068 --- /dev/null +++ b/include/class/follow_up_filter.class.php @@ -0,0 +1,95 @@ +name=$name; + $this->json_content=$json_content; + } + + /** + * @return mixed + */ + public function getName():string + { + return $this->name; + } + + /** + * @param mixed $name + */ + public function setName($name): Follow_Up_Filter + { + $this->name = $name; + return $this; + } + + /** + * @return mixed + */ + public function getaContent():array + { + return $this->json_content; + } + + /** + * @param mixed $json_content + */ + public function setaContent($json_content): Follow_Up_Filter + { + $this->json_content = $json_content; + return $this; + } + + public function save() { + global $cn,$g_user; + $this->name=trim($this->name); + + $exist=$cn->get_value("select count(*) from action_gestion_filter where af_user=$1 and + af_name=$2" , [$g_user->getLogin(),$this->name]); + if ( $exist == 0 ) { + $cn->exec_sql("insert into action_gestion_filter(af_user,af_name,af_search) values ($1,$2,$3)", + [$g_user->getLogin(),$this->name,$this->json_content]); + } else { + $cn->exec_sql("update action_gestion_filter set af_search=$3 where + af_user=$1 and + af_name=$2" , + [$g_user->getLogin(),$this->name,$this->json_content]); + } + + } + + /** + * @brief display the list of recorded search + * @param $login string Login of the user + * @return void + */ + public static function display_list($login):void + { + + require NOALYSS_TEMPLATE."/follow_up_filter-display_list.php"; + } +} \ No newline at end of file diff --git a/include/export/export_card_pdf.php b/include/export/export_card_pdf.php new file mode 100644 index 000000000..795f979d5 --- /dev/null +++ b/include/export/export_card_pdf.php @@ -0,0 +1,16 @@ +get("card_id"); +} catch (\Exception $e) { + echo $e->getMessage(); + die(); +} + +$card_pdf=new \Card_PDF($card_id); +$card_pdf->export(); \ No newline at end of file diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 88e95ed7f..cf1fc109d 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1773,4 +1773,30 @@ function generate_random_password($car):string // echo $string."\n"; }while ( count(check_password_strength($string)['msg'])> 0 && $loop<$max_loop); return $string; +} + +/** + * @brief removed invalid character when computing a filename, the suffix is kept + * @param $filename String filename to sanitize + * @return string without offending char + */ +function sanitize_filename($filename) +{ + // save the suffix + $pos_prefix=strrpos($filename, "."); + if ($pos_prefix==0) + { + $filename_suff=".pdf"; + $filename.=$filename_suff; + $pos_prefix=strrpos($filename, "."); + } + else + $filename_suff=substr($filename, $pos_prefix, strlen($filename)); + + $filename=str_replace(array('/', '*', '<', '>', ';', ',', '\\', '.', ':', '(', ')', ' ', '[', ']'), "-", $filename); + + $filename_no=substr($filename, 0, $pos_prefix); + + $new_filename=strtolower($filename_no)."-".date("Ymd-Hi").$filename_suff; + return $new_filename; } \ No newline at end of file diff --git a/include/lib/select_box.class.php b/include/lib/select_box.class.php index f5b61a5b9..8c6cb4817 100644 --- a/include/lib/select_box.class.php +++ b/include/lib/select_box.class.php @@ -38,7 +38,7 @@ class Select_Box private $position; //!< change depending if we are in an absolute block or not protected $style_box; protected $value; - + /** * Default constructor * @param type $p_id javascript DOMid diff --git a/include/template/action_search.php b/include/template/action_search.php index 00d11ec39..5bec1f597 100644 --- a/include/template/action_search.php +++ b/include/template/action_search.php @@ -65,22 +65,24 @@ input()?> - + input();?> - + input()?> - - + +
+ + - - -
@@ -107,11 +109,7 @@ input();?>
- - +
@@ -124,26 +122,11 @@ input();?>

- - - - get("searchtag","array",array()); - for ($i=0;$iupdate_search_cell('search'); - } - } - ?> - -

-

+ + set_value($http->request("tag_option","number",0)); echo $iselect->input(); ?> + + + + get("searchtag","array",array()); + for ($i=0;$iupdate_search_cell('search'); + } + } + ?> +

- + +

+ Nom Filtre input(); + ?> + Filtre existant : + request("ac"))); + ?> +

+