From 261d9ffde73ae0eea1e7c807d2811f77ad66d3a2 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Thu, 6 Mar 2014 22:09:01 +0100 Subject: [PATCH 01/53] Improve appareance and set Light as the default theme --- html/admin/sql/patch/ac-upgrade14.sql | 3 +-- html/style-light.css | 18 +++++++++--------- include/template/impress_cat_card.php | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/html/admin/sql/patch/ac-upgrade14.sql b/html/admin/sql/patch/ac-upgrade14.sql index c7cf70445..78f478e24 100644 --- a/html/admin/sql/patch/ac-upgrade14.sql +++ b/html/admin/sql/patch/ac-upgrade14.sql @@ -1,8 +1,7 @@ begin; update theme set the_name='Mandarine' ,the_filestyle='style-mandarine.css' where the_name='Colored'; update theme set the_name='Mobile' ,the_filestyle='style-mobile.css' where the_name='EPad'; -update user_global_pref set parameter_value='Mandarine' where parameter_value='Colored'; -update user_global_pref set parameter_value='Mobile' where parameter_value='EPad'; +update user_global_pref set parameter_value='Light' where parameter_type='THEME'; update theme set the_filestyle='style-classic.css' where the_filestyle='style.css'; update version set val=15; commit; diff --git a/html/style-light.css b/html/style-light.css index d8848a891..ee6980375 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -1,7 +1,7 @@ /* */ div.myfieldset { - margin-top: 5px; - margin-left:5px; - margin-right: 5px; + margin-top: 3em; + margin-left:3em; + margin-right: 3em; border:lightgrey 2px groove; } #info_div ,div#error_div ,div#close_div{ From bd8c5972f82c4a17507e5602c20e1c3260e0ad03 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 12 Jul 2014 21:47:42 +0200 Subject: [PATCH 46/53] =?UTF-8?q?Task=20#1009=20Message=20quand=20code=20g?= =?UTF-8?q?roupe=20est=20trop=20long=20Task=20#1009=20-=20Message=20d'erre?= =?UTF-8?q?ur=20incorrect=20quand=20on=20tente=20de=20cr=C3=A9er=20un=20gr?= =?UTF-8?q?oupe=20pour=20la=20compta=20analytique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class_anc_group.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/class_anc_group.php b/include/class_anc_group.php index 0ba01174f..925e14c73 100644 --- a/include/class_anc_group.php +++ b/include/class_anc_group.php @@ -52,6 +52,8 @@ class Anc_Group extends Anc_Print function insert() { + if (strlen ($this->ga_id) > 10 ) return ''. + _('Taille de la code trop long maximum 10 caractères').''; $sql=" insert into groupe_analytique (ga_id,ga_description,pa_id) values ('%s','%s',%d)"; $sql=sprintf($sql,Database::escape_string($this->ga_id), Database::escape_string($this->ga_description), From 3f61097799077aac1a73ee223799a26367ef9095 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 12 Jul 2014 21:52:47 +0200 Subject: [PATCH 47/53] =?UTF-8?q?task=20#995=20Am=C3=A9lioration=20ajout?= =?UTF-8?q?=20des=20journaux=20Task=20#995=20-=20CFGLED=20=20param=C3=A8tr?= =?UTF-8?q?e=3D>journaux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/infobulle.js | 3 + include/class_acc_ledger.php | 93 +++++++++++++++++++++++++- include/class_acc_ledger_purchase.php | 2 +- include/class_fiche_def_ref.php | 15 +++++ include/template/ledger_detail_ven.php | 8 ++- include/template/param_jrn.php | 51 +++++++++----- 6 files changed, 149 insertions(+), 23 deletions(-) diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 3aa510847..77bd8bbaf 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -65,6 +65,9 @@ content[34]='Cliquez sur le code AD pour ouvrir le menu dans un nouvel onglet'; content[35]='Cliquez sur le chemin pour ouvrir le menu'; content[36]='En utilisant les dates d\'échéance ou de paiement, seuls les journaux de type ACH et VEN seront utilisés ,vous excluez d\'office les autres journaux'; content[37]='Les dates sont en format DD.MM.YYYY'; +content[38]='La numérotation est propre à chaque journal. Laissez à 0 pour ne pas changer le numéro'; +content[39]='Le préfixe des pièces doit être différent pour chaque journal, on peut aussi utiliser l\'année'; +content[40]='Laissez à 0 pour ne pas changer le numéro'; function showBulle(p_ctl){ d=document.getElementById('bulle'); diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 8b9281d80..f5c7868f2 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -2198,7 +2198,79 @@ class Acc_Ledger extends jrn_def_sql $Res = $this->db->exec_sql("update jrn set jr_internal='" . $p_internal . "' where " . " jr_grpt_id = " . $this->grpt_id); } - + /** + * Return an array of default card for the ledger type given + * + * @param $p_ledger_type VEN ACH ODS or FIN + * @param $p_side D for Debit or C for credit or NA No Applicable + */ + function get_default_card($p_ledger_type,$p_side) + { + $array=array(); + $fiche_def_ref=new Fiche_Def_Ref($this->db); + // ----- for FINANCIAL ---- + if ($p_ledger_type =='FIN') + { + $array=$fiche_def_ref->get_by_modele(FICHE_TYPE_CLIENT); + $array=array_merge ( $array , $fiche_def_ref->get_by_modele(FICHE_TYPE_FOURNISSEUR)); + $array=array_merge ( $array , $fiche_def_ref->get_by_modele(FICHE_TYPE_FIN)); + $array=array_merge ( $array , $fiche_def_ref->get_by_modele(FICHE_TYPE_ADM_TAX)); + $array=array_merge ( $array , $fiche_def_ref->get_by_modele(FICHE_TYPE_EMPL)); + + } + // --- for miscellaneous ---- + if ($p_ledger_type == 'ODS') + { + $result=$this->db->get_array('select fd_id from fiche_def'); + for ($i = 0;$iget_by_modele(FICHE_TYPE_CLIENT); + break; + case 'ACH': + $array=$fiche_def_ref->get_by_modele(FICHE_TYPE_ACH_SER); + $array=array_merge ($array, $fiche_def_ref->get_by_modele(FICHE_TYPE_ACH_MAR)); + $array=array_merge ($array,$fiche_def_ref->get_by_modele(FICHE_TYPE_ACH_MAT)); + break; + default : + throw new Exception(_('get_default_card p_ledger_side is invalide ['.$p_ledger_type.']')); + + } + } elseif ($p_side == 'C') + { + switch($p_ledger_type) + { + case 'VEN': + $array=$fiche_def_ref->get_by_modele(FICHE_TYPE_VENTE); + break; + case 'ACH': + $array= array_merge($array, $fiche_def_ref->get_by_modele(FICHE_TYPE_ADM_TAX)); + $array= array_merge($array, $fiche_def_ref->get_by_modele(FICHE_TYPE_FOURNISSEUR)); + break; + default : + throw new Exception(_('get_default_card p_ledger_side is invalide ['.$p_ledger_type.']')); + + } + } + return $array; + /* + $return=array(); + $return = array_values($array); + for ($i = 0;$iprec=0; $description=new ITextarea('p_description'); + $description->style='class="itextarea" style="margin:0px;"'; $description->value=$this->jrn_def_description; $str_description=$description->input(); @@ -3508,7 +3581,20 @@ class Acc_Ledger extends jrn_def_sql $wSearch->size = 20; $search = $wSearch->input(); - + // default for ACH + $default_deb_purchase = $this->get_default_card('ACH', 'D'); + $default_cred_purchase = $this->get_default_card('ACH', 'C'); + + // default for VEN + $default_deb_sale = $this->get_default_card('VEN', 'D'); + $default_cred_sale = $this->get_default_card('VEN', 'C'); + + // default for FIN + $default_fin = $this->get_default_card("FIN", ""); + + //default ods + $default_ods = $this->get_default_card("ODS", ""); + /* construct all the hidden */ $hidden = HtmlInput::hidden('p_jrn', -1); $hidden.= HtmlInput::hidden('p_action', 'jrn'); @@ -3529,13 +3615,14 @@ class Acc_Ledger extends jrn_def_sql $wType->javascript=' onchange="show_ledger_div()"'; $type = $wType->input(); $rcred = $rdeb = array(); - $wPjPref = new IText(); + $wPjPref = new IText(); $wPjPref->name = 'jrn_def_pj_pref'; $pj_pref = $wPjPref->input(); $pj_seq = ''; $last_seq = 0; $new = 1; $description=new ITextarea('p_description'); + $description->style='class="itextarea" style="margin:0px;"'; $description->value=""; $str_description=$description->input(); /* bank card */ diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index a0875f0d9..0c50e416a 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -274,7 +274,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $p_nd_amount->amount_nd_rate = $p_fiche->strAttribut(ATTR_DEF_DEPENSE_NON_DEDUCTIBLE); $p_nd_amount->compute_nd(); } - if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) && $tva_both == 0) + if (!$p_fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) && $p_tva_both == 0) { $p_nd_amount->nd_vat_rate = $p_fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE); $p_nd_amount->compute_nd_vat(); diff --git a/include/class_fiche_def_ref.php b/include/class_fiche_def_ref.php index 49aa5aa0c..dad66407c 100644 --- a/include/class_fiche_def_ref.php +++ b/include/class_fiche_def_ref.php @@ -133,6 +133,21 @@ class Fiche_Def_Ref $this->frd_text=$r['frd_text']; $this->frd_class_base=$r['frd_class_base']; } + /** + * get category of cards by model + * @param $p_modele if the FRD_ID + * @return array of category (fd_id) + */ + function get_by_modele($p_modele) + { + $array = array(); + $result = $this->db->get_array('select fd_id from fiche_def where frd_id=$1', array($p_modele)); + for ($i = 0; $i < count($result); $i++) + { + $array[$i] = $result[$i]['fd_id']; + } + return $array; + } } ?> diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index f5f4f4343..c4ec3370f 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -1,7 +1,13 @@ +?> +
+?>
@@ -86,20 +86,18 @@ echo $str_add_button; - - - - - @@ -137,10 +132,10 @@ echo $str_add_button;
+ -
- -
+ @@ -108,22 +106,19 @@ echo $str_add_button;
+ - - - - + +
+ +
@@ -149,7 +144,13 @@ echo $str_add_button; // Show the fiche in deb section $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label"); $num=$cn->size(); - + // default card for ACH + if ($new == 1) + { + $rdeb=$default_deb_purchase; + $rcred=$default_cred_purchase; + } + for ($i=0;$i<$num;$i++) { $res=$cn->fetch($i); $CHECKED=" unchecked"; @@ -201,6 +202,12 @@ echo $str_add_button; // Show the fiche in deb section $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label"); $num=$cn->size(); + // default card for VEN + if ($new == 1) + { + $rdeb=$default_deb_sale; + $rcred=$default_cred_sale; + } for ($i=0;$i<$num;$i++) { $res=$cn->fetch($i); @@ -250,7 +257,11 @@ echo $str_add_button; // Show the fiche in deb section $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label"); $num=$cn->size(); - + // default card for ODS + if ($new == 1) + { + $rdeb=$default_ods; + } for ($i=0;$i<$num;$i++) { $res=$cn->fetch($i); $CHECKED=" unchecked"; @@ -297,7 +308,11 @@ echo $str_add_button; // Show the fiche in deb section $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label"); $num=$cn->size(); - + // default card for ACH + if ($new == 1) + { + $rdeb=$default_fin; + } for ($i=0;$i<$num;$i++) { $res=$cn->fetch($i); $CHECKED=" unchecked"; From b2a3820236eef7b1c47ebb0fb35fd3a9a004000f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 12 Jul 2014 21:53:32 +0200 Subject: [PATCH 48/53] Date plus petite --- include/class_idate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class_idate.php b/include/class_idate.php index 73aa2d273..016a6fbd2 100644 --- a/include/class_idate.php +++ b/include/class_idate.php @@ -35,7 +35,7 @@ class IDate extends HtmlInput $this->id=self::generate_id($this->name); $r=''. ' Date: Sun, 13 Jul 2014 12:02:21 +0200 Subject: [PATCH 49/53] =?UTF-8?q?task=20#1006=20export=20des=20pi=C3=A8ces?= =?UTF-8?q?=20en=20PDF,=20v=C3=A9rification=20et=20ajout=20message=20d'err?= =?UTF-8?q?eur=20Task=20#1006=20-=20ANCGL=20:=20export=20des=20pi=C3=A8ces?= =?UTF-8?q?=20dans=20un=20grand=20PDF=20avec=20un=20tampon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class_anc_grandlivre.php | 30 ++++++++----- include/class_document_export.php | 71 ++++++++++++++++++++++++------- 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/include/class_anc_grandlivre.php b/include/class_anc_grandlivre.php index 2a3d920b4..d7a59e113 100644 --- a/include/class_anc_grandlivre.php +++ b/include/class_anc_grandlivre.php @@ -124,17 +124,27 @@ class Anc_GrandLivre extends Anc_Print function button_export_pdf($p_string = "") { - $r = ""; - $r.= HtmlInput::hidden("to", $this->to); - $r.= HtmlInput::hidden("from", $this->from); - $r.= HtmlInput::hidden("pa_id", $this->pa_id); - $r.= HtmlInput::hidden("from_poste", $this->from_poste); - $r.= HtmlInput::hidden("to_poste", $this->to_poste); - $r.= HtmlInput::hidden("act","PDF:AncReceipt"); + if (CONVERT_GIF_PDF <> 'NOT' && PDFTK <> 'NOT') + { + $r = ""; + $r.= HtmlInput::hidden("to", $this->to); + $r.= HtmlInput::hidden("from", $this->from); + $r.= HtmlInput::hidden("pa_id", $this->pa_id); + $r.= HtmlInput::hidden("from_poste", $this->from_poste); + $r.= HtmlInput::hidden("to_poste", $this->to_poste); + $r.= HtmlInput::hidden("act","PDF:AncReceipt"); - $r.= $p_string; - $r.= dossier::hidden(); - $r.=HtmlInput::submit('bt_receipt_anal_pdf', _("Export des pièces en PDF")); + $r.= $p_string; + $r.= dossier::hidden(); + $r.=HtmlInput::submit('bt_receipt_anal_pdf', _("Export des pièces en PDF")); + } + else + { + + $r = ""; + $msg = _("Les extensions pour convertir en pdf ne sont pas installées"); + $r = HtmlInput::button("bt_receipt_anal", _('Export des pièces en PDF'), sprintf('onclick="alert(\'%s\')"',$msg)); + } return $r; } /*! diff --git a/include/class_document_export.php b/include/class_document_export.php index b3bc1ee85..b7e4efe08 100644 --- a/include/class_document_export.php +++ b/include/class_document_export.php @@ -1,19 +1,37 @@ store_convert); mkdir($this->store_pdf); } - + /** + * @brief concatenate all PDF into a single one and save it into the + * store_pdf folder + */ function concatenate_pdf() { + $this->check_file(); $stmt = PDFTK . " " . $this->store_pdf . '/stamp_*pdf output ' . $this->store_pdf . '/result.pdf'; $status = 0; echo $stmt; @@ -43,12 +65,15 @@ class Document_Export $this->feedback[$cnt_feedback]['error'] = $status; } } - + function move_file($p_source, $target) { + $this->check_file(); copy($p_source, $this->store_pdf . '/' . $target); } - + /** + * @brief send the resulting PDF to the browser + */ function send_pdf() { header('Content-Type: application/x-download'); @@ -64,11 +89,13 @@ class Document_Export } /** - * @brief export all the pieces in PDF + * @brief export all the pieces in PDF and transform them into a PDF with + * a stamp * @param $p_array contents all the jr_id */ function export_all($p_array) { + $this->check_file(); ob_start(); var_dump($p_array); global $cn; @@ -139,7 +166,7 @@ class Document_Export { $this->feedback[$cnt_feedback]['file'] = $file_pdf; - $this->feedback[$cnt_feedback]['message'] = ' cannot convert to stamped PDF'; + $this->feedback[$cnt_feedback]['message'] = _(' ne peut pas convertir en PDF'); $this->feedback[$cnt_feedback]['error'] = $status; $cnt_feedback++; continue; @@ -156,5 +183,19 @@ class Document_Export var_dump($this->feedback); // concatenate all pdf into one } - + /** + * @brief check that the files are installed + * throw a exception if one is missing + */ + function check_file() + { + try + { + if (CONVERT_GIF_PDF == 'NO') throw new Exception(_("CONVERT_GIF_PDF n'est pas installé")); + if (PDFTK == 'NO') throw new Exception(_("TKPDF n'est pas installé")); + } catch (Exception $ex) + { + throw ($ex); + } + } } From 3e22e1ce288433a77198ce9f8c93f553729eed7d Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 14 Jul 2014 19:29:43 +0200 Subject: [PATCH 50/53] =?UTF-8?q?task=20#1006=20export=20des=20pi=C3=A8ces?= =?UTF-8?q?=20en=20PDF,=20v=C3=A9rification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/export_anc_receipt_pdf.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 include/export_anc_receipt_pdf.php diff --git a/include/export_anc_receipt_pdf.php b/include/export_anc_receipt_pdf.php new file mode 100644 index 000000000..586abc3f3 --- /dev/null +++ b/include/export_anc_receipt_pdf.php @@ -0,0 +1,40 @@ +export_all($ck); From 178f62bfa0aca3780b974afccc9734e2dfb09dc4 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 14 Jul 2014 19:34:56 +0200 Subject: [PATCH 51/53] =?UTF-8?q?task=20#1006=20export=20des=20pi=C3=A8ces?= =?UTF-8?q?=20en=20PDF,=20ajout=20des=20fichiers=20pour=20mise=20=C3=A0=20?= =?UTF-8?q?jour=20de=20la=20base=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/admin/sql/patch/upgrade115.sql | 9 ++++++++ include/constant.php | 36 +++++++++++++++++++++++++---- sql/upgrade.sql | 6 ----- 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 html/admin/sql/patch/upgrade115.sql diff --git a/html/admin/sql/patch/upgrade115.sql b/html/admin/sql/patch/upgrade115.sql new file mode 100644 index 000000000..f458f13b2 --- /dev/null +++ b/html/admin/sql/patch/upgrade115.sql @@ -0,0 +1,9 @@ +begin; + +INSERT INTO menu_ref(me_code, me_menu, me_file, me_type)VALUES ('PDF:AncReceipt', 'Export pièce PDF', 'export_anc_receipt_pdf.php','PR'); + +insert into profile_menu(me_code,p_id,p_type_display,pm_default) values ('PDF:AncReceipt',1,'P',0); + +update version set val=116; + +commit; diff --git a/include/constant.php b/include/constant.php index f992846e3..8b77a8cf2 100644 --- a/include/constant.php +++ b/include/constant.php @@ -59,9 +59,8 @@ $g_captcha=false; $g_failed=""; $g_succeed=""; /* uncomment for development */ -define ('SVNINFO',6720); -//define ("DEBUG",true); -define ("DEBUG",false); +define ('SVNINFO',6721); +define ("DEBUG",true); $version_noalyss=SVNINFO; // If you don't want to be notified of the update @@ -70,7 +69,7 @@ define ("SITE_UPDATE",'http://www.noalyss.eu/last_version.txt'); define ("SITE_UPDATE_PLUGIN",'http://www.noalyss.eu/plugin_last_version.txt'); -define ("DBVERSION",115); +define ("DBVERSION",116); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",15); define ('NOTFOUND','--not found--'); @@ -178,7 +177,8 @@ define ("FICHE_TYPE_ACH_MAR",2); define ("FICHE_TYPE_ACH_SER",3); define ("FICHE_TYPE_ACH_MAT",7); define ("FICHE_TYPE_PROJET",26); -/** -- pour utiliser unoconv démarrer un server libreoffice +/** + * -- pour utiliser unoconv démarrer un server libreoffice * commande * libreoffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;" --nofirststartwizard * ou @@ -187,6 +187,32 @@ define ("FICHE_TYPE_PROJET",26); define ('OFFICE','unoconv '); define ('GENERATE_PDF','YES'); +/** + * Pour conversion GIF en PDF + */ +$convert_gif_pdf='/usr/bin/convert'; +if (file_exists($convert_gif_pdf)) +{ + define ('CONVERT_GIF_PDF',$convert_gif_pdf); +} else { + define ('CONVERT_GIF_PDF','NOT'); + +} + +/** + * Outil pour manipuler les PDF + */ +$pdftk='/usr/bin/pdftk'; +if (file_exists($pdftk)) +{ + define ('PDFTK',$pdftk); +} +else +{ + define ('PDFTK','NOT'); +} + + define ('JS_INFOBULLE','
- Services, fournitures ou biens achetés (C) + Services, fournitures ou biens achetés (D) - Fournisseurs (D) + Fournisseurs (C)