diff --git a/.tx/config b/.tx/config index 0dea31a14d0..0044fb91f49 100644 --- a/.tx/config +++ b/.tx/config @@ -236,6 +236,12 @@ source_file = htdocs/langs/en_US/modulebuilder.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.mrp] +file_filter = htdocs/langs//mrp.lang +source_file = htdocs/langs/en_US/mrp.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.multicurrency] file_filter = htdocs/langs//multicurrency.lang source_file = htdocs/langs/en_US/multicurrency.lang diff --git a/ChangeLog b/ChangeLog index 7dc7fad28bb..c931f9ea865 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,28 +15,60 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules. * API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules. - +* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.; +* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming + convention of extension .inc.php for files to be included. ***** ChangeLog for 9.0.1 compared to 9.0.0 ***** FIX: #10381 FIX: #10460 compatibility with MariaDB 10.4 FIX: #10485 +FIX: #10638 +FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity +FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work FIX: add fk_unit on addline action +FIX: adding css by page if url is externam +FIX: Bad link in menu manager FIX: better test on fetch +FIX: can't add lines on invoices +FIX: Check for old picture name if the new one was not found +FIX: could not create several superadmin in transversal mode +FIX: creation of menu entry with parent id not int +FIX: creation of new left menu entry FIX: Default language of company is not set +FIX: error on setup of password if pass generators have a .old file. FIX: error report not returned FIX: expedition: reset status on rollback + replace hardcoded status with const +FIX: fetch module / pos source +FIX: fk_default_warehouse missing in group by +FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it +FIX: if empty error message, we just see "error" displayed +FIX: label of bank account FIX: line edit template: keep fk_parent_line +FIX: Mark credit note as available for credit note in other currency +FIX: missing access security checking with multicompany +FIX: missing entity filter in function "build_filterField()" (export module) +FIX: missing $ismultientitymanaged for previous/next ref FIX: Missing province in export of invoice FIX: must fetch member in current entity +FIX: positive values creating diff on addline rounding +FIX: positive values IN supplier credit notes creating diff on addline rounding FIX: Price in combo list of service does not use the correct price level -FIX: supplier invoice payment total doesnt care about deposit or credit +FIX: project_title for display of getNomUrl() +FIX: same thing here +FIX: Show button POS Ticket only if invoice was generated by POS +FIX: supplier invoice payment total doesn't care about deposit or credit FIX: supplier invoice product stats total ht is line total not invoice total +FIX: The notes was also copied on invoice +FIX: Transaction on leave approval and decrease ko if setup not complete FIX: Translation not loaded by scheduled jobs +FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9 +FIX: we want to be able to reopen fourn credit note +FIX: wrong feature2 when user rights "group_advance" is used FIX: wrong merged conflict FIX: wrong tests on fetch -NEW: Add protection to avoid packaging if files non indexed exists into +NEW: Add protection to avoid packaging if files non indexed exists ***** ChangeLog for 9.0.0 compared to 8.0.0 ***** For Users: diff --git a/README.md b/README.md index 9dfd1a8a750..ad1702fffe4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DOLIBARR ERP & CRM -![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) |6|7|8|9|develop| diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 5964d0d3e62..42d6d28eadf 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -53,97 +53,118 @@ $error=0; // List of sql to execute $sqls=array( 'user'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin')", - 'DELETE FROM '.MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin'", + "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'", + ), + 'event'=>array( + //"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE datec < '__DATE__'", + ), + 'payment'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)", ), 'bank'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'bank_account', - 'DELETE FROM '.MAIN_DB_PREFIX.'bank_class', - 'DELETE FROM '.MAIN_DB_PREFIX.'bank_url', - 'DELETE FROM '.MAIN_DB_PREFIX.'bank', + "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__'", ), - 'contract'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'contratdet', - 'DELETE FROM '.MAIN_DB_PREFIX.'contrat', + 'bankaccount'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."bank_account WHERE datec < '__DATE__'", ), 'invoice'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture', - 'DELETE FROM '.MAIN_DB_PREFIX.'facture_rec', - 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet', - 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE fk_facture_source IS NOT NULL', - 'DELETE FROM '.MAIN_DB_PREFIX.'facture', + '@payment', + "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_source IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_line IN (select rowid FROM ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture IN (select rowid from ".MAIN_DB_PREFIX."facture where datec < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."facture_rec where datec < '__DATE__'", + "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')", + "UPDATE ".MAIN_DB_PREFIX."facture SET fk_facture_source = NULL WHERE fk_facture_source IN (select f2.rowid FROM (select * from ".MAIN_DB_PREFIX."facture) as f2 where f2.datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__'", + ), + 'accounting'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."accounting_bookkeeping where doc_date < '__DATE__'", ), 'proposal'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'propaldet', - 'DELETE FROM '.MAIN_DB_PREFIX.'propal', + "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE datec < '__DATE__'", ), - 'supplier_proposal'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet', - 'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal', - ), - 'supplier_order'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet', - 'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur', - ), - 'supplier_invoice'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det', - 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn', - ), - 'delivery'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet', - 'DELETE FROM '.MAIN_DB_PREFIX.'livraison', - ), - 'shipment'=>array( - '@delivery', - 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_batch', - 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_extrafields', - 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet', - 'DELETE FROM '.MAIN_DB_PREFIX.'expedition_extrafields', - 'DELETE FROM '.MAIN_DB_PREFIX.'expedition', + "supplier_proposal"=>array( + "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal where datec < '__DATE__'", ), 'order'=>array( '@shipment', - 'DELETE FROM '.MAIN_DB_PREFIX.'commandedet', - 'DELETE FROM '.MAIN_DB_PREFIX.'commande', + "DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__'", + ), + 'supplier_order'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'", + ), + 'supplier_invoice'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'", + ), + 'shipment'=>array( + '@delivery', + "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch WHERE fk_expeditiondet IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."expedition_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'", + ), + 'delivery'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."livraisondet WHERE fk_livraison IN (select rowid FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__'", + ), + 'contract'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."contrat_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."contrat WHERE datec < '__DATE__'", ), 'intervention'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'fichinterdet', - 'DELETE FROM '.MAIN_DB_PREFIX.'fichinter', + "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter IN (select rowid FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__'", + ), + 'stock'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement WHERE datem < '__DATE__'", ), 'product'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_product', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_lang', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_price', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_batch', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_stock', - 'DELETE FROM '.MAIN_DB_PREFIX.'product_lot', - 'DELETE FROM '.MAIN_DB_PREFIX.'product', + "DELETE FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product_lang WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty WHERE fk_product_price IN (select rowid FROM ".MAIN_DB_PREFIX."product_price where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."product_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE fk_product_stock IN (select rowid FROM ".MAIN_DB_PREFIX."product_stock where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product_lot WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'", ), 'project'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time', - 'DELETE FROM '.MAIN_DB_PREFIX.'projet_task', - 'DELETE FROM '.MAIN_DB_PREFIX.'projet', + // TODO set fk_project to null on object that refer to project + "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))", + "DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'", ), 'contact'=>array( - 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_contact', - 'DELETE FROM '.MAIN_DB_PREFIX.'socpeople', + "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople IN (select rowid FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__'", ), 'thirdparty'=>array( '@contact', - 'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons', - 'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL', - 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur', - 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe', - 'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except', - 'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib', - 'DELETE FROM '.MAIN_DB_PREFIX.'societe', + "DELETE FROM ".MAIN_DB_PREFIX."cabinetmed_cons WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = NULL WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."categorie_fournisseur WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__'", ) ); - - /* * Main */ @@ -154,27 +175,50 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv)); $mode = $argv[1]; $option = $argv[2]; +$date = $argv[3]; if (empty($mode) || ! in_array($mode, array('test','confirm'))) { - print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; + print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option can be ".implode(',', array_keys($sqls))."\n"; exit(-1); } +if (empty($option)) +{ + print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; + print "\n"; + print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n"; + exit(-1); +} +if ($option != 'all') +{ + $listofoptions=explode(',', $option); + foreach($listofoptions as $cursoroption) + { + if (! in_array($cursoroption, array_keys($sqls))) { + print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; + print "\n"; + print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n"; + exit(-1); + } + } +} + +if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) { + print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; + print "\n"; + print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n"; + exit(-1); +} -if (empty($option) || ! in_array($option, array_merge(array('all'), array_keys($sqls))) ) { - print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; - print "\n"; - print "option can be ".implode(',', array_keys($sqls))."\n"; - exit(-1); -} +if ($date == 'all') $date = '2199-01-01'; // Replace database handler -if (! empty($argv[3])) +if (! empty($argv[4])) { $db->close(); unset($db); - $db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]); + $db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]); $user=new User($db); } @@ -189,6 +233,7 @@ if (! $ret > 0) print "Purge all data for this database:\n"; +print "Before = ".$date."\n"; print "Server = ".$db->database_host."\n"; print "Database name = ".$db->database_name."\n"; print "Database port = ".$db->database_port."\n"; @@ -206,9 +251,10 @@ if (! $confirmed) * Process sql requests of a family * * @param string $family Name of family key of array $sqls + * @param string $date Date value * @return int -1 if KO, 1 if OK */ -function processfamily($family) +function processfamily($family, $date) { global $db, $sqls; @@ -218,11 +264,14 @@ function processfamily($family) if (preg_match('/^@/', $sql)) { $newfamily=preg_replace('/@/', '', $sql); - processfamily($newfamily); + processfamily($newfamily, $date); continue; } + $sql = preg_replace('/__DATE__/', $date, $sql); + print "Run sql: ".$sql."\n"; + $resql=$db->query($sql); if (! $resql) { @@ -247,25 +296,29 @@ function processfamily($family) $db->begin(); -$oldfamily=''; -foreach($sqls as $family => $familysql) +$listofoptions=explode(',', $option); +foreach($listofoptions as $cursoroption) { - if ($option && $option != 'all' && $option != $family) continue; - - if ($family != $oldfamily) print "Process action for family ".$family."\n"; - $oldfamily = $family; - - $result=processfamily($family); - if ($result < 0) + $oldfamily=''; + foreach($sqls as $family => $familysql) { - $error++; - break; + if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue; + + if ($family != $oldfamily) print "Process action for family ".$family."\n"; + $oldfamily = $family; + + $result=processfamily($family, $date); + if ($result < 0) + { + $error++; + break; + } } } if ($error || $mode != 'confirm') { - print "Rollback any changes.\n"; + print "\nRollback any changes.\n"; $db->rollback(); } else diff --git a/dev/resources/dbmodel/README b/dev/resources/dbmodel/README new file mode 100644 index 00000000000..74233624a6d --- /dev/null +++ b/dev/resources/dbmodel/README @@ -0,0 +1,2 @@ +This directory contains the file with the graphical database structure. +It can be read with MySQL Workbench software. \ No newline at end of file diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b6f62aede64..d8fff2265e9 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -428,4 +428,5 @@ + diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index f551cf3e716..e0b8c6f70c2 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -307,11 +307,11 @@ if ($resql) print ''; if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, 'align="left"', $sortfield, $sortorder); + if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']); if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $accountstatic = new AccountingAccount($db); @@ -403,7 +403,7 @@ if ($resql) } // Action - print ''; + print ''; if ($user->rights->accounting->chartofaccount) { print ''; print img_edit(); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 9f31fa663ed..36ecf11a4c7 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -532,8 +532,8 @@ if ($id) if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($valuetoshow != '') { - print ''; - if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { + print ''; + if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; } elseif (! empty($tabhelp[$id][$value])) { print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); @@ -662,23 +662,29 @@ if ($id) */ $valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') - { - $valuetoshow=$langs->trans("Label"); - if ($id != 25) $valuetoshow.="*"; - } - if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='country_id') { $showfield=0; } - if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } + if ($fieldlist[$field]=='code') { + $valuetoshow=$langs->trans("Code"); + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { + $valuetoshow=$langs->trans("Label"); + if ($id != 25) $valuetoshow.="*"; + } + if ($fieldlist[$field]=='country') { + $valuetoshow=$langs->trans("Country"); + } + if ($fieldlist[$field]=='country_id') { + $showfield=0; + } + if ($fieldlist[$field]=='fk_pcg_version') { + $valuetoshow=$langs->trans("Pcg_version"); + } // Affiche nom du champ - if ($showfield) - { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); + if ($showfield) { + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' '); } } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print ''; @@ -757,7 +763,7 @@ if ($id) $class='tddict'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; // Show value for field - if ($showfield) print ''.$valuetoshow.''; + if ($showfield) print ''.$valuetoshow.''; } } @@ -769,17 +775,17 @@ if ($id) $url.='&'; // Active - print ''; + print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; else print $langs->trans("AlwaysActive"); print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link - if ($iserasable) print ''.img_delete().''; + if ($iserasable) print ''.img_delete().''; else print ' '; print "\n"; @@ -852,7 +858,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = } } elseif ($fieldlist[$field] == 'type_cdr') { - if ($fieldlist[$field] == 'type_cdr') print ''; + if ($fieldlist[$field] == 'type_cdr') print ''; else print ''; if ($fieldlist[$field] == 'type_cdr') { print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 7cb7d7d27f2..3a55e092d94 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -41,8 +41,7 @@ $rowid=GETPOST('rowid', 'alpha'); $code=GETPOST('code', 'alpha'); // Security access -if (empty($user->rights->accounting->chartofaccount)) -{ +if (empty($user->rights->accounting->chartofaccount)) { accessforbidden(); } @@ -468,29 +467,46 @@ if ($id) $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate $class="left"; - if ($fieldlist[$field]=='type') { - if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); - else $valuetoshow=$langs->trans("Type"); + if ($fieldlist[$field]=='type') { + if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") { + $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); + } else { + $valuetoshow=$langs->trans("Type"); + } } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') - { + if ($fieldlist[$field]=='code') { + $valuetoshow=$langs->trans("Code"); + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); } - if ($fieldlist[$field]=='country') { + if ($fieldlist[$field]=='libelle_facture') { + $valuetoshow=$langs->trans("LabelOnDocuments"); + } + if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } - if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } - if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } + if ($fieldlist[$field]=='accountancy_code') { + $valuetoshow=$langs->trans("AccountancyCode"); + } + if ($fieldlist[$field]=='accountancy_code_sell') { + $valuetoshow=$langs->trans("AccountancyCodeSell"); + } + if ($fieldlist[$field]=='accountancy_code_buy') { + $valuetoshow=$langs->trans("AccountancyCodeBuy"); + } + if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { + $valuetoshow=$langs->trans("Pcg_version"); + } + if ($fieldlist[$field]=='range_account') { + $valuetoshow=$langs->trans("Comment"); + } + if ($fieldlist[$field]=='category_type') { + $valuetoshow=$langs->trans("Calculated"); + } - if ($valuetoshow != '') - { - print ''; + if ($valuetoshow != '') { + print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); else print $valuetoshow; @@ -591,7 +607,7 @@ if ($id) print ''; print ''; print ''; - print ''; + print ''; if ($filterfound) { $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -613,38 +629,73 @@ if ($id) $valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='taux') { - if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); - else $valuetoshow=$langs->trans("Amount"); - $align='center'; + if ($fieldlist[$field]=='source') { + $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') - { + if ($fieldlist[$field]=='price') { + $valuetoshow=$langs->trans("PriceUHT"); + } + if ($fieldlist[$field]=='taux') { + if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") { + $valuetoshow=$langs->trans("Rate"); + } else { + $valuetoshow=$langs->trans("Amount"); + } + $class='center'; + } + if ($fieldlist[$field]=='type') { + $valuetoshow=$langs->trans("Type"); + } + if ($fieldlist[$field]=='code') { + $valuetoshow=$langs->trans("Code"); + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } - if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } - if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } - if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } - if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } - if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } + if ($fieldlist[$field]=='country') { + $valuetoshow=$langs->trans("Country"); + } + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { + $showfield=0; + } + if ($fieldlist[$field]=='accountancy_code') { + $valuetoshow=$langs->trans("AccountancyCode"); + } + if ($fieldlist[$field]=='accountancy_code_sell') { + $valuetoshow=$langs->trans("AccountancyCodeSell"); + $sortable=0; + } + if ($fieldlist[$field]=='accountancy_code_buy') { + $valuetoshow=$langs->trans("AccountancyCodeBuy"); + $sortable=0; + } + if ($fieldlist[$field]=='fk_pcg_version') { + $valuetoshow=$langs->trans("Pcg_version"); + } + if ($fieldlist[$field]=='account_parent') { + $valuetoshow=$langs->trans("Accountsparent"); + } + if ($fieldlist[$field]=='pcg_type') { + $valuetoshow=$langs->trans("Pcg_type"); + } + if ($fieldlist[$field]=='pcg_subtype') { + $valuetoshow=$langs->trans("Pcg_subtype"); + } + if ($fieldlist[$field]=='type_template') { + $valuetoshow=$langs->trans("TypeOfTemplate"); + } + if ($fieldlist[$field]=='range_account') { + $valuetoshow=$langs->trans("Comment"); + } + if ($fieldlist[$field]=='category_type') { + $valuetoshow=$langs->trans("Calculated"); + } // Affiche nom du champ - if ($showfield) - { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); + if ($showfield) { + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' '); } } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print getTitleFieldOfList(''); @@ -670,7 +721,7 @@ if ($id) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -732,7 +783,7 @@ if ($id) $class='tddict'; // Show value for field - if ($showfield) print ''.$valuetoshow.''; + if ($showfield) print ''.$valuetoshow.''; } } @@ -750,7 +801,7 @@ if ($id) $url.='&'; // Active - print ''; + print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; else { @@ -759,13 +810,13 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link if ($iserasable) { - print ''; + print ''; if ($user->admin) print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ''; diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index 8093a2fa883..ff559332316 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -32,8 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->loadLangs(array("compta","admin","accountancy")); // Security check -if (empty($user->rights->accounting->chartofaccount)) -{ +if (empty($user->rights->accounting->chartofaccount)) { accessforbidden(); } @@ -112,7 +111,7 @@ foreach ($list_account_main as $key) { print $form->textwithpicto($label, $htmltext); print ''; // Value - print ''; // Do not force align=right, or it align also the content of the select box + print ''; // Do not force class=right, or it align also the content of the select box print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print ''; print ''; diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 5b39a38657f..4ea9ff9139a 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -156,7 +156,7 @@ foreach ($list_account_main as $key) { print $form->textwithpicto($label, $htmltext); print ''; // Value - print ''; // Do not force align=right, or it align also the content of the select box + print ''; // Do not force class=right, or it align also the content of the select box print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print ''; print ''; @@ -179,7 +179,7 @@ foreach ($list_account as $key) { $label = $langs->trans($key); print '' . $label . ''; // Value - print ''; // Do not force align=right, or it align also the content of the select box + print ''; // Do not force class=right, or it align also the content of the select box print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print ''; print ''; diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 78fe73322f2..795edda5f4c 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -131,8 +131,8 @@ if ($result) print '' . $langs->trans("Label") . ''; print '' . $langs->trans("DateStart") . ''; print '' . $langs->trans("DateEnd") . ''; - print '' . $langs->trans("NumberOfAccountancyEntries") . ''; - print '' . $langs->trans("NumberOfAccountancyMovements") . ''; + print '' . $langs->trans("NumberOfAccountancyEntries") . ''; + print '' . $langs->trans("NumberOfAccountancyMovements") . ''; print '' . $langs->trans("Statut") . ''; print ''; @@ -147,8 +147,8 @@ if ($result) print '' . $obj->label . ''; print '' . dol_print_date($db->jdate($obj->date_start), 'day') . ''; print '' . dol_print_date($db->jdate($obj->date_end), 'day') . ''; - print '' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . ''; - print '' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . ''; + print '' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . ''; + print '' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . ''; print '' . $fiscalyearstatic->LibStatut($obj->statut, 5) . ''; print ''; $i++; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 1efebf5c234..c8cf0aa9901 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -132,7 +132,7 @@ if ($result) { print '' . $langs->trans("Accountparent") . ''; print '' . $langs->trans("Pcgtype") . ''; print '' . $langs->trans("Pcgsubtype") . ''; - print '' . $langs->trans("Import") . ''; + print '' . $langs->trans("Import") . ''; print ''; $form = new Form($db); @@ -166,7 +166,7 @@ if ($result) { // Colonne choix ligne a ventiler $checked = ('label' == 'O') ? ' checked' : ''; - print ''; + print ''; print ''; print ''; @@ -174,7 +174,7 @@ if ($result) { $i ++; } - print ' '; + print ' '; print ''; print ''; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 1e623c23860..996aa8500d2 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -430,16 +430,18 @@ if ($id) $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate $class="left"; - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') - { + if ($fieldlist[$field]=='code') { + $valuetoshow=$langs->trans("Code"); + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } + if ($fieldlist[$field]=='nature') { + $valuetoshow=$langs->trans("Nature"); + } - if ($valuetoshow != '') - { - print ''; + if ($valuetoshow != '') { + print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); else print $valuetoshow; @@ -549,17 +551,22 @@ if ($id) */ $valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } - if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } + if ($fieldlist[$field]=='code') { + $valuetoshow=$langs->trans("Code"); + } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { + $valuetoshow=$langs->trans("Label"); + } + if ($fieldlist[$field]=='nature') { + $valuetoshow=$langs->trans("Nature"); + } // Affiche nom du champ - if ($showfield) - { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); + if ($showfield) { + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' '); } } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); + print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); print getTitleFieldOfList(''); @@ -621,7 +628,7 @@ if ($id) $class='tddict'; // Show value for field - if ($showfield) print ''.$valuetoshow.''; + if ($showfield) print ''.$valuetoshow.''; } } @@ -696,11 +703,11 @@ $db->close(); /** * Show fields in insert/edit mode * - * @param array $fieldlist Array of fields - * @param Object $obj If we show a particular record, obj is filled with record fields - * @param string $tabname Name of SQL table - * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered - * @return void + * @param array $fieldlist Array of fields + * @param Object $obj If we show a particular record, obj is filled with record fields + * @param string $tabname Name of SQL table + * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered + * @return void */ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') { diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index a81aa472ef7..df8ce99fa10 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -307,7 +307,7 @@ if ($result) print ''.$langs->trans('OptionModeProductBuyDesc')."\n"; print "\n"; - print '
'; + print '
'; print "
\n"; @@ -338,7 +338,7 @@ if ($result) print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1); print ''; print ' '; - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -348,14 +348,14 @@ if ($result) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); - if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); - if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder); + if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center '); + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy"; else $fieldtosortaccount="p.accountancy_code_sell"; print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AssignDedicatedAccountingAccount"); $clickpitco=$form->showCheckAddButtons('checkforselect', 1); - print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"'); + print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center '); print ''; $product_static = new Product($db); @@ -408,10 +408,10 @@ if ($result) } if ($accounting_product_mode == 'ACCOUNTANCY_SELL') - print ''.$product_static->getLibStatut(3, 0).''; + print ''.$product_static->getLibStatut(3, 0).''; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') - print ''.$product_static->getLibStatut(3, 1).''; + print ''.$product_static->getLibStatut(3, 1).''; // Current accounting account print ''; @@ -450,7 +450,7 @@ if ($result) } // Checkbox select - print ''; + print ''; print ''; print ""; $i ++; @@ -485,7 +485,7 @@ if ($result) '; - print '
'; + print '
'; print ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 4da7865624e..6d2c7644d85 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -248,7 +248,7 @@ if ($action != 'export_csv') print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" class="center"', $sortfield, $sortorder); print "\n"; $total_debit = 0; @@ -296,7 +296,7 @@ if ($action != 'export_csv') print '' . price($line->debit) . ''; print '' . price($line->credit) . ''; print '' . price($line->credit - $line->debit) . ''; - print '' . $link; + print '' . $link; print ''; print "\n"; diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 7b9bf25c589..edf7383b595 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -73,19 +73,19 @@ $y = $year_current; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $sql = "SELECT bk.numero_compte AS 'compte',"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7e3d3a6e68d..fb63e503423 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -171,8 +171,8 @@ elseif ($action == "add") { $object->doc_ref = GETPOST('doc_ref', 'alpha'); $object->code_journal = $journal_code; $object->journal_label = $journal_label; - $object->fk_doc = GETPOST('fk_doc', 'int'); - $object->fk_docdet = GETPOST('fk_docdet', 'int'); + $object->fk_doc = (int) GETPOST('fk_doc', 'int'); + $object->fk_docdet = (int) GETPOST('fk_docdet', 'int'); if (floatval($debit) != 0.0) { $object->montant = $debit; @@ -604,7 +604,7 @@ if ($action == 'create') print_liste_field_titre("LabelOperation"); print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); - print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"'); + print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); print "\n"; @@ -644,7 +644,7 @@ if ($action == 'create') print ''; print ''; - print '\n"; print ''; if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); -if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); -if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, 'class="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 33c7deb0cfd..8988491c927 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -286,7 +286,7 @@ print $formaccounting->select_account($search_accountancy_code_end, 'search_acco print ''; print ''; print ''; -print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); -print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, 'class="right"', $sortfield, $sortorder); -print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label"); -print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); -print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); -print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); +print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center '); print "\n"; print ''; @@ -364,7 +364,7 @@ while ($i < min($num, $limit)) print ''; print ''; print ''; - print ''; + print ''; // TODO Add a link according to doc_type and fk_doc print ''; + print ''; - print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 9bef7a1c4fc..1a91f2dafbb 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -238,12 +238,12 @@ if ($resql) { print ''; print ''; print ''; - print ''; + print ''; if (empty($obj->lettering_code)) { - print ''; + print ''; } else - print ''; + print ''; print "\n"; } diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index bf2b8d4f948..df1d4317252 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -240,12 +240,12 @@ if ($resql) { print ''; print ''; print ''; - print ''; + print ''; if (empty($obj->lettering_code)) { - print ''; + print ''; } else - print ''; + print ''; print "\n"; } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index dbd0f680db7..f7a53c9e210 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -309,7 +309,9 @@ if ($result) { print ''; print ''; print ''; @@ -323,8 +325,8 @@ if ($result) { //print ''; print ''; print ''; - print ''; - print ''; + print '\n"; @@ -332,17 +334,17 @@ if ($result) { print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); $clickpicto=$form->showCheckAddButtons(); - print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; $facture_static = new Facture($db); @@ -368,7 +370,7 @@ if ($result) { // Ref Invoice print ''; - print ''; + print ''; // Ref Product print ''; - print ''; print ''; print ''; @@ -392,7 +394,7 @@ if ($result) { print ''; print ''; print ''; - print ''; @@ -401,19 +403,19 @@ if ($result) { print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); - print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); + print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); - print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; $facture_static = new Facture($db); @@ -482,7 +484,7 @@ if ($result) { // Ref Invoice print ''; - print ''; + print ''; // Ref Product print ''; // Current account - print ''; // Suggested accounting account - print ''; // Column with checkbox - print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 5dbacd501b9..3a322c07ef3 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -270,7 +270,7 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre(''); $checkpicto=$form->showCheckAddButtons(); - print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; $expensereport_static = new ExpenseReport($db); @@ -309,7 +309,7 @@ if ($result) { // Ref Invoice print ''; - print ''; + print ''; print ''; @@ -321,7 +321,7 @@ if ($result) { print ''; - print ''; + print ''; print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 9d28206a91e..a6bec0246a0 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -319,7 +319,7 @@ if ($result) { print ''; print ''; print ''; - print ''; @@ -328,16 +328,16 @@ if ($result) { print ''; print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center '); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); - print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -362,7 +362,7 @@ if ($result) { print ''; // Date - print ''; + print ''; // Fees label print ''; // Current account - print ''; // Suggested accounting account - print ''; - print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 0c5ba39bd94..275af10701d 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -994,8 +994,8 @@ if (empty($action) || $action == 'view') { print ""; print ""; print ""; - print ""; - print ""; + print ""; + print ""; print "\n"; $r = ''; @@ -1044,8 +1044,8 @@ if (empty($action) || $action == 'view') { print $reflabel; print ""; print ""; - print ""; - print ""; + print ""; + print ""; print ""; } } @@ -1126,8 +1126,8 @@ if (empty($action) || $action == 'view') { print ""; print ""; print ""; - print ""; - print ""; + print ""; + print ""; print ""; } } @@ -1163,8 +1163,8 @@ if (empty($action) || $action == 'view') { print ""; print ""; print ""; - print ""; - print ""; + print ""; + print ""; print ""; } } diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 1c687fb98cc..4af51060b4b 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -328,8 +328,8 @@ if ($result) { // print ''; print ''; print ''; - print ''; - print ''; + print ''; @@ -339,17 +339,17 @@ if ($result) { print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); $checkpicto=$form->showCheckAddButtons(); - print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; $facturefournisseur_static = new FactureFournisseur($db); @@ -380,7 +380,7 @@ if ($result) { print $objp->invoice_label; print ''; - print ''; + print ''; // Ref product print ''; - print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index f864824c740..156f98fc6a2 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -392,7 +392,7 @@ if ($result) { print ''; print ''; print ''; - print ''; @@ -402,19 +402,19 @@ if ($result) { print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); - print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); - print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; $facturefourn_static = new FactureFournisseur($db); @@ -475,7 +475,7 @@ if ($result) { print $objp->invoice_label; print ''; - print ''; + print ''; // Ref product print ''; // Current account - print ''; // Suggested accounting account - print ''; // Column with checkbox - print ''; diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 78d2821bf90..af2a8841643 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -183,6 +183,10 @@ if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! emp if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); print ''; print "\n"; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 412f0f4288d..b0ff07ac867 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2013 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -249,13 +249,14 @@ $form=new Form($db); llxHeader('', $langs->trans("MembersCards")); print load_fiche_titre($langs->trans("LinkToGeneratedPages")); -print '
'; -print $langs->trans("LinkToGeneratedPagesDesc").'
'; +print ''.$langs->trans("LinkToGeneratedPagesDesc").'
'; print '
'; dol_htmloutput_errors($mesg); +print '
'; + print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print '
'; print ''; @@ -272,7 +273,8 @@ asort($arrayoflabels); print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; print ''; -print '
'; + +print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print '
'; @@ -290,7 +292,8 @@ print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('mod print '
'.$langs->trans("Login").': '; print '
'; print ''; -print '
'; + +print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print '
'; @@ -307,7 +310,6 @@ asort($arrayoflabels); print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; print ''; -print '
'; // End of page llxFooter(); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6308857f958..d4b77342c84 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -572,6 +572,22 @@ class Adherent extends CommonObject $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= " WHERE rowid = ".$this->id; + // If we change the type of membership, we set also label of new type + if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) + { + $sql2 = "SELECT libelle as label"; + $sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type"; + $sql2.= " WHERE rowid = ".$this->typeid; + $resql2 = $this->db->query($sql2); + if ($resql2) + { + while ($obj=$this->db->fetch_object($resql2)) + { + $this->type=$obj->label; + } + } + } + dol_syslog(get_class($this)."::update update member", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1281,9 +1297,12 @@ class Adherent extends CommonObject $this->public = $obj->public; $this->datec = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); + $this->date_modification= $this->db->jdate($obj->datem); $this->datefin = $this->db->jdate($obj->datefin); $this->datevalid = $this->db->jdate($obj->datev); + $this->date_validation = $this->db->jdate($obj->datev); $this->birth = $this->db->jdate($obj->birthday); $this->note_private = $obj->note_private; diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6025f2a2985..6948bce1e25 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -288,15 +288,16 @@ class Members extends DolibarrApi return $member; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove the subscriptions because they are handled as a subresource. diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 43fd2635fb4..abfaf84993d 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi return $membertype; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->array_options); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 164606431ff..6ba88e7771b 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -58,15 +58,16 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra $title=$langs->trans("MembersStatisticsByProperties"); -print load_fiche_titre($title, $mesg); +print load_fiche_titre($title, ''); dol_mkdir($dir); $tab='byproperties'; $data = array(); -$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code"; +$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; +$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY d.morphy"; @@ -87,7 +88,7 @@ if ($resql) if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'mor') $foundmor++; - $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate)); + $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); $i++; } @@ -120,22 +121,21 @@ print '
' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . 'Total' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . 'Total
' . price($line->debit) . '' . price($line->credit) . ''; + print ''; print 'id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; print img_edit(); print '  '; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bc4b815100b..c1716dc18af 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -606,18 +606,18 @@ print "
'; +print ''; print $langs->trans('From') . ': '; print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); print '
'; @@ -297,7 +297,7 @@ print '
'; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; @@ -305,14 +305,14 @@ print '
 '.$line->piece_num.'' . dol_print_date($line->doc_date, 'day') . '' . dol_print_date($line->doc_date, 'day') . ''; @@ -384,9 +384,9 @@ while ($i < min($num, $limit)) $accountingjournal = new AccountingJournal($db); $result = $accountingjournal->fetch('', $line->code_journal); $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); - print '' . $journaltoshow . '' . $journaltoshow . ''; + print ''; print '' . img_edit() . ' '; print '' . img_delete() . ''; print '' . price($obj->debit) . '' . price($obj->credit) . '' . price(round($solde, 2)) . '' . $obj->code_journal . '' . $obj->code_journal . '' . $obj->lettering_code . '' . $obj->lettering_code . '
' . price($obj->debit) . '' . price($obj->credit) . '' . price(round($solde, 2)) . '' . $obj->code_journal . '' . $obj->code_journal . '' . $obj->lettering_code . '' . $obj->lettering_code . '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + print ''; + } print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print "
' . $facture_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; @@ -391,7 +393,7 @@ if ($result) { print '' . $objp->tva_intra . ''; + print ''; print $codecompta . ' '; print img_edit(); print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 6a7d59a46ce..3d6469f6961 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -376,7 +376,9 @@ if ($result) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { + print ''; + } print ''; $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
' . $facture_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->datef), 'day') . '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; @@ -513,7 +515,7 @@ if ($result) { print '' . $objp->tva_intra . ''; + print ''; print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); if ($objp->product_id > 0) { @@ -523,12 +525,12 @@ if ($result) { print ''; + print ''; print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; + print ''; print 'aarowid ? "checked" : "") . '/>'; print ''; @@ -282,15 +282,15 @@ if ($result) { print '
' . $expensereport_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->date), 'day') . '' . dol_print_date($db->jdate($objp->date), 'day') . '' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '' . price($objp->total_ht) . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '' . $codeCompta . ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
' . $expensereport_static->getNomUrl(1) . '' . dol_print_date($db->jdate($objp->date), 'day') . '' . dol_print_date($db->jdate($objp->date), 'day') . ''; @@ -386,16 +386,16 @@ if ($result) { print ''; + print ''; print length_accountg(html_entity_decode($objp->code_buy)); print ''; + print ''; print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; + print ''; print 'aarowid ? "checked" : "") . '/>'; print '" . $langs->trans("SubledgerAccount") . "" . $langs->trans("LabelOperation") . "" . $langs->trans("PaymentMode") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
" . $val["type_payment"] . "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "
" . $reflabel . "" . $val["type_payment"] . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
" . $reflabel . "" . $val["type_payment"] . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
'; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
' . dol_print_date($db->jdate($objp->datef), 'day') . '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; @@ -404,7 +404,7 @@ if ($result) { print '' . $objp->tva_intra . ''; + print ''; print $codecompta . ' '; print img_edit(); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
' . dol_print_date($db->jdate($objp->datef), 'day') . '' . dol_print_date($db->jdate($objp->datef), 'day') . ''; @@ -506,7 +506,7 @@ if ($result) { print '' . $objp->tva_intra . ''; + print ''; print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); if ($objp->product_id > 0) { @@ -516,12 +516,12 @@ if ($result) { print ''; + print ''; print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; + print ''; print 'aarowid ? "checked" : "") . '/>'; print ''; print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); +if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') +{ + print '
'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'
'; +} print '
'; print ''; print ''; print ''; +print ''; print ''; print ''; -if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>''); -if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>''); +if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); +if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); -$oldyear=0; foreach ($data as $val) { - $year = $val['year']; print ''; print ''; print ''; print ''; + print ''; print ''; - $oldyear=$year; } print '
'.$langs->trans("Nature").''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$memberstatic->getmorphylib($val['label']).''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index f5816f46aca..568c8ea6af9 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -77,8 +77,10 @@ if ($mode) $tab='statscountry'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label"; - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code"; @@ -92,10 +94,12 @@ if ($mode) $tab='statsstate'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; // - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; // + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, c.nom"; @@ -108,10 +112,12 @@ if ($mode) $tab='statsregion'; //onglet $data = array(); //tableau de donnée - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2"; - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, r.nom"; //+ @@ -124,9 +130,10 @@ if ($mode) $tab='statstown'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code, d.town"; @@ -154,7 +161,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'code'=>$obj->code, 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbyregion') //+ @@ -164,7 +172,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbystate') @@ -173,7 +182,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbytown') @@ -182,7 +192,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } @@ -233,7 +244,7 @@ else // Show graphics if (count($arrayjs) && $mode == 'memberbycountry') { - $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/graph-color.php'; + $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; if (is_readable($color_file)) include_once $color_file; // Assume we've already included the proper headers so just call our script inline @@ -289,9 +300,9 @@ if ($mode) if ($label2) print ''.$label2.''; print ''.$langs->trans("NbOfMembers").''; print ''.$langs->trans("LastMemberDate").''; + print ''.$langs->trans("LatestSubscriptionDate").''; print ''; - $oldyear=0; foreach ($data as $val) { $year = $val['year']; @@ -300,8 +311,8 @@ if ($mode) if ($label2) print ''.$val['label2'].''; print ''.$val['nb'].''; print ''.dol_print_date($val['lastdate'], 'dayhour').''; + print ''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').''; print ''; - $oldyear=$year; } print ''; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index e811eaff261..993af489989 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -44,7 +44,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'setbarcodeproducton') { - $res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity); + $barcodenumberingmodule = GETPOST('value', 'alpha'); + $res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); + if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) + { + $res=dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); + } } elseif ($action == 'setbarcodeproductoff') { @@ -406,13 +411,13 @@ if ($conf->produit->enabled) if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php new file mode 100644 index 00000000000..b7f1f0e6db9 --- /dev/null +++ b/htdocs/admin/bom.php @@ -0,0 +1,560 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/bom.php + * \ingroup bom + * \brief Setup page of module BOM + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'errors', 'mrp', 'other')); + +if (! $user->admin) accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scan_dir', 'alpha'); +$type = 'bom'; + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if ($action == 'updateMask') +{ + $maskconstbom=GETPOST('maskconstBom', 'alpha'); + $maskbom=GETPOST('maskBom', 'alpha'); + + if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +elseif ($action == 'specimen') +{ + $modele=GETPOST('module', 'alpha'); + + $bom = new BOM($db); + $bom->initAsSpecimen(); + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db); + + if ($module->write_file($bom, $langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +elseif ($action == 'set') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +elseif ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->BOM_ADDON_PDF == "$value") dolibarr_del_const($db, 'BOM_ADDON_PDF', $conf->entity); + } +} + +// Set default model +elseif ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "BOM_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) + { + // The constant that was read before the new set + // We therefore requires a variable to have a coherent view + $conf->global->BOM_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + +elseif ($action == 'setmod') +{ + // TODO Check if numbering module chosen can be activated + // by calling method canBeActivated + + dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity); +} + +elseif ($action == 'set_BOM_DRAFT_WATERMARK') +{ + $draft = GETPOST("BOM_DRAFT_WATERMARK"); + $res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +elseif ($action == 'set_BOM_FREE_TEXT') +{ + $freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif ($action=="setshippableiconinlist") { + // Activate Set Shippable Icon In List + $setshippableiconinlist = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); + if (! $res > 0) $error++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + + +/* + * View + */ + +$form=new Form($db); + +$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); + +llxHeader("", $langs->trans("BOMsSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup'); + +$head = bomAdminPrepareHead(); + +dol_fiche_head($head, 'settings', $langs->trans("BOMs"), -1, 'bom'); + +/* + * BOMs Numbering model + */ + +print load_fiche_titre($langs->trans("BOMsNumberingModules"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/bom/"); + + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file)-3, 3) == 'php') + { + $file = substr($file, 0, dol_strlen($file)-4); + + require_once $dir.$file.'.php'; + + $module = new $file($db); + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { + + print ''; + + // Show example of numbering model + print ''."\n"; + + print ''; + + $bom=new BOM($db); + $bom->initAsSpecimen(); + + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $bom->type=0; + $nextval=$module->getNextValue($mysoc, $bom); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print "\n"; + } + } + } + closedir($handle); + } + } +} +print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->name."\n"; + print $module->info(); + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->BOM_ADDON == $file) + { + print img_picto($langs->trans("Activated"), 'switch_on'); + } + else + { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print '

\n"; + + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) +{ + /* + * Document templates generators + */ + + print load_fiche_titre($langs->trans("BOMsModelModule"), '', ''); + + // Load array def with activated templates + $def = array(); + $sql = "SELECT nom"; + $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; + $sql.= " WHERE type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + $resql=$db->query($sql); + if ($resql) + { + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } + } + else + { + dol_print_error($db); + } + + + print "\n"; + print "\n"; + print ''; + print ''; + print '\n"; + print '\n"; + print ''; + print ''; + print "\n"; + + clearstatcache(); + + foreach ($dirmodels as $reldir) + { + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/bom".$valdir); + + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Default + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); + //$htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); + //$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } + } + + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module, 'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print "'; + if ($conf->global->BOM_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"), 'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + } + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"), 'bill').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + } + print '
'; + print "
"; + + /* + * Other options + */ + + print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + print ''; + print ''; + print ''; + print ''; + print "\n"; + print "\n"; + + $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); + $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); + $htmltext = ''.$langs->trans("AvailableVariables").':
'; + foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; + $htmltext.='
'; + + print ''; + print ''; + print ''; + print '\n"; + print ''; + + //Use draft Watermark + + print ""; + print ''; + print ""; + print '\n"; + print ''; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; + print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; + $variablename='BOM_FREE_TEXT'; + if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + { + print ''; + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); + } + print '
'; + print ''; + print "
'; + print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; + print '
'; + print ''; + print ''; + print ''; + print "
'; + print '
'; +} + +/* + * Notifications + */ +/* +print load_fiche_titre($langs->trans("Notifications"), '', ''); +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +print '\n"; + +print '
'.$langs->trans("Parameter").' 
'; +print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; +print '
'; +print "
'; +*/ + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 1f3e23e05d6..455175220a8 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -300,7 +300,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - print ''.$module->nom."\n"; + print ''.$module->name."\n"; print $module->info(); print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 11134f70194..541262b2bf5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1912,7 +1912,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } elseif ($fieldlist[$field]=='unit') { print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 9d4d5f88bb9..df2d2b09ee6 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -212,7 +212,7 @@ if (is_resource($handle)) { while (($file = readdir($handle))!==false) { - if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i', $file, $reg)) + if (preg_match('/(modGeneratePass[a-z]+)\.class\.php$/i', $file, $reg)) { // Charging the numbering class $classname = $reg[1]; @@ -398,7 +398,6 @@ print ''.$langs->trans("Action").''; print ''; // Disable clear password in database - print ''; print ''.$langs->trans("DoNotStoreClearPassword").''; print ''; @@ -413,6 +412,8 @@ if (! $conf->global->DATABASE_PWD_ENCRYPTED) print ''.$langs->trans("Activate").''; print ""; } + +// Database conf file encryption if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) { print ''; @@ -494,9 +495,21 @@ print ''; print ''; print ''; +print '
'; - -//print ''; +if (GETPOST('info', 'int') > 0) +{ + if (function_exists('password_hash')) + { + print $langs->trans("Note: The function password_hash exists on your PHP")."
\n"; + } + else + { + print $langs->trans("Note: The function password_hash does not exists on your PHP")."
\n"; + } + print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."
\n"; + print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."
\n"; +} print ''; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index a110e19b172..94d8909e063 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -339,8 +339,8 @@ if (! $error && $xml) $out.=''.$i.'' . "\n"; $out.=''.$file['filename']; if (! preg_match('/^win/i', PHP_OS)) { - $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']); - $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'); + $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename'] + $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i); } $out.='' . "\n"; $out.=''.$file['expectedmd5'].'' . "\n"; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f94117ef747..052e11f1ced 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -19,7 +19,7 @@ /** * \file admin/ticket.php * \ingroup ticket - * \brief This file is a module setup page + * \brief Page to setup module ticket */ require '../main.inc.php'; @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; // Load translation files required by the page -$langs->load("ticket"); +$langs->loadLangs(array("admin", "ticket")); // Access control if (!$user->admin) { @@ -91,16 +91,6 @@ if ($action == 'updateMask') { $error++; } - $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha'); - if (!empty($mail_new_ticket)) { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } - $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha'); if (!empty($mail_intro)) { $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity); @@ -121,36 +111,6 @@ if ($action == 'updateMask') { $error++; } - $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha'); - if (!empty($mail_signature)) { - $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } - - $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha'); - if (!empty($mail_signature)) { - $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } - - $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha'); - if (!empty($mail_signature)) { - $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } - $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha'); if (!empty($text_help)) { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity); @@ -163,26 +123,14 @@ if ($action == 'updateMask') { } if ($action == 'setvarother') { - $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } - $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } - $param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } - - $param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity); + $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); if (!$res > 0) { $error++; } @@ -242,9 +190,7 @@ $head = ticketAdminPrepareHead(); dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket"); -print $langs->trans("TicketSetupDictionaries") . ' : ' . dol_buildpath('/admin/dict.php', 2) . '
'; - -print $langs->trans("TicketPublicAccess") . ' : ' . dol_buildpath('/public/ticket/index.php', 2) . ''; +print ''.$langs->trans("TicketSetupDictionaries") . ' : ' . dol_buildpath('/admin/dict.php', 2) . '
'; dol_fiche_end(); @@ -353,80 +299,19 @@ if (!$conf->use_javascript_ajax) { print ''; print ''; } -print load_fiche_titre($langs->trans("TicketParamPublicInterface")); - -print ''; - -// Activate public interface -print ''; -print ''; -print ''; -print ''; - -// Check if email exists -print ''; -print ''; -print ''; -print ''; - -/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) -{ - // Show logo for module - print ''; - print ''; - print ''; - print ''; -}*/ - -// Show logo for company -print ''; -print ''; -print ''; -print ''; - -print '
' . $langs->trans("TicketsActivatePublicInterface") . ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE); -} -print ''; -print $form->textwithpicto('', $langs->trans("TicketsActivatePublicInterfaceHelp"), 1, 'help'); -print '
' . $langs->trans("TicketsEmailMustExist") . ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS); -} -print ''; -print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help'); -print '
' . $langs->trans("TicketsShowModuleLogo") . ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help'); - print '
' . $langs->trans("TicketsShowCompanyLogo") . ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO); -} -print ''; -print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help'); -print '

'; print load_fiche_titre($langs->trans("TicketParams")); print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + // Activate email notifications -print ''; +/* +print ''; print ''; print ''; // Activate log by email -print ''; +print ''; print ''; print ''; +*/ // Also send to main email address if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - print ''; + print ''; print ''; +/* +print ''; print ''; print ''; +*/ -if (!$conf->use_javascript_ajax) { +/*if (!$conf->use_javascript_ajax) { print ''; print ''; -} +}*/ // Auto assign ticket at user who created it -print ''; +print ''; print ''; -print ''; -print ''; +print '
'; +print ''; +print '
'; -// Interface topic -$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC; -print ''; -print ''; -print ''; - -// Texte d'accueil homepage -$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome'); -print ''; -print ''; - -// Texte d'aide à la saisie du message -$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'); -print ''; -print ''; - -print ''; -print ''; - -print '
' . $langs->trans("Parameter") . '
' . $langs->trans("TicketsDisableEmail") . '
' . $langs->trans("TicketsDisableEmail") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS'); @@ -441,7 +326,7 @@ print '
' . $langs->trans("TicketsLogEnableEmail") . '
' . $langs->trans("TicketsLogEnableEmail") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL'); @@ -454,11 +339,12 @@ print ''; print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help'); print '
' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '
' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); @@ -474,7 +360,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } // Limiter la vue des tickets à ceux assignés à l'utilisateur -print '
' . $langs->trans("TicketsLimitViewAssignedOnly") . '
' . $langs->trans("TicketsLimitViewAssignedOnly") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'); @@ -487,14 +374,15 @@ print ''; print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help'); print '
' . $langs->trans("TicketsAutoAssignTicket") . '
' . $langs->trans("TicketsAutoAssignTicket") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); @@ -515,7 +403,7 @@ if (!$conf->use_javascript_ajax) { } // Admin var of module -print load_fiche_titre($langs->trans("TicketParamMail")); +print load_fiche_titre($langs->trans("Notification")); print ''; @@ -533,17 +421,26 @@ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { print "\n"; } -// Email d'envoi des notifications -print ''; +// Activate log by email +/*print ''; print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL); +} +print ''; print ''; print ''; +*/ + +// @TODO Use module notification instead... // Email de réception des notifications -print ''; +print ''; print ''; print ''; print ''; -// Texte de création d'un ticket -$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody'); -print ''; +// Email d'envoi des notifications +print ''; +print ''; print ''; +print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); +print ''; +print ''; // Texte d'introduction $mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText'); -print ''; // Texte de signature $mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText'); -print ''; -print ''; -print ''; -print "\n"; +print '
' . $langs->trans("TicketEmailNotificationFrom") . '
' . $langs->trans("TicketsLogEnableEmail") . ''; -print ''; -print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); +print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help'); print '
' . $langs->trans("TicketEmailNotificationTo") . '
' . $langs->trans("TicketEmailNotificationTo") . ''; print ''; @@ -551,21 +448,18 @@ print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1 print '
' . $langs->trans("TicketNewEmailBodyLabel") . ''; -print ''; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); -$doleditor->Create(); -print '
' . $langs->trans("TicketEmailNotificationFrom") . ''; +print ''; -print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); -print '
' . $langs->trans("TicketMessageMailIntroLabelAdmin") . ''; +print '
' . $langs->trans("TicketMessageMailIntroLabelAdmin") . ''; print ''; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); @@ -577,7 +471,7 @@ print '
' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . ''; +print '
' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . ''; print ''; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); @@ -587,58 +481,12 @@ print ''; print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help'); print '
' . $langs->trans("PublicInterface") . '
'; -// Url public interface -$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE; -print '
' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . ''; -print ''; -print ''; -print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help'); -print '
' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . ''; -print ''; -print ''; -print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); -print '
' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . ''; -print ''; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); -$doleditor->Create(); -print ''; -print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); -print '
' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . ''; -print ''; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); -$doleditor->Create(); -print ''; -print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help'); -print '

'; print ''; // End of page diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php new file mode 100644 index 00000000000..939a357999b --- /dev/null +++ b/htdocs/admin/ticket_public.php @@ -0,0 +1,453 @@ + + * Copyright (C) 2016 Christophe Battarel + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file admin/ticket_public.php + * \ingroup ticket + * \brief Page to public interface of module Ticket + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "ticket")); + +// Access control +if (!$user->admin) { + accessforbidden(); +} + +// Parameters +$value = GETPOST('value', 'alpha'); +$action = GETPOST('action', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); +$type = 'ticket'; + +if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') +{ + if (GETPOST('value')) dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity); + else dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity); +} + +if ($action == 'setvar') { + include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php"; + + $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha'); + if (!empty($notification_email)) { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + // altairis : differentiate notification email FROM and TO + $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha'); + if (!empty($notification_email_to)) { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha'); + if (!empty($mail_new_ticket)) { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha'); + if (!empty($mail_intro)) { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha'); + if (!empty($mail_signature)) { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha'); + if (!empty($mail_signature)) { + $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha'); + if (!empty($mail_signature)) { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha'); + if (!empty($mail_signature)) { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } + + $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha'); + if (!empty($text_help)) { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } +} + +if ($action == 'setvarother') { + $param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + + $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + + $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + } + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + } + + $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + + $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } +} + + + +/* + * View + */ + +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + +$form = new Form($db); + +$help_url = "FR:Module_Ticket"; +$page_name = "TicketSetup"; +llxHeader('', $langs->trans($page_name), $help_url); + +// Subheader +$linkback = '' . $langs->trans("BackToModuleList") . ''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); + +// Configuration header +$head = ticketAdminPrepareHead(); + +dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket"); + +print ''.$langs->trans("TicketPublicAccess") . ' : ' . dol_buildpath('/public/ticket/index.php', 2) . ''; + +dol_fiche_end(); + + +$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; +if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) +{ + // Button off, click to enable + $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Disabled"), 'switch_off'); + $enabledisablehtml.=''; +} +else +{ + // Button on, click to disable + $enabledisablehtml.=''; + $enabledisablehtml.=img_picto($langs->trans("Activated"), 'switch_on'); + $enabledisablehtml.=''; +} +print $enabledisablehtml; +print ''; + +print '

'; + +if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) +{ + + if (!$conf->use_javascript_ajax) { + print '
'; + print ''; + print ''; + } + + print ''; + print ''; + print ''; + print ''; + print ''; + + // Check if email exists + print ''; + print ''; + print ''; + print ''; + + /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + // Show logo for module + print ''; + print ''; + print ''; + print ''; + }*/ + + // Show logo for company + print ''; + print ''; + print ''; + print ''; + + // Also send to main email address + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + print ''; + print ''; + print ''; + print ''; + } + + if (!$conf->use_javascript_ajax) { + print ''; + print ''; + } + + // Auto assign ticket at user who created it + print ''; + print ''; + print ''; + print ''; + + print '
' . $langs->trans("Parameters") . ''; + print ''; + print '
' . $langs->trans("TicketsEmailMustExist") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help'); + print '
' . $langs->trans("TicketsShowModuleLogo") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help'); + print '
' . $langs->trans("TicketsShowCompanyLogo") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help'); + print '
' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); + print '
' . $langs->trans("TicketsAutoAssignTicket") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); + print '

'; + + if (!$conf->use_javascript_ajax) { + print '
'; + } + + // Admin var of module + print load_fiche_titre($langs->trans("TicketParamMail")); + + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + print "\n"; + + if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { + print ''; + print ''; + print "\n"; + } + + // Url public interface + $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE; + print ''; + print ''; + print ''; + + // Interface topic + $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC; + print ''; + print ''; + print ''; + + // Texte d'accueil homepage + $public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome'); + print ''; + print ''; + + // Texte d'aide à la saisie du message + $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'); + print ''; + print ''; + + // Activate email creation to user + print ''; + print ''; + print ''; + print ''; + + // Texte de création d'un ticket + $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody'); + print ''; + print ''; + + print '
' . $langs->trans("Parameter") . '
' . $langs->trans("TicketCkEditorEmailNotActivated") . '
' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . ''; + print ''; + print ''; + print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help'); + print '
' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . ''; + print ''; + print ''; + print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); + print '
' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . ''; + print ''; + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; + $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); + $doleditor->Create(); + print ''; + print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); + print '
' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . ''; + print ''; + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; + $doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); + $doleditor->Create(); + print ''; + print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help'); + print '
' . $langs->trans("TicketsDisableCustomerEmail") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS); + } + print ''; + print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); + print '
' . $langs->trans("TicketNewEmailBodyLabel") . ''; + print ''; + require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; + $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); + $doleditor->Create(); + print ''; + print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); + print '
'; + + print '
'; + + print ''; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 19bd61c641b..f4a7084b336 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -274,7 +274,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; } - else if ($modulepart == 'adherent' || $modulepart == 'member') + elseif ($modulepart == 'adherent' || $modulepart == 'member') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -290,7 +290,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); } - else if ($modulepart == 'propal' || $modulepart == 'proposal') + elseif ($modulepart == 'propal' || $modulepart == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; @@ -306,7 +306,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); } - else if ($modulepart == 'commande' || $modulepart == 'order') + elseif ($modulepart == 'commande' || $modulepart == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -322,7 +322,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande'); } - else if ($modulepart == 'shipment' || $modulepart == 'expedition') + elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -338,7 +338,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment'); } - else if ($modulepart == 'facture' || $modulepart == 'invoice') + elseif ($modulepart == 'facture' || $modulepart == 'invoice') { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -354,7 +354,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } - else if ($modulepart == 'produit' || $modulepart == 'product') + elseif ($modulepart == 'produit' || $modulepart == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -370,7 +370,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); } - else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') + elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -600,7 +600,8 @@ class Documents extends DolibarrApi * @return array * @throws RestException */ - private function _validate_file($data) { + private function _validate_file($data) + { // phpcs:enable $result = array(); foreach (Documents::$DOCUMENT_FIELDS as $field) { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 766cf79f7be..783ec6540e3 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -273,14 +273,16 @@ class Setup extends DolibarrApi return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->error); diff --git a/htdocs/bom/admin/setup.php b/htdocs/bom/admin/setup.php index dd16ad92b8e..a484718ac32 100644 --- a/htdocs/bom/admin/setup.php +++ b/htdocs/bom/admin/setup.php @@ -1,6 +1,7 @@ - * Copyright (C) 2019 Maxime Kohlhaas +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2019 Maxime Kohlhaas + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,28 +24,14 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - -global $langs, $user; - +require '../../main.inc.php'; // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; require_once '../lib/bom.lib.php'; //require_once "../class/myclass.class.php"; // Translations -$langs->loadLangs(array("admin", "bom@bom")); +$langs->loadLangs(array("admin", "mrp")); // Access control if (! $user->admin) accessforbidden(); @@ -62,11 +49,7 @@ $arrayofparameters=array( /* * Actions */ -if ((float) DOL_VERSION >= 6) -{ - include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -} - +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; /* * View @@ -78,11 +61,11 @@ llxHeader('', $langs->trans($page_name)); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom@bom'); +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom'); // Configuration header $head = bomAdminPrepareHead(); -dol_fiche_head($head, 'settings', '', -1, "bom@bom"); +dol_fiche_head($head, 'settings', '', -1, "bom"); // Setup page goes here echo $langs->trans("BomSetupPage").'

'; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 9d45b8e86f8..19d7fdaa60b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,53 +17,20 @@ */ /** - * \file bom_card.php + * \file htdocs/bom/bom_card.php * \ingroup bom * \brief Page to create/edit/view bom */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies - - // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom_bom.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("bom@bom","other")); +$langs->loadLangs(array("mrp","other")); // Get parameters $id = GETPOST('id', 'int'); @@ -75,7 +42,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects -$object=new BillOfMaterials($db); +$object=new BOM($db); $extrafields = new ExtraFields($db); $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array @@ -119,10 +86,10 @@ if (empty($reshook)) $permissiontoadd = $user->rights->bom->write; $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); - $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); + $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; if (empty($backtopage)) { if (empty($id)) $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__'); + else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id; } $triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record @@ -154,7 +121,7 @@ if (empty($reshook)) $form=new Form($db); $formfile=new FormFile($db); -llxHeader('', 'BillOfMaterials', ''); +llxHeader('', 'NewBOM', ''); // Example : Adding jquery code print ' diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 673045afddc..76a565cf7d6 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -13,30 +13,23 @@ $form= new Form($db); print '
'; -if($mode == 'edit' ) -{ - print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; - print '
'; -} -else -{ - print '
'; - print '
'.$langs->trans('Resource').'
'; - print '
'.$langs->trans('Type').'
'; - print '
'.$langs->trans('Busy').'
'; - print '
'.$langs->trans('Mandatory').'
'; - print '
'; - print '
'; -} +print '
'; + +print '
'; +print '
'.$langs->trans('Resource').'
'; +print '
'.$langs->trans('Type').'
'; +print '
'.$langs->trans('Busy').'
'; +print '
'.$langs->trans('Mandatory').'
'; +print '
'; +print '
'; + +print ''; +print ''; +print ''; +print ''; if( (array) $linked_resources && count($linked_resources) > 0) { - foreach ($linked_resources as $linked_resource) { @@ -46,20 +39,17 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid')) { - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + print ''; + print ''; + print ''; print '
'.$object_resource->getNomUrl(1).'
'; print '
'.$object_resource->type_label.'
'; print '
'.$form->selectyesno('busy', $linked_resource['busy']?1:0, 1).'
'; print '
'.$form->selectyesno('mandatory', $linked_resource['mandatory']?1:0, 1).'
'; print '
'; - print ''; + print '
'; } else { @@ -67,7 +57,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($linked_resource['rowid'] == GETPOST('lineid')) $style='style="background: orange;"'; - print '
'; + print '
'; print '
'; print $object_resource->getNomUrl(1); @@ -95,20 +85,22 @@ if( (array) $linked_resources && count($linked_resources) > 0) print ''; print '
'; - print ''; + print '
'; } } } else { - print '
'; + print '
'; print '
'.$langs->trans('NoResourceLinked').'
'; print '
'; print '
'; print '
'; print '
'; - print ''; + print '
'; } +print ''; + print '
'; ?> diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 15e2974247e..095cd59ff55 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -761,7 +761,6 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'TASK_MODIFY') { // Load translation files required by the page @@ -773,7 +772,6 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid=0; } - elseif($action == 'TASK_DELETE') { // Load translation files required by the page diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index c8a31a70e40..c484ba7c6d4 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -187,7 +187,7 @@ class InterfaceTicketEmail extends DolibarrTriggers // Send email to notification email - if (empty($conf->global->TICKET_DISABLE_ALL_MAILS) && empty($object->context['disableticketemail'])) + if (! empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) { $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; @@ -227,6 +227,8 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin = dol_nl2br($message_admin); + $trackid = 'tic'.$object->id; + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; @@ -246,7 +248,7 @@ class InterfaceTicketEmail extends DolibarrTriggers // Send email to customer - if (empty($conf->global->TICKET_DISABLE_ALL_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) + if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; if (empty($user->socid) && empty($user->email)) { @@ -301,12 +303,14 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer = dol_nl2br($message_customer); + $trackid = 'tic'.$object->id; + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid); if ($mailfile->error) { dol_syslog($mailfile->error, LOG_DEBUG); } else { @@ -317,6 +321,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } } } + $ok = 1; break; @@ -328,10 +333,6 @@ class InterfaceTicketEmail extends DolibarrTriggers dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); break; - case 'TICKET_MARK_READ': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - break; - case 'TICKET_CLOSE': dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); break; diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 0616c2a0680..7ed17228967 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -117,12 +117,12 @@ print ''; print ''; -print '

'; +print '


'; print $langs->trans("UseMenuModuleToolsToAddCronJobs").'
'; -if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)); +if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)).'
'; -print '

'; +print '
'; dol_print_cron_urls(); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 1f22e7b910c..c223f3c76ff 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1207,7 +1207,7 @@ class Cronjob extends CommonObject * Reprogram a job * * @param string $userlogin User login - * @param timestamp $now Date returned by dol_now() + * @param integer $now Date returned by dol_now() * @return int <0 if KO, >0 if OK */ public function reprogram_jobs($userlogin, $now) diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index ea720e0586f..bf1033084d5 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -28,7 +28,7 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; /** * Class DataPolicy */ -Class DataPolicy +class DataPolicy { /** * getAllContactNotInformed diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index db0633c8e9d..0662c367a40 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -232,10 +232,10 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -272,20 +272,20 @@ if (is_resource($handle)) { if ($conf->global->DON_ADDON_MODEL == $name) { - print "'; } else { - print "'; } } else { - print ""; } @@ -293,13 +293,13 @@ if (is_resource($handle)) // Default if ($conf->global->DON_ADDON_MODEL == "$name") { - print "'; } else { - print "'; } @@ -314,12 +314,12 @@ if (is_resource($handle)) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - print ''; // Preview - print ''; @@ -340,7 +340,7 @@ print load_fiche_titre($langs->trans("Options"), '', ''); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Activated").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Activated").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; print img_picto($langs->trans("Enabled"), 'switch_on'); print '\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; print '\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ""; print img_picto($langs->trans("Default"), 'on'); print '"; + print ""; print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; print ''; + print ''; print $form->textwithpicto('', $htmltooltip, -1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'generic').''; print '
'; print ''; print ''; -print '\n"; +print '\n"; print ''; print "\n"; @@ -352,7 +352,7 @@ print ''; print ''; -print ''; print ''; -print '\n"; print ''; @@ -387,7 +387,7 @@ print ''; print '\n"; @@ -405,12 +405,12 @@ if (preg_match('/fr/i', $conf->global->MAIN_INFO_SOCIETE_COUNTRY)) print '
'.$langs->trans("Parameters").''.$langs->trans("Value")."'.$langs->trans("Value")."
'; print $form->textwithpicto($langs->trans("DonationUserThirdparties"), $langs->trans("DonationUserThirdpartiesDesc")); print ''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_USE_THIRDPARTIES'); } else { @@ -366,7 +366,7 @@ print '
'; $label = $langs->trans("AccountAccounting"); print ''; +print ''; if (! empty($conf->accounting->enabled)) { print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1); @@ -375,7 +375,7 @@ else { print ''; } -print ''; +print ''; print ''; print "
'; print $langs->trans("FreeTextOnDonations").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; print ''; -print '
'; +print ''; print ''; print "
'; print ''; print ''."\n"; - print ''."\n"; + print ''."\n"; print "\n"; print ''; print ''; - print ''; print ''; - print ''; print ''; - print ''; print ''; print ''; - print ''; + print ''; print ''; while ($i < $num) @@ -758,7 +758,7 @@ if ($object->socid) { print '\n"; $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type; print "\n"; - print '\n"; + print '\n"; print ""; $totalpaid += $objp->amount; $i++; @@ -766,13 +766,13 @@ if ($object->socid) { if ($object->paid == 0) { - print "\n"; - print "\n"; + print "\n"; + print "\n"; $remaintopay = $object->amount - $totalpaid; - print ""; - print '\n"; + print ""; + print '\n"; } print "
'.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Status").'
' . $langs->trans("DONATION_ART200") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART200'); } else { @@ -421,7 +421,7 @@ if ($conf->use_javascript_ajax) { print '
' . $langs->trans("DONATION_ART238") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART238'); } else { @@ -432,7 +432,7 @@ if ($conf->use_javascript_ajax) { print '
' . $langs->trans("DONATION_ART885") . ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('DONATION_ART885'); } else { diff --git a/htdocs/don/admin/donation_extrafields.php b/htdocs/don/admin/donation_extrafields.php index 1bfc12f2758..b01fc176eae 100644 --- a/htdocs/don/admin/donation_extrafields.php +++ b/htdocs/don/admin/donation_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Juanjo Menent +/* Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +17,9 @@ */ /** - * \file htdocs/don/admin/donation_extrafields.php - * \ingroup donations - * \brief Page to setup extra fields of donations + * \file htdocs/don/admin/donation_extrafields.php + * \ingroup donations + * \brief Page to setup extra fields of donations */ require '../../main.inc.php'; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 02a35deb70d..d88017e52ea 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -746,7 +746,7 @@ if ($object->socid) { print ''.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans("Amount").''.$langs->trans("Amount").'
'.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_payment."'.price($objp->amount)."'.price($objp->amount)."
".$langs->trans("AlreadyPaid")." :".price($totalpaid)."
".$langs->trans("AmountExpected")." :".price($object->amount)."
".$langs->trans("AlreadyPaid")." :".price($totalpaid)."
".$langs->trans("AmountExpected")." :".price($object->amount)."
".$langs->trans("RemainderToPay")." :'.price($remaintopay)."
".$langs->trans("RemainderToPay")." :'.price($remaintopay)."
"; $db->free($resql); diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 06ddd5616c0..efcd418cbc1 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019 Laurent Destailleur +/* Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2019 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ class Donations extends DolibarrApi * * @param int $id ID of order * @return array|mixed data without useless information - * + * * @throws RestException */ public function get($id) @@ -89,13 +89,13 @@ class Donations extends DolibarrApi * * Get a list of donations * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @return array Array of order objects + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects * * @throws RestException */ @@ -177,8 +177,8 @@ class Donations extends DolibarrApi public function post($request_data = null) { if (! DolibarrApiAccess::$user->rights->don->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -326,15 +326,16 @@ class Donations extends DolibarrApi return $this->_cleanObjectDatas($this->don); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->note); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 834f16c7737..de360d8cc3b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -678,6 +678,7 @@ class Don extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec); $this->date_validation = $this->db->jdate($obj->date_valid); + $this->date_valid = $this->db->jdate($obj->date_valid); $this->date_modification = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem); $this->date = $this->db->jdate($obj->datedon); @@ -687,7 +688,6 @@ class Don extends CommonObject $this->societe = $obj->societe; $this->statut = $obj->fk_statut; $this->address = $obj->address; - $this->town = $obj->town; $this->zip = $obj->zip; $this->town = $obj->town; $this->country_id = $obj->fk_country; @@ -704,7 +704,7 @@ class Don extends CommonObject $this->mode_reglement_id = $obj->fk_payment; $this->mode_reglement_code= $obj->payment_code; $this->mode_reglement = $obj->payment_label; - $this->paid = $obj->paid; + $this->paid = $obj->paid; $this->amount = $obj->amount; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 6f238c97d1b..d632f316a25 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -126,7 +126,7 @@ foreach ($listofstatus as $status) if ($conf->use_javascript_ajax) { - print ''; + print ''; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -143,9 +143,9 @@ if ($conf->use_javascript_ajax) print ''; print ''.$langs->trans("Status").''; -print ''.$langs->trans("Number").''; -print ''.$langs->trans("Total").''; -print ''.$langs->trans("Average").''; +print ''.$langs->trans("Number").''; +print ''.$langs->trans("Total").''; +print ''.$langs->trans("Average").''; print ''; $total=0; @@ -155,9 +155,9 @@ foreach ($listofstatus as $status) print ''; print ''.$donstatic->LibStatut($status, 4).''; - print ''.(! empty($nb[$status])?$nb[$status]:' ').''; - print ''.(! empty($nb[$status])?price($somme[$status], 'MT'):' ').''; - print ''.(! empty($nb[$status])?price(price2num($somme[$status]/$nb[$status], 'MT')):' ').''; + print ''.(! empty($nb[$status])?$nb[$status]:' ').''; + print ''.(! empty($nb[$status])?price($somme[$status], 'MT'):' ').''; + print ''.(! empty($nb[$status])?price(price2num($somme[$status]/$nb[$status], 'MT')):' ').''; $totalnb += (! empty($nb[$status])?$nb[$status]:0); $total += (! empty($somme[$status])?$somme[$status]:0); print ""; @@ -165,9 +165,9 @@ foreach ($listofstatus as $status) print ''; print ''.$langs->trans("Total").''; -print ''.$totalnb.''; -print ''.price($total, 'MT').''; -print ''.($totalnb?price(price2num($total/$totalnb, 'MT')):' ').''; +print ''.$totalnb.''; +print ''.price($total, 'MT').''; +print ''.($totalnb?price(price2num($total/$totalnb, 'MT')):' ').''; print ''; print ""; @@ -218,14 +218,14 @@ if ($resql) print dolGetFirstLastname($obj->lastname, $obj->firstname); print ''; - print ''; + print ''; print price($obj->amount, 1); print ''; // Date - print ''.dol_print_date($db->jdate($obj->datem), 'day').''; + print ''.dol_print_date($db->jdate($obj->datem), 'day').''; - print ''.$donation_static->LibStatut($obj->fk_statut, 5).''; + print ''.$donation_static->LibStatut($obj->fk_statut, 5).''; print ''; $i++; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 3a0ec6d189a..52525009516 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2018 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2019 Thibault FOUCART +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2019 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,9 +20,9 @@ */ /** - * \file htdocs/don/list.php - * \ingroup donations - * \brief List of donations + * \file htdocs/don/list.php + * \ingroup donations + * \brief List of donations */ require '../main.inc.php'; @@ -178,18 +178,18 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ' '; print ''; if (! empty($conf->projet->enabled)) { - print ''; + print ''; print ' '; print ''; } - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -199,14 +199,14 @@ if ($resql) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($conf->projet->enabled)) { $langs->load("projects"); print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "fk_projet", "", $param, "", $sortfield, $sortorder); } - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -222,7 +222,7 @@ if ($resql) print "".$donationstatic->getNomUrl(1)."\n"; print "".$objp->societe."\n"; print "".$donationstatic->getFullName($langs)."\n"; - print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; + print ''.dol_print_date($db->jdate($objp->datedon), 'day').''; if (! empty($conf->projet->enabled)) { print ""; @@ -238,20 +238,20 @@ if ($resql) else print ' '; print "\n"; } - print ''.price($objp->amount).''; - print ''.$donationstatic->LibStatut($objp->statut, 5).''; + print ''.price($objp->amount).''; + print ''.$donationstatic->LibStatut($objp->statut, 5).''; print ''; print ""; $i++; } - print ""; - print ''; + print ""; + print ''; print "\n"; $db->free($resql); } else { - dol_print_error($db); + dol_print_error($db); } llxFooter(); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 43e329f3d08..bbf2163b9af 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -216,9 +217,9 @@ if ($resql) print '
'; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; if ($num > 0) @@ -234,14 +235,14 @@ if ($resql) print $don->getNomUrl(1); print "\n"; // Expected to pay - print ''; + print ''; // Status - print ''; + print ''; // Amount payed - print ''; + print ''; print "\n"; - if ($objp->paid == 1) // If at least one invoice is paid, disable delete - { + if ($objp->paid == 1) { + // If at least one invoice is paid, disable delete $disable_delete = 1; } $total = $total + $objp->amount; diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index 640a94ff729..0172765b19c 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -35,8 +35,7 @@ $amounts = array(); // Security check $socid=0; -if ($user->societe_id > 0) -{ +if ($user->societe_id > 0) { $socid = $user->societe_id; } @@ -244,10 +243,10 @@ if (GETPOST('action', 'aZ09') == 'create') print '
'.$langs->trans('Donation').''.$langs->trans('ExpectedToPay').''.$langs->trans('Status').''.$langs->trans('PayedByThisPayment').''.$langs->trans('ExpectedToPay').''.$langs->trans('Status').''.$langs->trans('PayedByThisPayment').'
'.price($objp->d_amount).''.price($objp->d_amount).''.$don->getLibStatut(4, $objp->amount).''.$don->getLibStatut(4, $objp->amount).''.price($objp->amount).''.price($objp->amount).'
'; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $total=0; @@ -259,13 +258,13 @@ if (GETPOST('action', 'aZ09') == 'create') print ''; - print '"; + print '"; - print '"; + print '"; - print '"; + print '"; - print ''; - print ''; - print ""; - print ""; - print ""; - print ''; + print ''; + print ""; + print ""; + print ""; + print ''; print "\n"; } diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 4c360786425..cc25ea8ae7b 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -253,7 +253,7 @@ print '
'; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; - print '
'; + print ''; print '
'.$langs->trans("Amount").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").''.$langs->trans("Amount").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").'
'.price($objp->amount)."'.price($objp->amount)."'.price($sumpaid)."'.price($sumpaid)."'.price($objp->amount - $sumpaid)."'.price($objp->amount - $sumpaid)."'; + print ''; if ($sumpaid < $objp->amount) { $namef = "amount_".$objp->id; @@ -287,11 +286,11 @@ if (GETPOST('action', 'aZ09') == 'create') { // Print total print '
'.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."".price($total_ttc - $totalrecu)." '.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."".price($total_ttc - $totalrecu)." 
'; print ''; print '

'; @@ -262,10 +262,10 @@ print '
'; print '
'; print ''; print ''; -print ''; -print ''; -/*print ''; -print '';*/ +print ''; +print ''; +/*print ''; +print '';*/ print ''; $oldyear=0; @@ -276,19 +276,19 @@ foreach ($data as $val) { // If we have empty year $oldyear--; print ''; - print ''; + print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; } print ''; - print ''; - print ''; - /*print ''; - print '';*/ + print ''; + print ''; + /*print ''; + print '';*/ print ''; $oldyear=$year; } @@ -301,7 +301,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("Year").''.$langs->trans("NbOfSendings").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.''.$oldyear.'000000
'.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).''.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; + print ''; } // Product/Service print ''; // Qty - print ''; + print ''; if ($origin && $origin_id > 0) { - print ''; + print ''; } if ($action == 'editline') { $editColspan = 3; if (empty($conf->stock->enabled)) $editColspan--; if (empty($conf->productbatch->enabled)) $editColspan--; - print ''; + print ''; } else { - print ''; + print ''; } if (! empty($conf->stock->enabled)) { @@ -2057,9 +2057,9 @@ elseif ($id || $ref) print ''; } } - print ''; - print ''; - //print ''; + print ''; + print ''; + //print ''; if ($object->statut == 0) { print ''; @@ -2135,7 +2135,7 @@ elseif ($id || $ref) // Adds a line numbering column if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''; + print ''; } // Predefined product or service @@ -2187,12 +2187,12 @@ elseif ($id || $ref) } // Qty ordered - print ''; + print ''; // Qty in other shipments (with shipment and warehouse used) if ($origin && $origin_id > 0) { - print ''; if ($action != 'editwarehouse' && $user->rights->commande->creer) - print ''; + print ''; print '
'; +print ''; - if ($action != 'editshipping_method_id') print ''; + if ($action != 'editshipping_method_id') print ''; print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); @@ -323,8 +323,8 @@ dol_fiche_end(); // TODO USe code similar to commande/stats/index.php instead of this one. /* print ''; -print ''; -print ''; +print ''; +print ''; $sql = "SELECT count(*) as nb, date_format(date_expedition,'%Y') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition"; @@ -343,7 +343,7 @@ if ($resql) $nbproduct = $row[0]; $year = $row[1]; print ""; - print ''; + print ''; $i++; } } diff --git a/htdocs/don/tpl/linkedobjectblock.tpl.php b/htdocs/don/tpl/linkedobjectblock.tpl.php index 0191fd89ee4..70373c58b28 100644 --- a/htdocs/don/tpl/linkedobjectblock.tpl.php +++ b/htdocs/don/tpl/linkedobjectblock.tpl.php @@ -33,8 +33,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("donations"); $total=0; $ilink=0; -foreach($linkedObjectBlock as $key => $objectlink) -{ +foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; $trclass='oddeven'; @@ -43,14 +42,14 @@ foreach($linkedObjectBlock as $key => $objectlink) - - - + + - + 1) - - - - - + + + + + '; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; $qtyProdCom=$line->qty; // Qty already shipped - print ' - "; + (".$value['nb'].") + "; } } } @@ -1326,7 +1326,7 @@ if ($action == 'create') $batchStock = + $dbatch->qty; // To get a numeric $deliverableQty = min($quantityToBeDelivered, $batchStock); print ''; - print ''; @@ -1357,7 +1357,7 @@ if ($action == 'create') else { print ''; - print ''; @@ -1397,7 +1397,7 @@ if ($action == 'create') $deliverableQty = max(0, $deliverableQty); // Quantity to send print ''; - print ' - "; + (".$value['nb'].") + "; print ""; } } @@ -1488,7 +1488,7 @@ if ($action == 'create') $batchStock = + $dbatch->qty; // To get a numeric $deliverableQty = min($quantityToBeDelivered, $batchStock); if ($deliverableQty < 0) $deliverableQty = 0; - print ''; @@ -1520,7 +1520,7 @@ if ($action == 'create') if ($subj == 0) // Line not shown yet, we show it { print ''; - print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").'
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").'
'.$year.''.$nbproduct.'
'.$year.''.$nbproduct.'
trans("Donation"); ?> getNomUrl(1); ?>ref_client; ?>date, 'day'); ?>ref_client; ?>date, 'day'); ?>total_ht; echo price($objectlink->total_ht); } ?> getLibStatut(3); ?>getLibStatut(3); ?>
trans("Total"); ?>
'.$langs->trans("Description").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").''.$langs->trans("QtyToShip"); + print ''.$langs->trans("QtyOrdered").''.$langs->trans("QtyShipped").''.$langs->trans("QtyToShip"); if (empty($conf->productbatch->enabled)) { print '
('.$langs->trans("Fill").''; @@ -1197,13 +1197,13 @@ if ($action == 'create') } // Qty - print '
'.$line->qty; + print ''.$line->qty; print ''; print ''; + print ''; $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; print ''; @@ -1232,7 +1232,7 @@ if ($action == 'create') if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) { // Quantity to send - print ''; + print ''; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty=GETPOST('qtyl'.$indiceAsked, 'int'); @@ -1292,8 +1292,8 @@ if ($action == 'create') } print "
      -> ".$value['fullpath']." - (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img."
".$value['nb_total']."  ".$value['stock']." ".$img."
'; + print ''; print ''; print '
'; + print '
'; print ' '; print '
'; + print ''; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { print ''; @@ -1450,8 +1450,8 @@ if ($action == 'create') print '
'; print "      -> ".$value['fullpath']." - (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img." ".$value['nb_total']."  ".$value['stock']." ".$img."
'; + print '
'; print ''; print '
'; + print '
'; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $disabled=''; @@ -1782,7 +1782,7 @@ elseif ($id || $ref) print $langs->trans('DateDeliveryPlanned'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print '
'; if ($action == 'editdate_livraison') @@ -1921,7 +1921,7 @@ elseif ($id || $ref) print $langs->trans('SendingMethod'); print 'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).'id.'">'.img_edit($langs->trans('SetSendingMethod'), 1).'
'; print '
'; if ($action == 'editshipping_method_id') @@ -1958,7 +1958,7 @@ elseif ($id || $ref) print '
'; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->expedition->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -2003,22 +2003,22 @@ elseif ($id || $ref) // Adds a line numbering column if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print '
  '.$langs->trans("Products").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyInOtherShipments").''.$langs->trans("QtyInOtherShipments").''; + print ''; if ($object->statut <= 1) { print $langs->trans("QtyToShip").' - '; @@ -2041,11 +2041,11 @@ elseif ($id || $ref) { if ($object->statut <= 1) { - print ''.$langs->trans("QtyToShip").''.$langs->trans("QtyToShip").''.$langs->trans("QtyShipped").''.$langs->trans("QtyShipped").''.$langs->trans("Batch").''.$langs->trans("CalculatedWeight").''.$langs->trans("CalculatedVolume").''.$langs->trans("Size").''.$langs->trans("CalculatedWeight").''.$langs->trans("CalculatedVolume").''.$langs->trans("Size").''.($i+1).''.($i+1).''.$lines[$i]->qty_asked.''.$lines[$i]->qty_asked.''; + print ''; foreach ($alreadysent as $key => $val) { if ($lines[$i]->fk_origin_line == $key) @@ -2223,7 +2223,7 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode - print ''; + print ''; if ($action != 'editshippingmethod' && $user->rights->expedition->creer) - print ''; + print ''; print '
'; if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) { print ''; @@ -2305,7 +2305,7 @@ elseif ($id || $ref) else { // Qty to ship or shipped - print ''; + print ''; // Warehouse source if (! empty($conf->stock->enabled)) @@ -2366,30 +2366,30 @@ elseif ($id || $ref) } // Weight - print ''; // Volume - print ''; // Size - //print ''; + //print ''; if ($action == 'editline' && $lines[$i]->id == $line_id) { - print ''; print ''; - print ''; print ''; @@ -219,7 +219,7 @@ if ( $resql ) print ''; - print ''; print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index be7bcfa50ef..371be10adbd 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -338,7 +338,7 @@ if ($resql) // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; } @@ -356,14 +356,14 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } @@ -406,19 +406,19 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; } // Status billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; } // Action column - print ''; @@ -427,15 +427,15 @@ if ($resql) print ''; if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['e.ref_customer']['checked'])) print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"], "e.ref_customer", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, 'align="left"', $sortfield, $sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -454,11 +454,11 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $i=0; @@ -528,7 +528,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -537,7 +537,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -547,7 +547,7 @@ if ($resql) // Date delivery planed if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ''."\n"; } @@ -588,7 +588,7 @@ if ($resql) // Date creation if (! empty($arrayfields['e.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -596,7 +596,7 @@ if ($resql) // Date modification if (! empty($arrayfields['e.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -604,13 +604,13 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } @@ -630,7 +630,7 @@ if ($resql) } else { - dol_print_error($db); + dol_print_error($db); } // End of page diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 9da07ec45cd..50c67354dde 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -362,7 +362,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('DateDeliveryPlanned'); print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
'.$lines[$i]->qty_shipped.''.$lines[$i]->qty_shipped.''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units, "weight"); else print ' '; print ''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units, "volume"); else print ' '; print ''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").''; + print ''; print '
'; print '
'; } elseif ($object->statut == 0) { // edit-delete buttons - print '
'; + print ''; print 'id . '">' . img_edit() . ''; print ''; diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 73923105c7d..462115f6cf7 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Laurent Destailleur +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -610,15 +610,16 @@ class Shipments extends DolibarrApi } */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->thirdparty); // id already returned diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 41784fa57b5..bbb5ef58c36 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -160,7 +160,7 @@ if ($resql) print ''; print $companystatic->getNomUrl(1, 'customer', 32); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; print $companystatic->getNomUrl(1, 'customer'); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; + print ''; print ''; print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')), $viewstatut, 1); print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; print dol_print_date($db->jdate($obj->date_livraison), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) @@ -573,7 +573,7 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ''; + print ''; print dol_print_date($db->jdate($obj->date_reception), "day"); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$shipment->LibStatut($obj->fk_statut, 5).''.$shipment->LibStatut($obj->fk_statut, 5).''.yn($obj->billed).''.yn($obj->billed).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print '
'; if ($action == 'editdate_livraison') @@ -394,7 +394,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('SendingMethod'); print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'
'; print '
'; if ($action == 'editshippingmethod') { @@ -414,7 +414,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Warehouse'); print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'
'; print ''; if ($action == 'editwarehouse') { @@ -433,7 +433,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('PaymentConditionsShort'); print ''; - if ($action != 'editconditions' && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).''; + if ($action != 'editconditions' && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).''; print ''; print ''; if ($action == 'editconditions') @@ -451,7 +451,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmode' && ! empty($object->brouillon)) print ''; + if ($action != 'editmode' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($action == 'editmode') @@ -470,7 +470,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('AvailabilityPeriod'); print ''; if ($action != 'editavailability') - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; print ''; if ($action == 'editavailability') { @@ -486,7 +486,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Source'); print ''; if ($action != 'editdemandreason') - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; print ''; if ($action == 'editdemandreason') { @@ -518,7 +518,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->commande->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -628,12 +628,12 @@ if ($id > 0 || ! empty($ref)) print ''; print ''.$langs->trans("Description").''; - print ''.$langs->trans("QtyOrdered").''; - print ''.$langs->trans("QtyShipped").''; - print ''.$langs->trans("KeepToShip").''; + print ''.$langs->trans("QtyOrdered").''; + print ''.$langs->trans("QtyShipped").''; + print ''.$langs->trans("KeepToShip").''; if (! empty($conf->stock->enabled)) { - print ''.$langs->trans("RealStock").''; + print ''.$langs->trans("RealStock").''; } else { @@ -730,18 +730,18 @@ if ($id > 0 || ! empty($ref)) } // Qty ordered - print '' . $objp->qty . ''; + print '' . $objp->qty . ''; // Qty already shipped $qtyProdCom=$objp->qty; - print ''; + print ''; // Nb of sending products for this line of order $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); print $qtyAlreadyShipped; print ''; // Qty remains to ship - print ''; + print ''; if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; @@ -763,7 +763,7 @@ if ($id > 0 || ! empty($ref)) if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) && ! empty($conf->stock->enabled)) { - print ''; + print ''; print $product->stock_reel; if ($product->stock_reel < $toBeShipped[$objp->fk_product]) { @@ -797,10 +797,10 @@ if ($id > 0 || ! empty($ref)) $img=img_warning($langs->trans("StockTooLow")); } print '      -> '.$value['fullpath'].' ('.$value['nb'].')'; - print ' '.$value['nb_total'].''; + print ' '.$value['nb_total'].''; print ' '; print ' '; - print ''.$value['stock'].' '.$img.''."\n"; + print ''.$value['stock'].' '.$img.''."\n"; } } } @@ -892,7 +892,7 @@ if ($id > 0 || ! empty($ref)) } //print ''; } - //print ''; + //print ''; print ''; if ($toBeShippedTotal <= 0) { diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index 37f1b051760..c678c6d934d 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -253,7 +253,7 @@ print '
'; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; - print ''; + print ''; print ''; print ''; print '

'; @@ -263,10 +263,10 @@ print '
'; print '
'; print ''; print ''; -print ''; -print ''; -/*print ''; -print '';*/ +print ''; +print ''; +/*print ''; +print '';*/ print ''; $oldyear=0; @@ -279,22 +279,22 @@ foreach ($data as $val) print ''; - print ''; + print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; } print ''; - print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; $oldyear=$year; } @@ -307,7 +307,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("Year").''.$langs->trans("NbOfSendings").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.''.$oldyear.'000000
'; + print ''; if ($year) print ''.$year.''; else print $langs->trans("ValidationDateNotDefinedEvenIfShipmentValidated"); print ''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; } // suppression de l'export - print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; } @@ -743,13 +743,15 @@ if ($step == 3 && $datatoexport) // un formulaire en plus pour recuperer les filtres print ''; + print ''; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print '
'; +print ' - - + - - + 1) -{ +if (count($linkedObjectBlock) > 1) { ?> - - - - - + + + + + rights->expensereport->creer; // Used by the includ $permissionedit = $user->rights->expensereport->creer; // Used by the include of actions_lineupdown.inc.php +$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); + /* @@ -133,11 +136,16 @@ if (empty($reshook)) $date=''; $comments=''; $vatrate=''; + $value_unit_ht=''; $value_unit=''; $qty=1; $fk_c_type_fees=-1; } + include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; + + if (GETPOST('sendit', 'alpha')) $action=''; + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -215,7 +223,7 @@ if (empty($reshook)) if ($ret < 0) $error++; } - if (empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) + if (! $error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) { $error++; setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); @@ -671,10 +679,6 @@ if (empty($reshook)) $action=''; } } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->approve) { @@ -794,10 +798,6 @@ if (empty($reshook)) $action=''; } } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } //var_dump($user->id == $object->fk_user_validator);exit; if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->creer) @@ -1084,21 +1084,29 @@ if (empty($reshook)) $action=''; } } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } if ($action == "addline" && $user->rights->expensereport->creer) { $error = 0; + // First save uploaded file + if (! empty($_FILES)) + { + + } + // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. if (empty($vatrate)) $vatrate = "0.000"; - $vatrate = price2num($vatrate); + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); + $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); - $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); + if (empty($value_unit)) + { + $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + } + + $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); $qty = GETPOST('qty', 'int'); if (empty($qty)) $qty=1; @@ -1110,23 +1118,13 @@ if (empty($reshook)) $action=''; } - if ($vatrate < 0 || $vatrate == '') + if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); $action=''; } - /* Projects are never required. To force them, check module forceproject - if ($conf->projet->enabled) - { - if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); - } - }*/ - // Si aucune date n'est rentrée if (empty($date) || $date=="--") { @@ -1134,7 +1132,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } // Si aucun prix n'est rentré - if ($value_unit==0) + if ($value_unit == 0) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); @@ -1153,7 +1151,8 @@ if (empty($reshook)) // Insert line $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type); - if ($result > 0) { + if ($result > 0) + { $ret = $object->fetch($object->id); // Reload to get new records if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -1171,6 +1170,7 @@ if (empty($reshook)) } unset($qty); + unset($value_unit_ht); unset($value_unit); unset($vatrate); unset($comments); @@ -1240,12 +1240,18 @@ if (empty($reshook)) $projet_id = $fk_projet; $comments = GETPOST('comments', 'none'); $qty = GETPOST('qty', 'int'); - $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); $vatrate = GETPOST('vatrate', 'alpha'); - // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. - if (empty($vatrate)) $vatrate = "0.000"; - $vatrate = price2num($vatrate); + // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. + if (empty($vatrate)) $vatrate = "0.000"; + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); + + $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); + $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); + if (empty($value_unit)) + { + $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + } if (! GETPOST('fk_c_type_fees', 'int') > 0) { @@ -1253,7 +1259,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $action=''; } - if ((int) $vatrate < 0 || $vatrate == '') + if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); @@ -1742,7 +1748,7 @@ else print ''; // User to inform for approval - if ($object->fk_statut < 3) // informed + if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) // informed { print ''; print ''; // approver @@ -1760,7 +1766,7 @@ else } print ''; } - elseif($object->fk_statut == 4) + elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) { print ''; print ''; @@ -1854,11 +1860,11 @@ else print ''; print ''; $rowspan = 5; - if ($object->fk_statut < 3) $rowspan++; - elseif($object->fk_statut == 4) $rowspan+=2; + if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) $rowspan++; + elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan+=2; else $rowspan+=2; - if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2; - if($object->fk_statut==6) $rowspan+=2; + if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan+=2; + if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan+=2; print ""; print ''; @@ -1994,7 +2000,7 @@ else $actiontouse='updateline'; if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') $actiontouse='addline'; - print ''; + print ''; print ''; print ''; print ''; @@ -2016,6 +2022,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; if ($action != 'editline') @@ -2071,7 +2078,22 @@ else print ''; print ''; print ''; + // Unit price HT + print ''; + print ''; + print ''; if ($action != 'editline') @@ -2081,7 +2103,7 @@ else } // Ajout des boutons de modification/suppression - if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer) + if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { print ''; // Unit price print ''; + + // Unit price with tax + print ''; // Quantity print ''; if ($action != 'editline') @@ -2168,8 +2195,62 @@ else } // Add a line - if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer) + if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) { + $colspan = 10; + if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; + if (! empty($conf->projet->enabled)) $colspan++; + if ($action != 'editline') $colspan++; + + print ''; + print ''; + + print ''; + print ''; + print ''; print ''; print ''; @@ -2178,6 +2259,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -2185,11 +2267,12 @@ else print ''; + // Line number print ''; // Select date print ''; // Select project @@ -2200,7 +2283,7 @@ else print ''; } - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) + if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; // Select VAT @@ -2225,9 +2308,14 @@ else print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1); print ''; - // Unit price + // Unit price net print ''; + + // Unit price with tax + print ''; // Quantity @@ -2244,11 +2332,41 @@ else print ''; print ''; + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + print ''; + } } // Fin si c'est payé/validé print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); @@ -329,8 +329,8 @@ dol_fiche_end(); // TODO USe code similar to commande/stats/index.php instead of this one. /* print ''; -print ''; -print ''; +print ''; +print ''; $sql = "SELECT count(*) as nb, date_format(date_expedition,'%Y') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition"; @@ -349,7 +349,7 @@ if ($resql) $nbproduct = $row[0]; $year = $row[1]; print ""; - print ''; + print ''; $i++; } } diff --git a/htdocs/expedition/stats/month.php b/htdocs/expedition/stats/month.php index 7f00effc574..5c448198980 100644 --- a/htdocs/expedition/stats/month.php +++ b/htdocs/expedition/stats/month.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,22 +53,21 @@ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=expeditionstats&file=expediti $px = new DolGraph(); $mesg = $px->isGraphKo(); -if (! $mesg) -{ +if (! $mesg) { $px->SetData($data); $px->SetMaxValue($px->GetCeilMaxValue()); $px->SetWidth($WIDTH); $px->SetHeight($HEIGHT); - $px->SetYLabel($langs->trans("NbOfOrders")); + $px->SetYLabel($langs->trans("NbOfSendings")); $px->SetShading(3); - $px->SetHorizTickIncrement(1); - $px->SetPrecisionY(0); + $px->SetHorizTickIncrement(1); + $px->SetPrecisionY(0); $px->draw($filename, $fileurl); } print '
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").'
'.$langs->trans("Year").''.$langs->trans("NbOfSendings").'
'.$year.''.$nbproduct.'
'.$year.''.$nbproduct.'
'; -print ''; -print ''; +print ''; print '
Nombre d expedition par mois'; +print '
'.$langs->trans("NbOfSendingsByMonth").''; print $px->show(); print '
'; diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index f1eb3289b99..5bfc81c642a 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,14 +49,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
trans("Shipment"); ?> getNomUrl(1); ?> date_delivery, 'day'); ?>date_delivery, 'day'); ?>rights->expedition->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?> + getLibStatut(3); ?> element != 'commande') { @@ -68,17 +68,16 @@ foreach($linkedObjectBlock as $key => $objectlink)
trans("Total"); ?>
'.$langs->trans("VALIDATOR").'
'.$langs->trans("CANCEL_USER").''.$langs->trans("AmountHT").''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'
'.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.dol_escape_htmltag($line->comments).''.vatrate($line->vatrate, true).''; + if (! empty($line->value_unit_ht)) + { + print price($line->value_unit_ht); + } + else + { + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); + $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); + print $pricenettoshow; + } + print ''.price($line->value_unit).''.dol_escape_htmltag($line->qty).''; @@ -2137,17 +2159,22 @@ else // VAT print ''; - print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, ''); + print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); print ''; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print '
'; + print $langs->trans("UploadANewFileNow"); + print '
'; + + $modulepart = 'expensereport'; + $permission = $user->rights->expensereport->creer; + + $formfile=new FormFile($db); + + // We define var to enable the feature to add prefix of uploaded files + $savingdocmask=''; + if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) + { + //var_dump($modulepart); + if (in_array($modulepart, array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch'))) + { + $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; + } + /*if (in_array($modulepart,array('member'))) + { + $savingdocmask=$object->login.'___file__'; + }*/ + } + + // Show upload form (document and links) + $formfile->form_attach_new_file( + $_SERVER["PHP_SELF"].'?id='.$object->id, + 'none', + 0, + 0, + $permission, + $conf->browser->layout == 'phone' ? 40 : 60, + $object, + '', + 1, + $savingdocmask, + 0, + 'formuserfile', + 'accept', + '', + 1 + ); + + print '
'.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').'
'; - print $form->selectDate($date?$date:-1, 'date'); + print $form->selectDate($date?$date:-1, 'date', 0, 0, 0, '', 1, 1); print ''; $params = array('fk_expense' => $object->id); @@ -2215,7 +2298,7 @@ else // Add comments print ''; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; print '
'; + print $langs->trans("AttachTheNewLineToTheDocument"); + + print '...'; + + print '
'; print ''; + print ''; + print ''; dol_fiche_end(); @@ -2286,7 +2404,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if ($user->rights->expensereport->creer && $object->fk_statut==0) + if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_DRAFT) { if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) { @@ -2306,7 +2424,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if($user->rights->expensereport->creer && $object->fk_statut==99) + if($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2320,7 +2438,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->to_paid && $object->fk_statut==5) + if ($user->rights->expensereport->to_paid && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2334,7 +2452,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_validator == user courant * Afficher : "Valider" / "Refuser" / "Supprimer" */ - if ($object->fk_statut == 2) + if ($object->fk_statut == ExpenseReport::STATUS_VALIDATED) { if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { @@ -2343,7 +2461,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->approve && $object->fk_statut == 2) + if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_VALIDATED) { //if($object->fk_user_validator==$user->id) //{ @@ -2364,13 +2482,13 @@ if ($action != 'create' && $action != 'edit') // If status is Appoved // -------------------- - if ($user->rights->expensereport->approve && $object->fk_statut == 5) + if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { print ''; } // If bank module is used - if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == 5) + if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { // Pay if ($remaintopay == 0) @@ -2384,7 +2502,7 @@ if ($action != 'create' && $action != 'edit') } // If bank module is not used - if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) + if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) if ($object->paid == 0) @@ -2393,14 +2511,14 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == 5) + if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { // Cancel print ''; } // TODO Replace this. It should be SetUnpaid and should go back to status unpaid not canceled. - if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == 6) + if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == ExpenseReport::STATUS_CLOSED) { // Cancel print ''; @@ -2412,12 +2530,12 @@ if ($action != 'create' && $action != 'edit') } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ - if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut <= 4) + if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut < ExpenseReport::STATUS_APPROVED) { // Delete print ''; } - elseif($user->rights->expensereport->supprimer && $object->fk_statut != 6) + elseif($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED) { // Delete print ''; diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 35ce9f9a4a2..cb5a438bc21 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -489,15 +489,16 @@ class ExpenseReports extends DolibarrApi ); }*/ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->barcode_type); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index bbada0e22f7..48902b45ca8 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -115,6 +115,11 @@ class ExpenseReport extends CommonObject */ const STATUS_VALIDATED = 2; + /** + * Classified canceled + */ + const STATUS_CANCELED = 4; + /** * Classified approved */ @@ -160,7 +165,7 @@ class ExpenseReport extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf; + global $conf, $langs; $now = dol_now(); @@ -169,7 +174,7 @@ class ExpenseReport extends CommonObject // Check parameters if (empty($this->date_debut) || empty($this->date_fin)) { - $this->error='ErrorFieldRequired'; + $this->error=$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Date')); return -1; } @@ -224,25 +229,30 @@ class ExpenseReport extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id; $resql=$this->db->query($sql); - if (!$resql) $error++; - - if (is_array($this->lines) && count($this->lines)>0) + if (!$resql) { - foreach ($this->lines as $i => $val) - { - $newndfline=new ExpenseReportLine($this->db); - $newndfline=$this->lines[$i]; - $newndfline->fk_expensereport=$this->id; - if ($result >= 0) - { - $result=$newndfline->insert(); - } - if ($result < 0) - { - $error++; - break; - } - } + $this->error = $this->db->lasterror(); + $error++; + } + + if (! $error) + { + if (is_array($this->lines) && count($this->lines)>0) + { + foreach ($this->lines as $i => $val) + { + //$newndfline=new ExpenseReportLine($this->db); + $newndfline=$this->lines[$i]; + $newndfline->fk_expensereport=$this->id; + $result=$newndfline->insert(); + if ($result < 0) + { + $this->error = $newndfline->error; + $error++; + break; + } + } + } } if (! $error) @@ -1442,12 +1452,12 @@ class ExpenseReport extends CommonObject // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(gmmktime()); - if ($this->fk_statut != 4) + if ($this->fk_statut != ExpenseReport::STATUS_CANCELED) { $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 4, fk_user_cancel = ".$fuser->id; + $sql.= " SET fk_statut = ".ExpenseReport::STATUS_CANCELED.", fk_user_cancel = ".$fuser->id; $sql.= ", date_cancel='".$this->db->idate($this->date_cancel)."'"; $sql.= " ,detail_cancel='".$this->db->escape($detail)."'"; $sql.= ' WHERE rowid = '.$this->id; @@ -1676,10 +1686,10 @@ class ExpenseReport extends CommonObject /** * addline * - * @param real $qty Qty + * @param float $qty Qty * @param double $up Value init * @param int $fk_c_type_fees Type payment - * @param double $vatrate Vat rate + * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date * @param string $comments Description * @param int $fk_project Project id @@ -1703,8 +1713,8 @@ class ExpenseReport extends CommonObject if (empty($fk_project)) $fk_project = 0; $qty = price2num($qty); - if (!preg_match('/\((.*)\)/', $vatrate)) { - $vatrate = price2num($vatrate); // $txtva can have format '5.0(XXX)' or '5' + if (! preg_match('/\s*\((.*)\)/', $vatrate)) { + $vatrate = price2num($vatrate); // $txtva can have format '5.0 (XXX)' or '5' } $up = price2num($up); @@ -1715,7 +1725,7 @@ class ExpenseReport extends CommonObject $localtaxes_type=getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) + if (preg_match('/\s*\((.*)\)/', $vatrate, $reg)) { $vat_src_code = $reg[1]; $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. @@ -1727,6 +1737,7 @@ class ExpenseReport extends CommonObject $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; + $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; @@ -1928,9 +1939,9 @@ class ExpenseReport extends CommonObject * @param int $rowid Line to edit * @param int $type_fees_id Type payment * @param int $projet_id Project id - * @param double $vatrate Vat rate. Can be '8.5* (8.5NPROM...)' + * @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)' * @param string $comments Description - * @param real $qty Qty + * @param float $qty Qty * @param double $value_unit Value init * @param int $date Date * @param int $expensereport_id Expense report id @@ -2554,7 +2565,7 @@ class ExpenseReportLine */ public function insert($notrigger = 0, $fromaddline = false) { - global $langs,$user,$conf; + global $langs, $user, $conf; $error=0; @@ -2628,10 +2639,10 @@ class ExpenseReportLine /** * Function to get total amount in expense reports for a same rule * - * @param ExpenseReportRule $rule object rule to check - * @param int $fk_user user author id - * @param string $mode day|EX_DAY / month|EX_MON / year|EX_YEA to get amount - * @return amount + * @param ExpenseReportRule $rule object rule to check + * @param int $fk_user user author id + * @param string $mode day|EX_DAY / month|EX_MON / year|EX_YEA to get amount + * @return amount Amount */ public function getExpAmount(ExpenseReportRule $rule, $fk_user, $mode = 'day') { @@ -2644,10 +2655,10 @@ class ExpenseReportLine if (!empty($this->id)) $sql.= ' AND d.rowid <> '.$this->id; $sql .= ' AND d.fk_c_type_fees = '.$rule->fk_c_type_fees; if ($mode == 'day' || $mode == 'EX_DAY') $sql .= ' AND d.date = \''.dol_print_date($this->date, '%Y-%m-%d').'\''; - elseif ($mode == 'mon' || $mode == 'EX_MON') $sql .= ' AND DATE_FORMAT(d.date, \'%Y-%m\') = \''.dol_print_date($this->date, '%Y-%m').'\''; - elseif ($mode == 'year' || $mode == 'EX_YEA') $sql .= ' AND DATE_FORMAT(d.date, \'%Y\') = \''.dol_print_date($this->date, '%Y').'\''; + elseif ($mode == 'mon' || $mode == 'EX_MON') $sql .= ' AND DATE_FORMAT(d.date, \'%Y-%m\') = \''.dol_print_date($this->date, '%Y-%m').'\''; // @TODO DATE_FORMAT is forbidden + elseif ($mode == 'year' || $mode == 'EX_YEA') $sql .= ' AND DATE_FORMAT(d.date, \'%Y\') = \''.dol_print_date($this->date, '%Y').'\''; // @TODO DATE_FORMAT is forbidden - dol_syslog('ExpenseReportLine::getExpAmountByDay sql='.$sql); + dol_syslog('ExpenseReportLine::getExpAmount'); $resql = $this->db->query($sql); if ($resql) @@ -2664,19 +2675,18 @@ class ExpenseReportLine dol_print_error($this->db); } - return $amount + $this->total_ttc; } /** * update * - * @param User $fuser User - * @return int <0 if KO, >0 if OK + * @param User $user User + * @return int <0 if KO, >0 if OK */ - public function update($fuser) + public function update(User $user) { - global $fuser,$langs,$conf; + global $langs,$conf; $error=0; diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 082e3ce016e..5edf301ac25 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -35,12 +35,12 @@ class ExpenseReportStats extends Stats */ public $table_element; - var $socid; - var $userid; + public $socid; + public $userid; - var $from; - var $field; - var $where; + public $from; + public $field; + public $where; /** * Constructor diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 1a9ba67dae1..b1be48ffc76 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -73,7 +73,7 @@ $modulepart='trip'; * Actions */ -include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; +include DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 7ce39a43354..51a16f717b2 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -878,7 +878,7 @@ class Export print '
'.str_replace(',', ' , ', $filter['value']).''; + print ''; print 'rowid.'">'; print img_delete(); print ''; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 4b81697be66..9663806fdc2 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -463,7 +463,7 @@ if ($step == 1 || ! $datatoexport) //print $value.'-'.$icon.'-'.$label."
"; print img_object($objexport->array_export_module[$key]->getName(), $icon).' '; print $label; - print '
'; + print ''; if ($objexport->array_export_perms[$key]) { print ''.img_picto($langs->trans("NewExport"), 'filenew').''; @@ -623,7 +623,7 @@ if ($step == 2 && $datatoexport) { // Selected fields print ' '.img_left('default', 0, 'style="max-width: 20px"').''.img_left('default', 0, 'style="max-width: 20px"').''; //print $text.'-'.$htmltext."
"; print $form->textwithpicto($text, $htmltext); @@ -638,7 +638,7 @@ if ($step == 2 && $datatoexport) print $form->textwithpicto($text, $htmltext); //print ' ('.$code.')'; print '
'.img_right('default', 0, 'style="max-width: 20px"').''.img_right('default', 0, 'style="max-width: 20px"').' 
'; + + print '
'; print ''; print ''; //print ''; - //print ''; + //print ''; print ''; print ''; print ''; @@ -953,7 +955,7 @@ if ($step == 4 && $datatoexport) print ''; print ''; print ''; - print ''; + print ''; //print ''; //print ''; print ''; @@ -1005,9 +1007,9 @@ if ($step == 4 && $datatoexport) //print ' ('.$code.')'; print ''; - print ''; @@ -1058,7 +1060,7 @@ if ($step == 4 && $datatoexport) print ''; print ''; - print ''; @@ -1078,7 +1080,7 @@ if ($step == 4 && $datatoexport) $obj = $db->fetch_object($resql); print ''; $htmltabloflibs.= ''; - $htmltabloflibs.= ''; + $htmltabloflibs.= ''; $htmltabloflibs.= ''."\n"; } $htmltabloflibs.= '
'.$langs->trans("Entities").''.$langs->trans("ExportableFields").''.$langs->trans("ExportableFields").''.$langs->trans("FilteredFieldsValues").'
'.$langs->trans("Entities").''.$langs->trans("ExportedFields").''.$langs->trans("Position").''.$langs->trans("Position").' '.$langs->trans("FieldsTitle").'
'; + print ''; print $value.' '; - print ''; + print ''; if ($value < count($array_selected)) print ''.img_down().''; if ($value > 1) print ''.img_up().''; print '
'; + print ''; print ''; print '
'; print $obj->label; - print ''; + print ''; print 'rowid.'">'; print img_delete(); print ''; @@ -1229,7 +1231,7 @@ if ($step == 5 && $datatoexport) $label=$listeall[$key]; $htmltabloflibs.= $form->textwithpicto($label, $text).''.$objmodelexport->getLibLabelForKey($key).''.$objmodelexport->getLibVersionForKey($key).''.$objmodelexport->getLibVersionForKey($key).'
'; diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index f84f7bb8418..98b1f4552a0 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -71,7 +71,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; @@ -91,7 +91,7 @@ foreach($liste as $key => $val) $label=$liste[$key]; print ''; print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 945ecc71704..38871f55c0e 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -1,14 +1,14 @@ - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016-2018 Charlie Benke - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016-2018 Charlie Benke + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,9 +25,9 @@ */ /** - * \file fichinter/card-rec.php - * \ingroup intervention - * \brief Page to show predefined fichinter + * \file fichinter/card-rec.php + * \ingroup intervention + * \brief Page to show predefined fichinter */ require '../main.inc.php'; @@ -396,7 +396,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( if ($num) { print ''; print ''; - print ''; + print ''; print "\n"; } while ($i < $num) { @@ -413,7 +413,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print $text.' '.nl2br($objp->description); // Qty - print ''; + print ''; print ""; $i++; @@ -429,7 +429,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( dol_fiche_end(); - print '
'; + print '
'; print '     '; print ''; print '
'; @@ -495,13 +495,13 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( $morehtmlref.=''; $morehtmlref.=''; $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects( + $morehtmlref.=$formproject->select_projects( $object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1 ); $morehtmlref.=''; $morehtmlref.=''; } else { - $morehtmlref.=$form->form_project( + $morehtmlref.=$form->form_project( $_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1 @@ -552,7 +552,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print $langs->trans('Contract'); print ''; if ($action != 'contrat') { - print '
'; } @@ -560,17 +560,15 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print ''; print ''; @@ -595,7 +593,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print $langs->trans('Frequency'); print ''; if ($action != 'editfrequency' && $user->rights->ficheinter->creer) { - print ''; } print '
'.$langs->trans("AvailableFormats").''.$langs->trans("LibraryShort").''.$langs->trans("LibraryVersion").''.$langs->trans("LibraryVersion").'
'.$form->textwithpicto($label, $text).''.$model->getLibLabelForKey($key).''.$model->getLibVersionForKey($key).''.$model->getLibVersionForKey($key).'
'.$langs->trans("Description").''.$langs->trans("Duration").''.$langs->trans("Duration").'
'.convertSecondToTime($objp->duree).''.convertSecondToTime($objp->duree).'
id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetContract'), 1); print ''; if ($action == 'contrat') { $formcontract= new Formcontract($db); - $formcontract->formSelectContract( - $_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, - $object->fk_contrat, 'contratid', 0, 1 - ); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); } else { if ($object->fk_contrat) { $contratstatic = new Contrat($db); $contratstatic->fetch($object->fk_contrat); print $contratstatic->getNomUrl(0, '', 1); - } else - print " "; + } else { + print " "; + } } print '
'; + print ''; print img_edit($langs->trans('Edit'), 1) . '
'; @@ -720,7 +718,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print ''; print ''; print ''; - print ''; + print ''; print ''; $num = count($object->lines); @@ -744,7 +742,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( print $text.' '.nl2br($object->lines[$i]->desc); print ''; - print ''; + print ''; print "\n"; $i++; } @@ -801,66 +799,38 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime( $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); -print_barre_liste( - $langs->trans("RepeatableInterventional"), $page, - $_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder, - '', $num, '', 'title_commercial.png' - ); + print_barre_liste( + $langs->trans("RepeatableInterventional"), + $page, + $_SERVER['PHP_SELF'], + "&socid=$socid", + $sortfield, + $sortorder, + '', + $num, + '', + 'title_commercial.png' + ); print $langs->trans("ToCreateAPredefinedInterventional").'

'; $i = 0; print '
'.$langs->trans("Description").''.$langs->trans("Duration").''.$langs->trans("Duration").'
'.convertSecondToTime($object->lines[$i]->duree).''.convertSecondToTime($object->lines[$i]->duree).'
'; print ''; -print_liste_field_titre( - $langs->trans("Ref"), $_SERVER['PHP_SELF'], "f.titre", "", "", - 'width="200px" align="left"', $sortfiled, $sortorder - ); - -print_liste_field_titre( - $langs->trans("Company"), $_SERVER['PHP_SELF'], "s.nom", "", "", - 'width="200px" align="left"', $sortfiled, $sortorder - ); - if (! empty($conf->contrat->enabled)) - print_liste_field_titre( - $langs->trans("Contract"), $_SERVER['PHP_SELF'], - "f.fk_contrat", "", "", - 'width="100px" align="left"', $sortfiled, $sortorder - ); - - if (! empty($conf->projet->enabled)) - print_liste_field_titre( - $langs->trans("Project"), $_SERVER['PHP_SELF'], - "f.fk_project", "", "", - 'width="100px" align="left"', $sortfiled, $sortorder - ); -print_liste_field_titre( - $langs->trans("Duration"), $_SERVER['PHP_SELF'], - 'f.duree', '', '', - 'width="50px" align="right"', $sortfiled, $sortorder - ); - // Recurring or not -print_liste_field_titre( - $langs->trans("Frequency"), $_SERVER['PHP_SELF'], - "f.frequency", "", "", - 'width="100px" align="center"', $sortfiled, $sortorder - ); -print_liste_field_titre( - $langs->trans("NbOfGenerationDone"), $_SERVER['PHP_SELF'], - "f.nb_gen_done", "", "", - 'width="100px" align="center"', $sortfiled, $sortorder - ); - -print_liste_field_titre( - $langs->trans("DateLastGeneration"), $_SERVER['PHP_SELF'], - "f.date_last_gen", "", "", - 'width="100px" align="center"', $sortfiled, $sortorder - ); -print_liste_field_titre( - $langs->trans("NextDateToIntervention"), $_SERVER['PHP_SELF'], - "f.date_when", "", "", - 'width="100px" align="center"', $sortfiled, $sortorder - ); + print_liste_field_titre("Ref", $_SERVER['PHP_SELF'], "f.titre", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "s.nom", "", "", 'width="200px"', $sortfield, $sortorder, 'left '); + if (! empty($conf->contrat->enabled)) { + print_liste_field_titre("Contract", $_SERVER['PHP_SELF'], "f.fk_contrat", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); + } + if (! empty($conf->projet->enabled)) { + print_liste_field_titre("Project", $_SERVER['PHP_SELF'], "f.fk_project", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); + } + print_liste_field_titre("Duration", $_SERVER['PHP_SELF'], 'f.duree', '', '', 'width="50px"', $sortfield, $sortorder, 'right '); + // Recurring or not + print_liste_field_titre("Frequency", $_SERVER['PHP_SELF'], "f.frequency", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); + print_liste_field_titre("NbOfGenerationDone", $_SERVER['PHP_SELF'], "f.nb_gen_done", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateLastGeneration", $_SERVER['PHP_SELF'], "f.date_last_gen", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); + print_liste_field_titre("NextDateToIntervention", $_SERVER['PHP_SELF'], "f.date_when", "", "", 'width="100px"', $sortfield, $sortorder, 'center '); print ''; print "\n"; @@ -899,36 +869,36 @@ print_liste_field_titre( print ''; } - print ''; + print ''; - print ''; + print ''; - print ''; - print ''; - print ''; } else { print ''.$langs->trans('NA').''; print ''; - print ''; - print ''; } if ($user->rights->ficheinter->creer) { // Action column - print ''; } @@ -1393,8 +1393,8 @@ elseif ($id > 0 || ! empty($ref)) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -1414,10 +1414,10 @@ elseif ($id > 0 || ! empty($ref)) print dol_htmlentitiesbr($objp->description); // Date - print ''; + print ''; // Duration - print ''; + print ''; print "\n"; @@ -1425,16 +1425,16 @@ elseif ($id > 0 || ! empty($ref)) // Icone d'edition et suppression if ($object->statut == 0 && $user->rights->ficheinter->creer) { - print ''; - print ''; - print ''; // Date d'intervention - print ''; // Duration - print ''; - print ''; print '' . "\n"; @@ -1532,8 +1532,8 @@ elseif ($id > 0 || ! empty($ref)) print ''; - print ''; - print ''; + print ''; + print ''; print ''; print "\n"; } @@ -1549,7 +1549,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; // Date intervention - print ''; // Duration - print ''; - print ''; + print ''; print ''; //Line extrafield diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index d49f58ed52e..2702ad6c55e 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -417,15 +417,16 @@ class Interventions extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->statuts_short); diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 49521dff397..d240aadf42d 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -128,7 +128,7 @@ if ($resql) } if ($conf->use_javascript_ajax) { - print ''; print ''; - print ''; @@ -160,8 +160,8 @@ if ($resql) } } //if ($totalinprocess != $total) - //print ''; - print ''; + //print ''; + print ''; print "
'.convertSecondToTime($objp->duree).''.convertSecondToTime($objp->duree).''.yn($objp->frequency?1:0).''.yn($objp->frequency?1:0).''; + print ''; if ($objp->frequency) { print $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') ; print ''; + print ''; print dol_print_date($db->jdate($objp->date_last_gen), 'day') ; print ''; + print ''; print dol_print_date($db->jdate($objp->date_when), 'day'); print ''; + print ''; print ''.$langs->trans('NA').''; print ''; + print ''; print ''.$langs->trans('NA').''; print ''; + print ''; if ($user->rights->ficheinter->creer) { if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print 'id.'">'; + print 'id.'">'; print img_edit($langs->trans('SetContract'), 1); print '
'.$langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').'   '.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)?dol_print_date($db->jdate($objp->date_intervention), 'dayhour'):dol_print_date($db->jdate($objp->date_intervention), 'day')).''.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)?dol_print_date($db->jdate($objp->date_intervention), 'dayhour'):dol_print_date($db->jdate($objp->date_intervention), 'day')).''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?convertSecondToTime($objp->duree):'').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?convertSecondToTime($objp->duree):'').''; + print ''; print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; print ''; + print ''; print 'rowid.'">'; print img_delete(); print ''; + print ''; if ($num > 1) { if ($i > 0) @@ -1484,7 +1484,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; + print ''; if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) { print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention"); } else { @@ -1493,7 +1493,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; + print ''; if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { $selectmode = 'select'; if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) @@ -1502,7 +1502,7 @@ elseif ($id > 0 || ! empty($ref)) } print ''; + print ''; print '
'; print ''; // ancre print $langs->trans('Description').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').''.$langs->trans('Date').''.(empty($conf->global->FICHINTER_WITHOUT_DURATION)?$langs->trans('Duration'):'').' 
'; + print ''; $now=dol_now(); $timearray=dol_getdate($now); if (! GETPOST('diday', 'int')) { @@ -1565,7 +1565,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; + print ''; if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) { $selectmode = 'select'; if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) { @@ -1575,7 +1575,7 @@ elseif ($id > 0 || ! empty($ref)) } print '
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -150,7 +150,7 @@ if ($resql) { print '
'.$fichinterstatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; + print ''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; print $fichinterstatic->LibStatut($status, $bool, 3); print ''; print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; } else @@ -263,7 +263,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -274,7 +274,7 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''; print ''.dol_print_date($db->jdate($obj->datem), 'day').''; - print ''.$fichinterstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$fichinterstatic->LibStatut($obj->fk_statut, 5).''; print ''; $i++; } @@ -331,7 +331,7 @@ if (! empty($conf->ficheinter->enabled)) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -342,7 +342,7 @@ if (! empty($conf->ficheinter->enabled)) print ''.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($obj->name, 24).''; - print ''.$fichinterstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$fichinterstatic->LibStatut($obj->fk_statut, 5).''; print ''; $i++; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 2652787a9c0..c105d06a852 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -383,7 +383,7 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; $tmp = $objectstatic->LibStatut(0); // To load $this->statuts_short $liststatus=$objectstatic->statuts_short; if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1 @@ -403,7 +403,7 @@ if ($resql) { print ' '; } - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -420,13 +420,13 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], ''); - if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $total = 0; @@ -469,7 +469,7 @@ if ($resql) } // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -504,7 +504,7 @@ if ($resql) // Date creation if (! empty($arrayfields['f.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -512,7 +512,7 @@ if ($resql) // Date modification if (! empty($arrayfields['f.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -520,7 +520,7 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$objectstatic->LibStatut($obj->fk_statut, 5).''; if (! $i) $totalarray['nbfield']++; } // Fields of detail of line @@ -531,18 +531,18 @@ if ($resql) } if (! empty($arrayfields['fd.date']['checked'])) { - print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; + print ''.dol_print_date($db->jdate($obj->dp), 'dayhour')."\n"; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['fd.duree']['checked'])) { - print ''.convertSecondToTime($obj->duree, 'allhourmin').''; + print ''.convertSecondToTime($obj->duree, 'allhourmin').''; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield']; $totalarray['totalduration']+=$obj->duree; } // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -571,7 +571,7 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totaldurationfield'] == $i) print ''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''; + elseif ($totalarray['totaldurationfield'] == $i) print ''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''; else print ''; } print ''; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 8d2c465a0cf..824dfff8c84 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -254,7 +254,7 @@ print '
'; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; - print ''; + print ''; print ''; print ''; print '

'; @@ -263,13 +263,13 @@ print '
'; print '
'; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; @@ -282,26 +282,26 @@ foreach ($data as $val) $oldyear--; print ''; - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } @@ -314,7 +314,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("NbOfinterventions").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("Year").''.$langs->trans("NbOfinterventions").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).''.round($val['total_diff']).''.price(price2num($val['avg'], 'MT'), 1).''.round($val['avg_diff']).'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).''.round($val['total_diff']).''.price(price2num($val['avg'], 'MT'), 1).''.round($val['avg_diff']).'
'; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print ''; + print ''; print '
'; +print ' - + - - + + - \ No newline at end of file + diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 3cb2e585db6..ae17cdecd46 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -232,7 +232,7 @@ if ($object->id > 0) print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index 8825a249431..9f481b6b648 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -47,13 +47,13 @@ foreach($linkedObjectBlock as $key => $objectlink) trans("Intervention"); ?> getNomUrl(1); ?> datev, 'day'); ?>datev, 'day'); ?> getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'; + if (($action != 'editconditions') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentConditions'); print ''; - if (($action != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; if ($action == 'editconditions') @@ -251,7 +251,7 @@ if ($object->id > 0) print ''; + if (($action != 'editmode') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentMode'); print ''; - if (($action != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print '
'; if ($action == 'editmode') @@ -269,7 +269,7 @@ if ($object->id > 0) print '
'; print ''; if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) { - print ''; + print ''; } print '
'; print $langs->trans("CustomerRelativeDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -283,7 +283,7 @@ if ($object->id > 0) print ''; print ''; print ''; print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -442,7 +442,7 @@ if ($object->id > 0) print ''; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowSupplierPreview").'
'.$langs->trans("ShowSupplierPreview").'
'; print '
'; @@ -471,7 +471,7 @@ if ($object->id > 0) print ''; print ''; - print ''; @@ -498,8 +498,8 @@ if ($object->id > 0) print ''; - //print ''; - print ''; + print ''; print ''; } @@ -565,7 +565,7 @@ if ($object->id > 0) $proposalstatic->total_ttc = $obj->total_ttc; print $proposalstatic->getNomUrl(1); print ''; - print ''; - print ''; + print ''; print ''; $i++; } @@ -649,8 +649,8 @@ if ($object->id > 0) print ''; print ''; } @@ -668,7 +668,7 @@ if ($object->id > 0) $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; - print ''; - print ''; + print ''; print ''; $i++; } @@ -721,8 +721,8 @@ if ($object->id > 0) print ''; print ''; } @@ -745,9 +745,9 @@ if ($object->id > 0) print $obj->ref_supplier?' - '.$obj->ref_supplier:''; print ($obj->libelle?' - ':'').dol_trunc($obj->libelle, 14); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 3f94401bc9d..416f7e11e94 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -333,15 +333,16 @@ class SupplierInvoices extends DolibarrApi ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->rowid); diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 9a898fae3a7..42f7eccf608 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -330,15 +330,16 @@ class SupplierOrders extends DolibarrApi ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->rowid); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d2c7ad43a00..6b533ae2d21 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1555,9 +1555,10 @@ class FactureFournisseur extends CommonInvoice * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref + * @param string $special_code Special code * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '') + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '') { global $langs, $mysoc, $conf; @@ -1727,7 +1728,7 @@ class FactureFournisseur extends CommonInvoice $this->line->rang=$rang; $this->line->info_bits=$info_bits; - $this->line->special_code=$this->special_code; + $this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code); $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 644ebd79347..045beb3bb0c 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -308,7 +308,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -618,7 +618,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index fab8aa705de..7a8bb2bcd22 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -523,12 +523,12 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; } - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print "\n"; } @@ -595,17 +595,17 @@ if ($id > 0 || ! empty($ref)) { $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); // Supplier ref - print ''; + print ''; // Qty ordered - print ''; + print ''; // Already dispatched - print ''; + print ''; if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; - print ''; // Qty to dispatch print ''; // Qty to dispatch print ''; @@ -691,7 +691,7 @@ if ($id > 0 || ! empty($ref)) { print ''; // Warehouse - print ''; print ''; } - print ''; + print ''; print ''; print ''; print ''; if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) || !empty($conf->reception->enabled)) - print ''; + print ''; print "\n"; @@ -836,7 +836,7 @@ if ($id > 0 || ! empty($ref)) { } // Qty - print ''; + print ''; print ''; // Warehouse @@ -851,14 +851,14 @@ if ($id > 0 || ! empty($ref)) { // Status if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && empty($reception->rowid)) { - print ''; // Add button to check/uncheck disaptching - print ''; }elseif(!empty($conf->reception->enabled)){ - print ''; - print ''; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index c846ff16b5f..6c2b66bc7f3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -119,13 +119,13 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } //if ($totalinprocess != $total) - //print ''; - print ''; + //print ''; + print ''; print "
'.$langs->trans("ProductsAndServices").''; + print ''.$langs->trans("ProductsAndServices").''; print ''.$langs->trans("AllProductReferencesOfSupplier").' '.$object->nbOfProductRefs().''; print '
'; print dol_trunc(dol_htmlentities($objp->label), 30); print ''.dol_print_date($objp->tms, 'day').''; + //print ''.dol_print_date($objp->tms, 'day').''; //print (isset($objp->unitprice) ? price($objp->unitprice) : ''); if (isset($objp->price)) { @@ -546,8 +546,8 @@ if ($object->id > 0) print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("LastSupplierProposals", ($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'; + print ''; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); @@ -575,7 +575,7 @@ if ($object->id > 0) print "-"; } print ''.$proposalstatic->LibStatut($obj->fk_statut, 5).''.$proposalstatic->LibStatut($obj->fk_statut, 5).'
'; print ''; - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("LastSupplierOrders", ($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'; + print ''; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); @@ -678,7 +678,7 @@ if ($object->id > 0) print "-"; } print ''.$orderstatic->LibStatut($obj->fk_statut, 5).''.$orderstatic->LibStatut($obj->fk_statut, 5).'
'; - print ''; - print ''; + print '
'.$langs->trans('LastSuppliersBills', ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; + print ''; print '
'.$langs->trans('LastSuppliersBills', ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'.dol_print_date($db->jdate($obj->df), 'day').''.price($obj->amount).''; + print ''.dol_print_date($db->jdate($obj->df), 'day').''.price($obj->amount).''; print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am); print '
' . $langs->trans("SupplierRef") . '' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("SupplierRef") . '' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Warehouse") . '
'.$objp->sref.''.$objp->sref.'' . $objp->qty . '' . $objp->qty . '' . $products_dispatched[$objp->rowid] . '' . $products_dispatched[$objp->rowid] . ''; + print ''; print ''; //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); @@ -645,7 +645,7 @@ if ($id > 0 || ! empty($ref)) { } else { $type = 'dispatch'; - print ''; + print ''; print ''; //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); @@ -672,7 +672,7 @@ if ($id > 0 || ! empty($ref)) { } // Qty to dispatch - print ''; + print ''; print ''; print ''; + print ''; if (count($listwarehouses) > 1) { print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { @@ -796,12 +796,12 @@ if ($id > 0 || ! empty($ref)) { print '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("QtyDispatched") . '' . $langs->trans("QtyDispatched") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Comment") . '' . $langs->trans("Status") . '' . $langs->trans("Status") . '
' . $objp->qty . '' . $objp->qty . ' '; + print ''; $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status); // print $supplierorderdispatch->status; print $supplierorderdispatch->getLibStatut(5); print ''; + print ''; if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) { if (empty($objp->status)) { @@ -887,13 +887,13 @@ if ($id > 0 || ! empty($ref)) { } print ''; + print ''; if(!empty($reception->id)){ print $reception->getLibStatut(5); } } print ''; + print ''; print '
'.$commandestatic->LibStatut($statut, 0).''.(isset($vals[$statut])?$vals[$statut]:0).''.(isset($vals[$statut])?$vals[$statut]:0).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -140,8 +140,8 @@ if ($resql) print '
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; } @@ -176,7 +176,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; while ($i < $num) @@ -185,7 +185,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; $i++; @@ -341,7 +341,7 @@ if ($resql) print ' '; print ''; - print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -408,7 +408,7 @@ print ''; -print ''; print ''; -print ''; +print ''; print ''; $i++; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 48d6cd28a1e..a2351dd7d9a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -791,21 +791,21 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } // Date order if (! empty($arrayfields['cf.date_commande']['checked'])) { - print ''; } if (! empty($arrayfields['cf.total_vat']['checked'])) { // Amount - print ''; } if (! empty($arrayfields['cf.total_ttc']['checked'])) { // Amount - print ''; } @@ -863,19 +863,19 @@ if ($resql) // Status if (! empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; } // Status billed if (! empty($arrayfields['cf.billed']['checked'])) { - print ''; } // Action column - print ''; @@ -891,25 +891,25 @@ if ($resql) if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'], $_SERVER["PHP_SELF"], "cf.fk_author", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'], $_SERVER["PHP_SELF"], "cf.date_commande", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'], $_SERVER["PHP_SELF"], 'cf.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'], $_SERVER["PHP_SELF"], "cf.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'], $_SERVER["PHP_SELF"], "cf.tva", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'], $_SERVER["PHP_SELF"], "cf.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'], $_SERVER["PHP_SELF"], "cf.date_commande", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'], $_SERVER["PHP_SELF"], 'cf.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'], $_SERVER["PHP_SELF"], "cf.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'], $_SERVER["PHP_SELF"], "cf.tva", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'], $_SERVER["PHP_SELF"], "cf.total_ttc", "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.tms']['checked'])) print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.fk_statut']['checked'])) print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'], $_SERVER["PHP_SELF"], 'cf.billed', '', $param, 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['cf.tms']['checked'])) print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['cf.fk_statut']['checked'])) print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'], $_SERVER["PHP_SELF"], 'cf.billed', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -952,7 +952,7 @@ if ($resql) //print ''; // Other picto tool - print ''; @@ -1036,7 +1036,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -1046,7 +1046,7 @@ if ($resql) // Order date if (! empty($arrayfields['cf.date_commande']['checked'])) { - print ''; @@ -1055,7 +1055,7 @@ if ($resql) // Plannned date of delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -1074,7 +1074,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['cf.total_vat']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_tva; @@ -1082,7 +1082,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['cf.total_ttc']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1097,7 +1097,7 @@ if ($resql) // Date creation if (! empty($arrayfields['cf.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1105,7 +1105,7 @@ if ($resql) // Date modification if (! empty($arrayfields['cf.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1113,18 +1113,18 @@ if ($resql) // Status if (! empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Billed if (! empty($arrayfields['cf.billed']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; else print ''; } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 8c8452b51ce..6e3a30507dc 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -500,10 +500,10 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print_liste_field_titre('Ref', 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder); print_liste_field_titre('RefSupplier', 'orderstoinvoice.php', 'c.ref_supplier', '', '&socid=' . $socid, '', $sortfield, $sortorder); - print_liste_field_titre('OrderDate', 'orderstoinvoice.php', 'c.date_commande', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('DeliveryDate', 'orderstoinvoice.php', 'c.date_livraison', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Status', '', '', '', '', 'align="right"'); - print_liste_field_titre('GenerateBill', '', '', '', '', 'align="center"'); + print_liste_field_titre('OrderDate', 'orderstoinvoice.php', 'c.date_commande', '', '&socid=' . $socid, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('DeliveryDate', 'orderstoinvoice.php', 'c.date_livraison', '', '&socid=' . $socid, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', '', '', '', '', '', '', '', 'right '); + print_liste_field_titre('GenerateBill', '', '', '', '', '', '', '', 'center '); print "\n"; // Lignes des champs de filtre @@ -513,27 +513,27 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print ''; // print ''; // DATE ORDER - print ''; // DATE DELIVERY - print ''; // SEARCH BUTTON - print ''; // ALL/NONE - print ''; @@ -556,7 +556,7 @@ if (($action != 'create' && $action != 'add') && !$error) { print $generic_commande->getNomUrl(1, $objp->fk_statut); print ''; - print ''; // Order date - print ''; // Delivery date - print ''; // Statut - print ''; + print ''; // Checkbox print ' - - + - - + + 1) - - - - - + + + + + fk_unit, $lines[$i]->id, 0, - $lines[$i]->ref_supplier + $lines[$i]->ref_supplier, + $lines[$i]->special_code ); if ($result < 0) @@ -1075,7 +1076,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { @@ -1152,7 +1153,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -2501,7 +2502,7 @@ else print $langs->trans('PaymentConditions'); print ''; + print ''; } print '
'.$langs->trans("Status").''.$langs->trans("Nb").''.$langs->trans("Nb").'
'.$commandestatic->LibStatut($row[1]).''.$row[0].' '.$commandestatic->LibStatut($row[1], 3).''.$row[0].' '.$commandestatic->LibStatut($row[1], 3).'
'; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -352,7 +352,7 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.dol_print_date($db->jdate($obj->tms), 'day').''.$commandestatic->LibStatut($obj->fk_statut, 5).''.$commandestatic->LibStatut($obj->fk_statut, 5).'
'; print ' '; print ''; +print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -419,7 +419,7 @@ print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
'; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); @@ -814,7 +814,7 @@ if ($resql) // Date delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); @@ -823,21 +823,21 @@ if ($resql) if (! empty($arrayfields['cf.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $formorder->selectSupplierOrderStatus((strstr($search_status, ',')?-1:$search_status), 1, 'search_status'); print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; //print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->commande->dir_output.'/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); @@ -1027,7 +1027,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day'); else print ''; print ''; + print ''; print dol_print_date($db->jdate($obj->date_delivery), 'day'); if ($objectstatic->hasDelay() && ! empty($objectstatic->date_delivery)) { print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); @@ -1066,7 +1066,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['cf.total_ht']['checked'])) { - print ''.price($obj->total_ht)."'.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.price($obj->total_ttc)."'; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''.yn($obj->billed).''.yn($obj->billed).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1151,9 +1151,9 @@ if ($resql) if ($num < $limit) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'; - print ''; + print ''; print ''; print ''; + print ''; print $period; print ''; + print ''; print $periodely; print ''; + print ''; print ''; print ''; + print ''; if ($conf->use_javascript_ajax) print '' . $langs->trans("All") . ' / ' . $langs->trans("None") . ''; print ''; + print ''; $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->rowid; @@ -567,17 +567,17 @@ if (($action != 'create' && $action != 'add') && !$error) { print '' . $objp->ref_supplier . ''; + print ''; print dol_print_date($db->jdate($objp->date_commande), 'day'); print ''; + print ''; print dol_print_date($db->jdate($objp->date_livraison), 'day'); print '' . $generic_commande->LibStatut($objp->fk_statut, 5) . '' . $generic_commande->LibStatut($objp->fk_statut, 5) . ''; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 7a7d7d51b80..f46c5d20b81 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -49,14 +49,14 @@ foreach($linkedObjectBlock as $key => $objectlink) trans("SupplierOrder"); ?> trans("ShowOrder"), "order").' '.$objectlink->ref; ?> ref_supplier; ?>date, 'day'); ?>date, 'day'); ?>rights->fournisseur->commande->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
trans("Total"); ?>
'; if ($action != 'editconditions' && $user->rights->fournisseur->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; @@ -2523,7 +2524,7 @@ else print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print '
'; @@ -2547,7 +2548,7 @@ else print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print ''; if ($action == 'editmulticurrencycode') { @@ -2564,7 +2565,7 @@ else print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -2589,7 +2590,7 @@ else print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->fournisseur->facture->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') { @@ -2606,7 +2607,7 @@ else print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->fournisseur->facture->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -2729,8 +2730,8 @@ else print '' . ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . ''; print ''.$langs->trans('Date').''; print ''.$langs->trans('Type').''; - if (! empty($conf->banque->enabled)) print ''.$langs->trans('BankAccount').''; - print ''.$langs->trans('Amount').''; + if (! empty($conf->banque->enabled)) print ''.$langs->trans('BankAccount').''; + print ''.$langs->trans('Amount').''; print ' '; print ''; @@ -2769,12 +2770,12 @@ else $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } - print ''; + print ''; if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1, 'transactions'); print ''; } - print '' . price($sign * $objp->amount) . ''; - print ''; + print '' . price($sign * $objp->amount) . ''; + print ''; if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print 'rowid.'">'; @@ -2795,13 +2796,13 @@ else /* if ($object->paye == 0) { - print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; - print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; + print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; + print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; $resteapayer = $object->total_ttc - $totalpaye; - print ''.$langs->trans('RemainderToPay').' :'; - print ''.price($resteapayer).''; + print ''.$langs->trans('RemainderToPay').' :'; + print ''.price($resteapayer).''; } */ @@ -2815,12 +2816,12 @@ else if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { // Total already paid - print ''; + print ''; if ($object->type != FactureFournisseur::TYPE_DEPOSIT) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; + print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; //$resteapayer = $object->total_ttc - $totalpaye; $resteapayeraffiche = $resteapayer; @@ -2844,15 +2845,15 @@ else while ($i < $num) { $obj = $db->fetch_object($resql); $invoice->fetch($obj->fk_invoice_supplier_source); - print ''; + print ''; if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) print $langs->trans("CreditNote") . ' '; if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) print $langs->trans("Deposit") . ' '; print $invoice->getNomUrl(0); print ' :'; - print '' . price($obj->amount_ttc) . ''; - print ''; + print '' . price($obj->amount_ttc) . ''; + print ''; print 'rowid . '">' . img_delete() . ''; print ''; $i ++; @@ -2867,51 +2868,51 @@ else // Paye partiellement 'escompte' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badsupplier' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; // $resteapayeraffiche=0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { - print ''; + print ''; print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { - print ''; + print ''; $text = $langs->trans("HelpAbandonOther"); if ($object->close_note) $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed - print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; // Remainder to pay - print ''; + print ''; if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); else print $langs->trans('ExcessPaid'); print ' :'; - print '' . price($resteapayeraffiche) . ''; + print '' . price($resteapayeraffiche) . ''; print ' '; } else // Credit note @@ -2919,26 +2920,26 @@ else $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back - print ''; + print ''; print $langs->trans('AlreadyPaidBack'); - print ' :' . price($sign * $totalpaye) . ' '; + print ' :' . price($sign * $totalpaye) . ' '; // Billed - print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; // Remainder to pay back - print ''; + print ''; if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); else print $langs->trans('ExcessPaid'); print ' :'; - print '' . price($sign * $resteapayeraffiche) . ''; + print '' . price($sign * $resteapayeraffiche) . ''; print ' '; // Sold credit note - // print ''.$langs->trans('TotalTTC').' :'; - // print ''.price($sign * + // print ''.$langs->trans('TotalTTC').' :'; + // print ''.price($sign * // $object->total_ttc).' '; } diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 919c5b75663..27a659300cc 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -189,13 +189,13 @@ if ($user->rights->fournisseur->facture->lire) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "f.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "f.date_lim_reglement", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "f.date_lim_reglement", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("AlreadyPaid", $_SERVER["PHP_SELF"], "am", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "fk_statut,paye,am", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AlreadyPaid", $_SERVER["PHP_SELF"], "am", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "fk_statut,paye,am", "", $param, '', $sortfield, $sortorder, 'right '); print "\n"; // Lines with filter fields @@ -206,14 +206,14 @@ if ($user->rights->fournisseur->facture->lire) print ''; print ' '; print ' '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -245,8 +245,8 @@ if ($user->rights->fournisseur->facture->lire) print ''.dol_trunc($objp->ref_supplier, 12).''; - print ''.dol_print_date($db->jdate($objp->df), 'day')."\n"; - print ''.dol_print_date($db->jdate($objp->datelimite), 'day'); + print ''.dol_print_date($db->jdate($objp->df), 'day')."\n"; + print ''.dol_print_date($db->jdate($objp->datelimite), 'day'); if ($facturestatic->hasDelay()) { print img_warning($langs->trans("Late")); } @@ -258,12 +258,12 @@ if ($user->rights->fournisseur->facture->lire) print $companystatic->getNomUrl(1, 'supplier', 32); print ''; - print "".price($objp->total_ht).""; - print "".price($objp->total_ttc).""; - print "".price($objp->am).""; + print "".price($objp->total_ht).""; + print "".price($objp->total_ttc).""; + print "".price($objp->am).""; // Show invoice status - print ''; + print ''; print $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 5, $objp->am); print ''; @@ -276,11 +276,11 @@ if ($user->rights->fournisseur->facture->lire) } print ''; - print "".$langs->trans("Total").": "; - print "".price($total_ht).""; - print "".price($total_ttc).""; - print "".price($total_paid).""; - print ' '; + print "".$langs->trans("Total").": "; + print "".price($total_ht).""; + print "".price($total_ttc).""; + print "".price($total_paid).""; + print ' '; print "\n"; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 73d5a4b3a4d..3a710642b03 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -589,7 +589,7 @@ if ($resql) // Ref if (! empty($arrayfields['f.ref']['checked'])) { - print ''; + print ''; print ''; print ''; } @@ -630,7 +630,7 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.datef']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); @@ -639,7 +639,7 @@ if ($resql) // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year_lim?$year_lim:-1, 'year_lim', 1, 20, 5); @@ -670,67 +670,67 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; + print ''; $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } if (! empty($arrayfields['f.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_localtax1']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_localtax2']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''; + print ''; print ''; } if (! empty($arrayfields['rtp']['checked'])) { - print ''; + print ''; print ''; } // Extra fields @@ -755,13 +755,13 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; } // Action column - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -773,33 +773,33 @@ if ($resql) if (! empty($arrayfields['f.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['f.ref_supplier']['label'], $_SERVER["PHP_SELF"], 'f.ref_supplier', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'], $_SERVER["PHP_SELF"], 'f.type', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['f.label']['checked'])) print_liste_field_titre($arrayfields['f.label']['label'], $_SERVER['PHP_SELF'], "f.libelle,f.rowid", '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef,f.rowid', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef,f.rowid', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $facturestatic=new FactureFournisseur($db); @@ -853,7 +853,7 @@ if ($resql) //print ''; //print ''; // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); @@ -894,7 +894,7 @@ if ($resql) // Date if (! empty($arrayfields['f.datef']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->datef), 'day'); print ''; if (! $i) $totalarray['nbfield']++; @@ -903,7 +903,7 @@ if ($resql) // Date limit if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); + print ''.dol_print_date($datelimit, 'day'); if ($facturestatic->hasDelay()) { print img_warning($langs->trans('Late')); @@ -960,7 +960,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; @@ -969,7 +969,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; @@ -988,7 +988,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -996,7 +996,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -1004,7 +1004,7 @@ if ($resql) // Amount LocalTax1 if (! empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; + print ''.price($obj->total_localtax1)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield']; $totalarray['totallocaltax1'] += $obj->total_localtax1; @@ -1012,7 +1012,7 @@ if ($resql) // Amount LocalTax2 if (! empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; + print ''.price($obj->total_localtax2)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield']; $totalarray['totallocaltax2'] += $obj->total_localtax2; @@ -1020,7 +1020,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1028,7 +1028,7 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $totalpay; @@ -1036,7 +1036,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; @@ -1052,7 +1052,7 @@ if ($resql) // Date creation if (! empty($arrayfields['f.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -1060,7 +1060,7 @@ if ($resql) // Date modification if (! empty($arrayfields['f.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -1068,7 +1068,7 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; // TODO $paiement is not yet defined print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); print ""; @@ -1076,7 +1076,7 @@ if ($resql) } // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1111,13 +1111,13 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).''; - elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; - elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).''; - elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).''; + elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).''; + elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).''; else print ''; } print ''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6e307f67b31..fa4500b8c31 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -513,17 +513,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.$langs->trans('Invoice').''; print ''.$langs->trans('RefSupplier').''; - print ''.$langs->trans('Date').''; - print ''.$langs->trans('DateMaxPayment').''; + print ''.$langs->trans('Date').''; + print ''.$langs->trans('DateMaxPayment').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyRemainderToPay').''; - print ''.$langs->trans('AmountTTC').''; - print ''.$langs->trans('AlreadyPaid').''; - print ''.$langs->trans('RemainderToPay').''; - print ''.$langs->trans('PaymentAmount').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyRemainderToPay').''; + print ''.$langs->trans('AmountTTC').''; + print ''.$langs->trans('AlreadyPaid').''; + print ''.$langs->trans('RemainderToPay').''; + print ''.$langs->trans('PaymentAmount').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; print ''; $total=0; @@ -566,18 +566,18 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date if ($objp->df > 0 ) { - print ''; + print ''; print dol_print_date($db->jdate($objp->df), 'day').''; } else { - print '!!!'; + print '!!!'; } // Date Max Payment if ($objp->dlr > 0 ) { - print ''; + print ''; print dol_print_date($db->jdate($objp->dlr), 'day'); if ($invoice->hasDelay()) @@ -589,30 +589,30 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { - print '--'; + print '--'; } // Multicurrency if (!empty($conf->multicurrency->enabled)) { // Currency - print ''.$objp->multicurrency_code."\n"; + print ''.$objp->multicurrency_code."\n"; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_total_ttc); } print ''; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_am); } print ''; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_total_ttc - $objp->multicurrency_am); @@ -620,17 +620,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - print ''.price($objp->total_ttc).''; + print ''.price($objp->total_ttc).''; - print ''.price($objp->am); + print ''.price($objp->am); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''; - print ''.price($remaintopay).''; + print ''.price($remaintopay).''; // Amount - print ''; + print ''; $namef = 'amount_'.$objp->facid; $nameRemain = 'remain_'.$objp->facid; @@ -652,7 +652,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Multicurrency Price if (! empty($conf->multicurrency->enabled)) { - print ''; + print ''; // Add remind multicurrency amount $namef = 'multicurrency_amount_'.$objp->facid; @@ -688,19 +688,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').':'; + print ''.$langs->trans('TotalTTC').':'; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; - print ''.price($total_ttc).''; - print ''.price($totalrecu); + print ''.price($total_ttc).''; + print ''.price($totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''; - print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''; - print ''; // Autofilled - if (!empty($conf->multicurrency->enabled)) print ''; + print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''; + print ''; // Autofilled + if (!empty($conf->multicurrency->enabled)) print ''; print "\n"; } print "\n"; @@ -874,30 +874,30 @@ if (empty($action)) // Lines for filters fields print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_comptes($search_account, 'search_account', 0, '', 1); print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -905,12 +905,12 @@ if (empty($action)) print ''; print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], 'p.rowid', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], 'dp', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], 'dp', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right '); //print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -927,7 +927,7 @@ if (empty($action)) // Date $dateformatforpayment = 'day'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; - print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."\n"; + print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."\n"; // Thirdparty print ''; @@ -947,7 +947,7 @@ if (empty($action)) else print ' '; print ''; - print ''.price($objp->pamount).''; + print ''.price($objp->pamount).''; // Ref invoice /*$invoicesupplierstatic->ref=$objp->ref_supplier; diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index bb6297f32d3..26e0884bdd6 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -143,8 +143,8 @@ if ($year) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if (is_resource($handle)) @@ -156,8 +156,8 @@ if ($year) $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; print ''.''; - print ''; - print ''; + print ''; + print ''; } } closedir($handle); diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 48efee3ddf3..745dd231bd0 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -51,8 +51,8 @@ foreach($linkedObjectBlock as $key => $objectlink) - - + - - + + 1) - - - - - + + + + + '; - print ''; + print ''; print "\n"; while ($i < $num) @@ -80,8 +80,8 @@ if ($resql) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; $i++; @@ -139,14 +139,14 @@ if (! empty($conf->fournisseur->enabled)) $companystatic->client=0; print $companystatic->getNomUrl(1, '', 16); print ''; - print ''; + print ''; $i++; $total += $obj->total_ttc; } if ($total>0) { - print '"; + print '"; } print "
'.$langs->trans("Reporting").''.$langs->trans("Size").''.$langs->trans("Date").''.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
'.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
trans("SupplierInvoice"); ?> trans("ShowBill"), "bill").' '.$objectlink->ref; ?> ref_supplier; ?>date, 'day'); ?>date, 'day'); ?>rights->fournisseur->facture->lire) { $sign = 1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1; @@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
trans("Total"); ?>
'.$langs->trans("Orders").''.$langs->trans("Nb").' 
'.$langs->trans("Orders").''.$langs->trans("Nb").' 
'.$commandestatic->LibStatut($row[1]).''.$row[0].''.$commandestatic->LibStatut($row[1], 3).''.$row[0].''.$commandestatic->LibStatut($row[1], 3).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
"; print "
\n"; @@ -197,14 +197,14 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $companystatic->client=0; print $companystatic->getNomUrl(1, '', 16); print ''; - print ''.price($obj->total_ttc).''; + print ''.price($obj->total_ttc).''; print ''; $tot_ttc+=$obj->total_ttc; $i++; } print ''.$langs->trans("Total").''; - print ''.price($tot_ttc).''; + print ''.price($tot_ttc).''; print ''; print ""; @@ -250,7 +250,7 @@ if ($resql) print ''; print ''; print '\n"; - print '\n"; + print '\n"; print "\n"; while ($obj = $db->fetch_object($resql) ) @@ -259,7 +259,7 @@ if ($resql) print '\n"; print ''; - print ''; + print ''; print "\n"; } print "
'.$langs->trans("BoxTitleLastSuppliers", min($max, $num))."'.$langs->trans("DateModification")."'.$langs->trans("DateModification")."
'.img_object($langs->trans("ShowSupplier"), "company").''; print " socid."\">".$obj->name."'.$obj->code_fournisseur.' '.dol_print_date($db->jdate($obj->tms), 'day').''.dol_print_date($db->jdate($obj->tms), 'day').'
\n"; @@ -298,7 +298,7 @@ if (count($companystatic->SupplierCategories)) print ''."\n"; // TODO this page not exist /* - print ''; + print ''; print '('.$langs->trans("Stats").')'; print "\n"; */ diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 254bc97c28f..864e590dedb 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -243,7 +243,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -255,9 +255,9 @@ if ($resql) print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "ppf.ref_fourn", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Supplier", $_SERVER["PHP_SELF"], "ppf.fk_soc", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "ppf.price", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "ppf.price", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"]); print "\n"; @@ -287,13 +287,13 @@ if ($resql) if ($companystatic->id > 0) print $companystatic->getNomUrl(1, 'supplier'); print ''; - print ''.(isset($objp->price) ? price($objp->price) : '').''; + print ''.(isset($objp->price) ? price($objp->price) : '').''; - print ''.$objp->qty.''; + print ''.$objp->qty.''; - print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; + print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; - print ''; + print ''; print "\n"; $i++; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 1d9fdf1721f..f5d862f48e5 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -87,12 +87,12 @@ if ($socid > 0) $num = $db->num_rows($resql); print ''; - print ''.$langs->trans("Date").''; + print ''.$langs->trans("Date").''; print ' '; print ''.$langs->trans("Status").''; - print ''.$langs->trans("Debit").''; - print ''.$langs->trans("Credit").''; - print ''.$langs->trans("Balance").''; + print ''.$langs->trans("Debit").''; + print ''.$langs->trans("Credit").''; + print ''.$langs->trans("Balance").''; print ' '; print ''; @@ -119,15 +119,15 @@ if ($socid > 0) print ''; - print "".dol_print_date($fac->date)."\n"; + print "".dol_print_date($fac->date)."\n"; print "id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref."\n"; - print ''.$fac->getLibStatut(2, $totalpaye).''; - print ''.price($fac->total_ttc)."\n"; + print ''.$fac->getLibStatut(2, $totalpaye).''; + print ''.price($fac->total_ttc)."\n"; $solde = $solde + $fac->total_ttc; - print ' '; - print ''.price($solde)."\n"; + print ' '; + print ''.price($solde)."\n"; // Author print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objf->login.''; @@ -154,15 +154,15 @@ if ($socid > 0) $objp = $db->fetch_object($resqlp); // print ''; - print ''.dol_print_date($db->jdate($objp->dp))."\n"; + print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''; print '      '; // Decalage print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$langs->trans("Payment").' '.$objp->rowid.''; print " \n"; print " \n"; - print ''.price($objp->amount).''; + print ''.price($objp->amount).''; $solde = $solde - $objp->amount; - print ''.price($solde)."\n"; + print ''.price($solde)."\n"; // Auteur print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objp->login.''; diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 7e802762a09..ff344c45809 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +117,7 @@ if (GETPOST('delete', 'alpha')) if ($result3) $result4=dolibarr_del_const($db, "FTP_PASSWORD_" . $entry, $conf->entity); if ($result4) $result5=dolibarr_del_const($db, "FTP_NAME_" . $entry, $conf->entity); if ($result4) $result6=dolibarr_del_const($db, "FTP_PASSIVE_" . $entry, $conf->entity); - + if ($result1 && $result2 && $result3 && $result4 && $result5 && $result6) { $db->commit(); @@ -199,9 +199,9 @@ else print ''.$form->selectyesno('FTP_PASSIVE_'.($lastftpentry+1), $defaultpassive, 2).''; print ''.$langs->trans("No").''; print ''; - + print ''; - + ?>
">
@@ -236,7 +236,7 @@ else print "
"; print ''; print ''; - + print ''."\n"; print ''; @@ -250,44 +250,44 @@ else $keyforuser="FTP_USER_" . $idrss; $keyforpassword="FTP_PASSWORD_" . $idrss; $keyforpassive="FTP_PASSIVE_" . $idrss; - + print ''; print ""; print ""; print ""; - + print ''; print ""; print ""; print ""; - + print ''; print ""; print ""; print ""; - + print ''; print ""; print ""; print ""; - + print ''; print ""; print ""; print ""; - + print ''; print ""; print ''; print ""; print ""; - print ""; print '
".$langs->trans("Name")."global->$keyforname . "\" size=\"64\">
".$langs->trans("Server")."global->$keyforserver . "\" size=\"64\">
".$langs->trans("Port")."global->$keyforport . "\" size=\"64\">
".$langs->trans("User")."global->$keyforuser . "\" size=\"24\">
".$langs->trans("Password")."global->$keyforpassword . "\" size=\"24\">
".$langs->trans("FTPPassiveMode")."'.$form->selectyesno('FTP_PASSIVE_'.$idrss, $conf->global->$keyforpassive, 1).'
"; + print ""; print "trans("Modify")."\">"; print "   "; print "trans("Delete")."\">"; @@ -295,10 +295,10 @@ else print "
'; - + print "
"; print '
'; - + $i++; } } diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index a543066a670..07af448aedd 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -1,6 +1,7 @@ - * Copyright (C) 2008-2009 Regis Houssin +/* Copyright (C) 2008-2016 Laurent Destailleur + * Copyright (C) 2008-2009 Regis Houssin + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,9 +18,9 @@ */ /** - * \file htdocs/ftp/index.php - * \ingroup ftp - * \brief Main page for FTP section area + * \file htdocs/ftp/index.php + * \ingroup ftp + * \brief Main page for FTP section area */ require '../main.inc.php'; @@ -453,13 +454,13 @@ else print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; @@ -558,28 +559,28 @@ else if ($is_directory) print ''; print ''; // Size - print ''; // Date - print ''; // User - print ''; // Group - print ''; // Permissions - print ''; // Action - print ''; // Action column - print ''; @@ -286,7 +286,7 @@ else foreach($typeleaves as $key => $val) { $labeltype = ($langs->trans($val['code'])!=$val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']); - print_liste_field_titre($labeltype, $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); + print_liste_field_titre($labeltype, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'center '); } } else diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 452762f6e65..2a77c9e1068 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -374,7 +374,7 @@ print ''; +print ''; @@ -394,14 +394,14 @@ if ($id && ! GETPOSTISSET('search_employee')) if (! empty($user->rights->holiday->read_all)) // Can see all { if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee', 'int'); - print ''; } else { if (GETPOSTISSET('search_employee')) $search_employee=GETPOST('search_employee', 'int'); - print ''; } @@ -409,7 +409,7 @@ else // Approve if ($user->rights->holiday->read_all) { - print ''; print ''; // Start date -print ''; // End date -print ''; // Status -print ''; // Actions -print ''; @@ -471,32 +471,31 @@ print "\n"; print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); -print_liste_field_titre("DateCreateCP", $_SERVER["PHP_SELF"], "cp.date_create", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("DateCreateCP", $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ValidatorCP", $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre("NbUseDaysCPShort", $_SERVER["PHP_SELF"], '', '', $pram, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre("DateDebCP", $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("DateFinCP", $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, 'align="right"', $sortfield, $sortorder); -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print_liste_field_titre("NbUseDaysCPShort", $_SERVER["PHP_SELF"], '', '', $pram, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("DateDebCP", $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateFinCP", $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print "\n"; $listhalfday=array('morning'=>$langs->trans("Morning"),"afternoon"=>$langs->trans("Afternoon")); // If we ask a dedicated card and not allow to see it, we forc on user. -if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids)) -{ +if ($id && empty($user->rights->holiday->read_all) && ! in_array($id, $childids)) { $langs->load("errors"); print ''; $result = 0; } -// Lines elseif (! empty($holiday->holiday) && !empty($mysoc->country_id)) { - $userstatic = new User($db); - $approbatorstatic = new User($db); + // Lines + $userstatic = new User($db); + $approbatorstatic = new User($db); $typeleaves=$holiday->getTypes(1, -1); @@ -538,22 +537,22 @@ elseif (! empty($holiday->holiday) && !empty($mysoc->country_id)) $labeltypeleavetoshow = ($langs->trans($typeleaves[$infos_CP['fk_type']]['code'])!=$typeleaves[$infos_CP['fk_type']]['code'] ? $langs->trans($typeleaves[$infos_CP['fk_type']]['code']) : $typeleaves[$infos_CP['fk_type']]['label']); print empty($typeleaves[$infos_CP['fk_type']]['label']) ? $langs->trans("TypeWasDisabledOrRemoved", $infos_CP['fk_type']) : $labeltypeleavetoshow; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; // Action column - print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; print ''; @@ -173,20 +173,20 @@ else print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; - print ''; - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index d64d85813e6..f27f1a5f10b 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -193,7 +193,7 @@ print ''; print ''; print ''; // Action column -print ''; @@ -201,15 +201,15 @@ print ''; print ''; print_liste_field_titre('ID'); -print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', '', '', 'align="center"'); +print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'center '); print_liste_field_titre('ActionByCP'); print_liste_field_titre('UserUpdateCP'); print_liste_field_titre('Description'); print_liste_field_titre('Type'); -print_liste_field_titre('PrevSoldeCP', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); -print_liste_field_titre('Variation', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); -print_liste_field_titre('NewSoldeCP', $_SERVER["PHP_SELF"], '', '', '', 'align="right"'); -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print_liste_field_titre('PrevSoldeCP', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right '); +print_liste_field_titre('Variation', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right '); +print_liste_field_titre('NewSoldeCP', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right '); +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print ''; diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 1985926563b..5e6413abb45 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -95,7 +95,7 @@ if ($result) print_liste_field_titre("Address", $_SERVER["PHP_SELF"], "e.address", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Zipcode", $_SERVER["PHP_SELF"], "e.zip", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Town", $_SERVER["PHP_SELF"], "e.town", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.status", "", "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.status", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; if ($num > 0) @@ -117,7 +117,7 @@ if ($result) print ''; print ''; - print ''; print "\n"; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 6aa17362894..3751935b81c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -198,7 +198,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; if ($num) @@ -228,7 +228,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) print ''; + print ''; print ''; print ''; @@ -271,8 +271,8 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) print '
'.$langs->trans("Content").''.$langs->trans("Size").''.$langs->trans("Date").''.$langs->trans("Owner").''.$langs->trans("Group").''.$langs->trans("Permissions").''; + print ''.$langs->trans("Content").''.$langs->trans("Size").''.$langs->trans("Date").''.$langs->trans("Owner").''.$langs->trans("Group").''.$langs->trans("Permissions").''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").' '; print ''.img_picto($langs->trans("Refresh"), 'refresh').' '; print ''; + print ''; if (! $is_directory && ! $is_link) print $vals[4]; else print ' '; print ''; + print ''; print $vals[5].' '.$vals[6].' '.$vals[7]; print ''; + print ''; print $vals[2]; print ''; + print ''; print $vals[3]; print ''; + print ''; print $vals[0]; print ''; + print ''; if ($is_directory) { if ($file != '..') print ''.img_delete().''; @@ -628,7 +629,7 @@ else */ print '
'; - print '
'; + print '
'; print ''; print '
'; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index e3b31ec7726..9bc181f66d9 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1326,7 +1326,7 @@ else if ($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) { - print '
'; + print '
'; if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { print ''; diff --git a/htdocs/holiday/common.inc.php b/htdocs/holiday/common.inc.php index 45a95bcbada..cc213007fc0 100644 --- a/htdocs/holiday/common.inc.php +++ b/htdocs/holiday/common.inc.php @@ -23,7 +23,7 @@ * \brief Common load of data */ -require_once realpath(dirname(__FILE__)).'/../main.inc.php'; +require_once realpath(__DIR__).'/../main.inc.php'; if (! class_exists('Holiday')) { require_once DOL_DOCUMENT_ROOT. '/holiday/class/holiday.class.php'; } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 82b44dd9bca..1404391f521 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -271,7 +271,7 @@ else print '
'; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; print ''; $formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0); print ''; + print ''; print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200'); print ''; + print ''; print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth200'); print ''; + print ''; $validator = new UserGroup($db); $excludefilter=$user->admin?'':'u.rowid <> '.$user->id; @@ -445,24 +445,24 @@ print ' '; +print ''; print ''; $formother->select_year($search_year_start, 'search_year_start', 1, $min_year, $max_year); print ''; +print ''; print ''; $formother->select_year($search_year_end, 'search_year_end', 1, $min_year, $max_year); print ''; +print ''; $holiday->selectStatutCP($search_statut, 'search_statut'); print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("NotEnoughPermissions").'
'; + print ''; $nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']); print $nbopenedday.' '.$langs->trans('DurationDays'); print ''; + print ''; print dol_print_date($infos_CP['date_debut'], 'day'); print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; print ''; + print ''; print dol_print_date($infos_CP['date_fin'], 'day'); print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; print ''.$holidaystatic->LibStatut($infos_CP['statut'], 5).''.$holidaystatic->LibStatut($infos_CP['statut'], 5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 4cfa375fe76..98db1318aa7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -1,7 +1,7 @@ - * Copyright (C) 2011 François Legastelois - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2007-2010 Laurent Destailleur + * Copyright (C) 2011 François Legastelois + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -110,12 +110,12 @@ print '
' . $langs->trans('Ref') . '' . $langs->trans('Employee') . '' . $langs->trans('Type') . '' . $langs->trans('DateDebCP') . '' . $langs->trans('DateFinCP') . '' . $langs->trans('NbUseDaysCPShort') . '' . $langs->trans('DateStartInMonth') . '' . $langs->trans('DateEndInMonth') . '' . $langs->trans('NbUseDaysCPShortInMonth') . '' . $langs->trans('DateDebCP') . '' . $langs->trans('DateFinCP') . '' . $langs->trans('NbUseDaysCPShort') . '' . $langs->trans('DateStartInMonth') . '' . $langs->trans('DateEndInMonth') . '' . $langs->trans('NbUseDaysCPShortInMonth') . '' . $langs->trans('DescCP') . '
' . $user->getFullName($langs) . '' . $obj->label . '' . dol_print_date($obj->date_debut, 'day'); + print '' . dol_print_date($obj->date_debut, 'day'); print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; print '' . dol_print_date($obj->date_fin, 'day'); + print '' . dol_print_date($obj->date_fin, 'day'); print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; print '' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '' . dol_print_date($date_start_inmonth, 'day'); + print '' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '' . dol_print_date($date_start_inmonth, 'day'); print ' ('.$langs->trans($listhalfday[$starthalfdayinmonth]).')'; print '' . dol_print_date($date_end_inmonth, 'day'); + print '' . dol_print_date($date_end_inmonth, 'day'); print ' ('.$langs->trans($listhalfday[$endhalfdayinmonth]).')'; print '' . num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth) . '' . num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth) . '' . dol_escape_htmltag(dolGetFirstLineOfText($obj->description)) . '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'.$obj->zip.''.$obj->town.''; + print ''; print $establishmentstatic->getLibStatut(5); print '
'.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).''.$langs->trans("from").''.$langs->trans("to").''.$langs->trans("DateModificationShort").''.$langs->trans("DateModificationShort").' 
'.dol_print_date($obj->date_start, 'day').' '.$langs->trans($listhalfday[$starthalfday]); print ''.dol_print_date($obj->date_end, 'day').' '.$langs->trans($listhalfday[$endhalfday]); - print ''.dol_print_date($db->jdate($obj->dm), 'day').''.dol_print_date($db->jdate($obj->dm), 'day').''.$holidaystatic->LibStatut($obj->status, 3).'
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; if ($num) @@ -299,8 +299,8 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -343,8 +343,8 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire print '
'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$deplacementstatic->LibStatut($obj->fk_statut, 3).'
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; if ($num) @@ -371,8 +371,8 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; diff --git a/htdocs/ifttt/admin/index.php b/htdocs/ifttt/admin/index.php index d6eb777109b..de3abbe3c2a 100644 --- a/htdocs/ifttt/admin/index.php +++ b/htdocs/ifttt/admin/index.php @@ -72,7 +72,7 @@ print '
'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''.$langs->trans("TotalTTC").''.$langs->trans("DateModificationShort").''.$langs->trans("TotalTTC").''.$langs->trans("DateModificationShort").' 
'.$expensereportstatic->getNomUrl(1).''.$userstatic->getNomUrl(-1).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->dm), 'day').''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->dm), 'day').''.$expensereportstatic->LibStatut($obj->status, 3).'
'; print ''; print ""; -print '"; +print '"; print ""; print ""; @@ -81,13 +81,13 @@ print ''; $production_mode=(empty($conf->global->IFTTT_PRODUCTION_MODE)?false:true); if ($production_mode) { - print ''; } else { - print ''; } diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index fe7cdb9faf6..4b6a511d0e5 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -58,6 +58,8 @@ CREATE TABLE llx_pos_cash_fence( -- For 10.0 +DROP TABLE llx_cotisation; + ALTER TABLE llx_loan ADD COLUMN insurance_amount double(24,8) DEFAULT 0; ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber; @@ -175,7 +177,8 @@ ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp; CREATE TABLE llx_bom_bom( -- BEGIN MODULEBUILDER FIELDS - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + entity integer DEFAULT 1 NOT NULL, ref varchar(128) NOT NULL, label varchar(255), description text, @@ -229,3 +232,16 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); + +ALTER TABLE llx_facturedet_rec ADD COLUMN buy_price_ht double(24,8) DEFAULT 0; +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer DEFAULT NULL; + +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer; +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer; + +ALTER TABLE llx_expensereport_det MODIFY COLUMN value_unit double(24,8) NOT NULL; +ALTER TABLE llx_expensereport_det ADD COLUMN subprice double(24,8) DEFAULT 0 NOT NULL after qty; + +ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_parent (fk_product_parent); +ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_child (fk_product_child); + diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index bb8da0726bf..2bca889c970 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -16,7 +16,8 @@ CREATE TABLE llx_bom_bom( -- BEGIN MODULEBUILDER FIELDS - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + entity integer DEFAULT 1 NOT NULL, ref varchar(128) NOT NULL, label varchar(255), description text, diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index fc0bd6e697f..59bfd60b0ca 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -27,7 +27,8 @@ CREATE TABLE llx_expensereport_det comments text NOT NULL, product_type integer DEFAULT -1, qty real NOT NULL, - value_unit real NOT NULL, + subprice double(24,8) DEFAULT 0 NOT NULL, -- P.U. HT (example 100) + value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120) remise_percent real, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. tva_tx double(6,3), -- Vat rate diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index ac7142c898d..deb52576a8a 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -55,16 +55,16 @@ create table llx_facturedet buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) - fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line - special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...) rang integer DEFAULT 0, -- position of line fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines + fk_unit integer DEFAULT NULL, -- id of the unit code import_key varchar(14), + fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line + situation_percent real, -- % progression of lines invoicing - fk_prev_id integer, -- id of the line in the previous situation, - fk_unit integer DEFAULT NULL, -- id of the unit code¡ + fk_prev_id integer, -- id of the line in the previous situation fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec.sql b/htdocs/install/mysql/tables/llx_facturedet_rec.sql index ac79dfd891d..267abcd5053 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_rec.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_rec.sql @@ -48,11 +48,18 @@ create table llx_facturedet_rec date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__ date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__ info_bits integer DEFAULT 0, -- TVA NPR ou non + + buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). + fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) + special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales rang integer DEFAULT 0, -- ordre d'affichage fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines fk_unit integer DEFAULT NULL, import_key varchar(14), + + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change fk_multicurrency integer, multicurrency_code varchar(255), diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination.key.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination.key.sql new file mode 100644 index 00000000000..770429d0524 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination.key.sql @@ -0,0 +1,20 @@ +-- ============================================================================ +-- Copyright (C) 2019 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_parent (fk_product_parent); +ALTER TABLE llx_product_attribute_combination ADD INDEX idx_product_att_com_product_child (fk_product_child); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 274efc04eb1..6a821d8dbaf 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -88,7 +88,7 @@ if (! $versionfrom && ! $versionto) // Test if batch mode $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); - $path=dirname(__FILE__).'/'; + $path=__DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n"; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 2fa5fad38ac..45b5f8fe95c 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -96,7 +96,7 @@ if ((! $versionfrom || preg_match('/version/', $versionfrom)) && (! $versionto | // Test if batch mode $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); - $path=dirname(__FILE__).'/'; + $path=__DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; @@ -186,7 +186,7 @@ if (! GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'a { // Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE // Version to install is DOL_VERSION - $dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:$conf->global->MAIN_VERSION_LAST_INSTALL); + $dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:(isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:'')); // Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec // dans la 1ere colonne, la description de l'action a faire diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 477f611bf39..6b3568bea31 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1857,4 +1857,5 @@ DisableProspectCustomerType=Disable the "Prospect + Customer" third party type ( MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links. ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s' -DefaultCustomerType=Default thirdparty type for "New customer" creation form \ No newline at end of file +DefaultCustomerType=Default thirdparty type for "New customer" creation form +ABankAccountMustBeDefinedOnPaymentModeSetup=Note: The bank account must be defined on the module of each payment mode (Paypal, Stripe, ...) to have this feature working. diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 6cc85024843..cff8f7d657b 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -14,9 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev AddedByAuthority=Stored into remote authority NotAddedByAuthorityYet=Not yet stored into remote authority ShowDetails=Show stored details -logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created -logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified -logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion +logPAYMENT_VARIOUS_CREATE=Payment (not assigned to an invoice) created +logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to an invoice) modified +logPAYMENT_VARIOUS_DELETE=Payment (not assigned to an invoice) logical deletion logPAYMENT_ADD_TO_BANK=Payment added to bank logPAYMENT_CUSTOMER_CREATE=Customer payment created logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 0ca2382d214..83939e94187 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -54,4 +54,5 @@ Paymentnumpad=Payment Num Pad Numberspad=Numbers Pad BillsCoinsPad=Bills and Coins Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr -TakeposNeedsCategories=TakePOS needs product categories to work \ No newline at end of file +TakeposNeedsCategories=TakePOS needs product categories to work +OrderNotes=Order Notes \ No newline at end of file diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 765edad6687..a8af38d5240 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -2,7 +2,7 @@ ModuleBuilderDesc=This tool must be used by only by experienced users or developers. It gives you utilities to build or edit your own module.
Documentation for alternative manual development is here. EnterNameOfModuleDesc=Enter name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...) EnterNameOfObjectDesc=Enter name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated. -ModuleBuilderDesc2=Path where modules are generated/edited (first alternative directory defined into %s): %s +ModuleBuilderDesc2=Path where modules are generated/edited (first directory for external modules defined into %s): %s ModuleBuilderDesc3=Generated/editable modules found: %s ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory NewModule=New module @@ -100,4 +100,8 @@ UseAboutPage=Disable the about page UseDocFolder=Disable the documentation folder UseSpecificReadme=Use a specific ReadMe RealPathOfModule=Real path of module -ContentCantBeEmpty=Content of file can't be empty \ No newline at end of file +ContentCantBeEmpty=Content of file can't be empty +WidgetDesc=You can generate and edit here the widgets that will be embedded with your module. +CLIDesc=You can generate here some command line scripts you want to provide with your module. +CLIFile=CLI File +NoCLIFile=No CLI files \ No newline at end of file diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang new file mode 100644 index 00000000000..68e84aee8e3 --- /dev/null +++ b/htdocs/langs/en_US/mrp.lang @@ -0,0 +1,8 @@ +BOMsSetup=Setup of module BOM +ListOfBOMs=List of BOMs +NewBOM=New BOM +ProductBOMHelp=Product to create with this BOM +BOMsNumberingModules=BOMs numbering templates +BOMsModelModule=BOMS document templates +FreeLegalTextOnBOMs=Free text on document of BOMs +WatermarkOnDraftBOMs=Watermark on draft BOMs diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index bf1d6ae5812..401ccc5462e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -338,3 +338,4 @@ CloneDestinationReference=Destination product reference ErrorCopyProductCombinations=There was an error while copying the product variants ErrorDestinationProductNotFound=Destination product not found ErrorProductCombinationNotFound=Product variant not found +ActionAvailableOnVariantProductOnly=Action only available on the variant of product \ No newline at end of file diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 6366e93e375..3759a9c881b 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -87,14 +87,14 @@ TicketEmailNotificationFrom=Notification email from TicketEmailNotificationFromHelp=Used into ticket message answer by example TicketEmailNotificationTo=Notifications email to TicketEmailNotificationToHelp=Send email notifications to this address. -TicketNewEmailBodyLabel=Text message sent after creating a ticket (public interface) +TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup TicketsEmailMustExist=Require an existing email address to create a ticket TicketsEmailMustExistHelp=In the public interface, the email address should already be filled in the database to create a new ticket. PublicInterface=Public interface -TicketUrlPublicInterfaceLabelAdmin=Public interface URL -TicketUrlPublicInterfaceHelpAdmin=It is possible to define an alias to the web server and thus make available the public interface to another IP address. +TicketUrlPublicInterfaceLabelAdmin=Alternative URL for public interface +TicketUrlPublicInterfaceHelpAdmin=It is possible to define an alias to the web server and thus make available the public interface with another URL (the server must act as a proxy on this new URL) TicketPublicInterfaceTextHomeLabelAdmin=Welcome text of the public interface TicketPublicInterfaceTextHome=You can create a support ticket or view existing from its identifier tracking ticket. TicketPublicInterfaceTextHomeHelpAdmin=The text defined here will appear on the home page of the public interface. @@ -124,7 +124,7 @@ TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automaticall TicketNumberingModules=Tickets numbering module TicketNotifyTiersAtCreation=Notify third party at creation TicketGroup=Group - +TicketsDisableCustomerEmail=Alsways disable emails when a ticket is created from public interface # # Index & list page # @@ -154,7 +154,6 @@ TicketMarkedAsRead=Ticket has been marked as read TicketReadOn=Read on TicketCloseOn=Clotured on MarkAsRead=Mark ticket as read -TicketMarkedAsReadButLogActionNotSaved=Ticket marked as closed but no action saved TicketHistory=Ticket history AssignUser=Assign to user TicketAssigned=Ticket is now assigned @@ -179,7 +178,6 @@ ConfirmCloseAticket=Confirm ticket closing ConfirmDeleteTicket=Please confirm ticket deleting TicketDeletedSuccess=Ticket deleted with success TicketMarkedAsClosed=Ticket marked as closed -TicketMarkedAsClosedButLogActionNotSaved=Ticket marked as closed but no log saved ! TicketDurationAuto=Calculated duration TicketDurationAutoInfos=Duration calculated automatically from intervention related TicketUpdated=Ticket updated @@ -226,14 +224,12 @@ Unread=Unread # # Logs # -TicketLogMesgReadBy=Ticket read by %s +TicketLogMesgReadBy=Ticket %s read by %s NoLogForThisTicket=No log for this ticket yet -TicketLogAssignedTo=Ticket assigned to %s -TicketAssignedButLogActionNotSaved=Ticket assigned but no log saved ! -TicketLogPropertyChanged=Change classification: from %s to %s -TicketLogClosedBy=Ticket closed by %s -TicketLogProgressSetTo=Progress change to %s percent -TicketLogReopen=Ticket re-opened +TicketLogAssignedTo=Ticket %s assigned to %s +TicketLogPropertyChanged=Ticket %s modified: classification from %s to %s +TicketLogClosedBy=Ticket %s closed by %s +TicketLogReopen=Ticket %s re-opened # # Public pages @@ -267,7 +263,7 @@ ErrorEmailMustExistToCreateTicket=Error: email address not found in our database TicketNewEmailSubjectAdmin=New ticket created TicketNewEmailBodyAdmin=

Ticket has just been created with ID #%s, see information:

SeeThisTicketIntomanagementInterface=See ticket in management interface -TicketPublicInterfaceForbidden=Access for this area: forbidden +TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled # notifications TicketNotificationEmailSubject=Ticket %s updated diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index 2ede3bc474e..3072dae1df6 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -73,23 +73,19 @@ EX_PAR_VP=Parking PV EX_CAM_VP=PV maintenance and repair DefaultCategoryCar=Default transportation mode DefaultRangeNumber=Default range number - +UploadANewFileNow=Upload a new document now Error_EXPENSEREPORT_ADDON_NotDefined=Error, the rule for expense report numbering ref was not defined into setup of module 'Expense Report' ErrorDoubleDeclaration=You have declared another expense report into a similar date range. AucuneLigne=There is no expense report declared yet - ModePaiement=Payment mode - VALIDATOR=User responsible for approval VALIDOR=Approved by AUTHOR=Recorded by AUTHORPAIEMENT=Paid by REFUSEUR=Denied by CANCEL_USER=Deleted by - MOTIF_REFUS=Reason MOTIF_CANCEL=Reason - DATE_REFUS=Deny date DATE_SAVE=Validation date DATE_CANCEL=Cancelation date @@ -140,7 +136,6 @@ OnExpense=Expense line ExpenseReportRuleSave=Expense report rule saved ExpenseReportRuleErrorOnSave=Error: %s RangeNum=Range %d - ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s byEX_DAY=by day (limitation to %s) byEX_MON=by month (limitation to %s) @@ -151,7 +146,6 @@ nolimitbyEX_DAY=by day (no limitation) nolimitbyEX_MON=by month (no limitation) nolimitbyEX_YEA=by year (no limitation) nolimitbyEX_EXP=by line (no limitation) - CarCategory=Category of car ExpenseRangeOffset=Offset amount: %s RangeIk=Mileage range diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 53ac720d862..fb35cb5e112 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,4 +109,4 @@ UserLogoff=User logout UserLogged=User logged DateEmployment=Employment Start Date DateEmploymentEnd=Employment End Date -CantDisableYourself=You can disable your own user record \ No newline at end of file +CantDisableYourself=You can't disable your own user record \ No newline at end of file diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index eb9d9e14641..a8a4469fb3c 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -95,3 +95,4 @@ InternalURLOfPage=Internal URL of page ThisPageIsTranslationOf=This page/container is a translation of ThisPageHasTranslationPages=This page/container has translation NoWebSiteCreateOneFirst=No website has been created yet. Create one first. +GoTo=Go to \ No newline at end of file diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 49055b31290..8f590c63798 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -459,7 +459,7 @@ else // Client print '
'; - print ''; + print ''; print ""; */ @@ -496,7 +496,7 @@ else print $langs->trans('DateReceived'); print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
".$langs->trans("Parameter")."'.$langs->trans("Value")."'.$langs->trans("Value")." 
'.$langs->trans("ProductionMode").''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
'.$langs->trans("Customer").''.$soc->getNomUrl(1).''.$soc->getNomUrl(1).'
id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print ''; if ($action == 'editdate_livraison') @@ -521,7 +521,7 @@ else print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->expedition->livraison->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -598,8 +598,8 @@ else print ''; print ''.$langs->trans("Products").''; - print ''.$langs->trans("QtyOrdered").''; - print ''.$langs->trans("QtyReceived").''; + print ''.$langs->trans("QtyOrdered").''; + print ''.$langs->trans("QtyReceived").''; print "\n"; } while ($i < $num_prod) @@ -662,8 +662,8 @@ else print "\n"; } - print ''.$object->lines[$i]->qty_asked.''; - print ''.$object->lines[$i]->qty_shipped.''; + print ''.$object->lines[$i]->qty_asked.''; + print ''.$object->lines[$i]->qty_shipped.''; print ""; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index c5d38d1148d..1c9d6f97a01 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -304,7 +304,7 @@ if ($action == 'create') // insurance amount print ''.$langs->trans("Insurance").''; - + // Project if (! empty($conf->projet->enabled)) { @@ -499,7 +499,7 @@ if ($id > 0) { print ''.$langs->trans("LoanCapital").''.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; } - + // Insurance if ($action == 'edit') { @@ -712,9 +712,9 @@ if ($id > 0) print ''.$langs->trans("RefPayment").''; print ''.$langs->trans("Date").''; print ''.$langs->trans("Type").''; - print ''.$langs->trans("Insurance").''; - print ''.$langs->trans("Interest").''; - print ''.$langs->trans("LoanCapital").''; + print ''.$langs->trans("Insurance").''; + print ''.$langs->trans("Interest").''; + print ''.$langs->trans("LoanCapital").''; print ''; while ($i < $num) @@ -725,9 +725,9 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp), 'day')."\n"; print "".$objp->paiement_type.' '.$objp->num_payment."\n"; - print ''.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; - print ''.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; - print ''.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; + print ''.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."\n"; print ""; $total_capital += $objp->amount_capital; $i++; @@ -737,13 +737,13 @@ if ($id > 0) if ($object->paid == 0) { - print ''.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).''; - print ''.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; + print ''.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).''; + print ''.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; $staytopay = $object->capital - $totalpaid; - print ''.$langs->trans("RemainderToPay").' :'; - print ''; + print ''.$langs->trans("RemainderToPay").' :'; + print ''; print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency); print ''; } diff --git a/htdocs/loan/createschedule.php b/htdocs/loan/createschedule.php index 76bbaef715c..4fe644e5521 100644 --- a/htdocs/loan/createschedule.php +++ b/htdocs/loan/createschedule.php @@ -77,7 +77,7 @@ if ($action == 'updateecheancier') { $int = GETPOST('hi_interets'.$i); $id = GETPOST('hi_rowid'.$i); $insurance = GETPOST('hi_insurance'.$i); - + $echeance = new LoanSchedule($db); $echeance->fetch($id); $echeance->tms = dol_now(); @@ -148,18 +148,18 @@ print ''; print ''; $colspan = 6; if (count($echeance->lines)>0) $colspan++; -print ''; print ''; print ''; -Print ''; -Print ''; -print ''; -Print ''; -Print ''; +print ''; +print ''; +print ''; +print ''; @@ -180,12 +180,12 @@ if ($object->nbterm > 0 && count($echeance->lines)==0) $int = price2num($int, 'MT'); $cap_rest = price2num($capital - ($mens-$int), 'MT'); print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''."\n"; $i++; $capital = $cap_rest; @@ -203,18 +203,18 @@ elseif(count($echeance->lines)>0) $int = $line->amount_interest; $cap_rest = price2num($capital - ($mens-$int), 'MT'); print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if($line->datep > dol_now()){ - print ''; + print ''; }else{ - print ''; + print ''; } - - print ''; - print ''; + + print ''; + print ''; print ''."\n"; $i++; $capital = $cap_rest; @@ -224,7 +224,7 @@ elseif(count($echeance->lines)>0) print '
'; +print ''; print $langs->trans("FinancialCommitment"); print '
'.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); -Print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("CapitalRemain"); +print ''.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); +print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("CapitalRemain"); print ' ('.price2num($object->capital).')'; print ''; print '
' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'), 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €'.price($cap_rest).' €' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'), 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €'.price($cap_rest).' €
' . $i .'' . dol_print_date($line->datep, 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €' . $i .'' . dol_print_date($line->datep, 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €' . price($mens) . ' €' . price($mens) . ' €'.price($cap_rest).' €'.$langs->trans('DoPayment').''.price($cap_rest).' €'.$langs->trans('DoPayment').'
'; print '
'; print '
'; -print '
'; +print '
'; print ''; // End of page diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index be3de3a81d1..2fb58d6132c 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -139,11 +139,11 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ' '; print ' '; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -151,11 +151,11 @@ if ($resql) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "l.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("LoanCapital", $_SERVER["PHP_SELF"], "l.capital", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("LoanCapital", $_SERVER["PHP_SELF"], "l.capital", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -175,15 +175,15 @@ if ($resql) print ''.dol_trunc($obj->label, 42).''; // Capital - print ''.price($obj->capital).''; + print ''.price($obj->capital).''; // Date start - print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; + print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; // Date end - print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; + print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; - print ''.$loan_static->LibStatut($obj->paid, 5, $obj->alreadypayed).''; + print ''.$loan_static->LibStatut($obj->paid, 5, $obj->alreadypayed).''; print ''; diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 23251c21375..2a5d8c73e76 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -56,7 +56,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->del $sql = "UPDATE ".MAIN_DB_PREFIX."loan_schedule SET fk_bank = 0 WHERE fk_bank = ".$payment->fk_bank; $db->query($sql); - + $result = $payment->delete($user); if ($result > 0) { @@ -214,9 +214,9 @@ if ($resql) print ''; print ''.$langs->trans('Loan').''; print ''.$langs->trans('Label').''; - // print ''.$langs->trans('ExpectedToPay').''; - print ''.$langs->trans('Status').''; - print ''.$langs->trans('PayedByThisPayment').''; + // print ''.$langs->trans('ExpectedToPay').''; + print ''.$langs->trans('Status').''; + print ''.$langs->trans('PayedByThisPayment').''; print "\n"; if ($num > 0) @@ -234,13 +234,13 @@ if ($resql) // Label print ''.$objp->label.''; // Expected to pay - // print ''.price($objp->capital).''; + // print ''.price($objp->capital).''; // Status - print ''.$loan->getLibStatut(4, $objp->amount_capital).''; + print ''.$loan->getLibStatut(4, $objp->amount_capital).''; // Amount payed $amount_payed = $objp->amount_capital + $objp->amount_insurance + $objp->amount_interest; - print ''.price($amount_payed).''; + print ''.price($amount_payed).''; print "\n"; if ($objp->paid == 1) // If at least one invoice is paid, disable delete { diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index db858c95ed8..2b50e27ad9b 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -279,30 +279,30 @@ if ($action == 'create') print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; print ''; if ($loan->datestart > 0) { - print ''; + print ''; } else { - print ''; + print ''; } - print '"; + print '"; - print '"; + print '"; - print '"; + print '"; - print '\n"; $cumul_achat = 0; @@ -204,17 +204,17 @@ if ($id > 0 || ! empty($ref)) print "\n"; print ''; print "\n"; - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; - print ''; + print "\n"; + print ''; print "\n"; $i++; $cumul_achat += $objp->buying_price; @@ -238,15 +238,15 @@ if ($id > 0 || ! empty($ref)) } print ''; print '"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print '\n"; + print '\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; - print ''; + print "\n"; + print ''; print "\n"; print "
'.$langs->trans("DateDue").''.$langs->trans("LoanCapital").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").''.$langs->trans("LoanCapital").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").'
'.dol_print_date($loan->datestart, 'day').''.dol_print_date($loan->datestart, 'day').'!!!!!!'.price($loan->capital)."'.price($loan->capital)."'.price($sumpaid)."'.price($sumpaid)."'.price($loan->capital - $sumpaid)."'.price($loan->capital - $sumpaid)."'; + print ''; if ($sumpaid < $loan->capital) { print $langs->trans("LoanCapital") .': '; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 2041445b24b..1c9cb9d8c3f 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -45,17 +45,17 @@ $head=loan_prepare_head($object); dol_fiche_head($head, 'FinancialCommitment', $langs->trans("Loan"), -1, 'bill'); if ($action == 'createecheancier') { - + $i=1; while($i <$object->nbterm+1){ - + $date = GETPOST('hi_date'.$i, 'int'); $mens = GETPOST('mens'.$i); $int = GETPOST('hi_interets'.$i); $insurance = GETPOST('hi_insurance'.$i); - + $echeance = new LoanSchedule($db); - + $echeance->fk_loan = $object->id; $echeance->datec = dol_now(); $echeance->tms = dol_now(); @@ -76,15 +76,15 @@ if ($action == 'createecheancier') { } if ($action == 'updateecheancier') { - + $i=1; while($i <$object->nbterm+1){ - + $mens = GETPOST('mens'.$i); $int = GETPOST('hi_interets'.$i); $id = GETPOST('hi_rowid'.$i); $insurance = GETPOST('hi_insurance'.$i); - + $echeance = new LoanSchedule($db); $echeance->fetch($id); $echeance->tms = dol_now(); @@ -154,18 +154,18 @@ print ''; print ''; $colspan = 6; if (count($echeance->lines)>0) $colspan++; -print ''; print ''; print ''; -Print ''; -Print ''; -print ''; -Print ''; -Print ''; +print ''; +print ''; +print ''; +print ''; @@ -187,12 +187,12 @@ if ($object->nbterm > 0 && count($echeance->lines)==0) $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); $cap_rest = price2num($capital - ($mens-$int), 'MT'); print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''."\n"; $i++; $capital = $cap_rest; @@ -211,20 +211,20 @@ elseif(count($echeance->lines)>0) $int = $line->amount_interest; $insu = ($insurance+(($i == 1) ? $regulInsurance : 0)); $cap_rest = price2num($capital - ($mens-$int), 'MT'); - + print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if($line->datep > dol_now() && empty($line->fk_bank)){ - print ''; + print ''; }else{ - print ''; + print ''; } - - print ''; - print ''; + print '\n"; - print ""; } else { @@ -302,13 +304,13 @@ if ($result) print "\n"; //print "\n"; } - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; $i++; @@ -330,13 +332,13 @@ if ($result) else print '"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; print "
'; +print ''; print $langs->trans("FinancialCommitment"); print '
'.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); -Print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("CapitalRemain"); +print ''.$langs->trans("Term").''.$langs->trans("Date").''.$langs->trans("Insurance"); +print ''.$langs->trans("InterestAmount").''.$langs->trans("Amount").''.$langs->trans("CapitalRemain"); print ' ('.price2num($object->capital).')'; print ''; print '
' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'), 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €'.price($cap_rest).' €' . $i .'' . dol_print_date(dol_time_plus_duree($object->datestart, $i-1, 'm'), 'day') . ''.price($insurance+(($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'.price($int, 0, '', 1).' €'.price($cap_rest).' €
' . $i .'' . dol_print_date($line->datep, 'day') . ''.price($insu, 0, '', 1).' €'.price($int, 0, '', 1).' €' . $i .'' . dol_print_date($line->datep, 'day') . ''.price($insu, 0, '', 1).' €'.price($int, 0, '', 1).' €' . price($mens) . ' €' . price($mens) . ' €'.price($cap_rest).' €'; + + print ''.price($cap_rest).' €'; if (!empty($line->fk_bank)) print $langs->trans('Paid'); elseif (!$printed) { @@ -243,7 +243,7 @@ print '
'; print '
'; if (count($echeance->lines)==0) $label = $langs->trans("Create"); else $label = $langs->trans("Save"); -print '
'; +print '
'; print ''; // End of page diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4f4dcd9a092..85827ed6ab5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -395,6 +395,7 @@ if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf-> { dol_syslog("Invalid token, so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. + if ($conf->global->MAIN_FEATURES_LEVEL>1) setEventMessages('Unset POST by CSRF protection in main.inc.php.', null, 'warnings'); unset($_POST); unset($_GET['confirm']); } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 6b1885270c4..c733ed09582 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -122,7 +122,7 @@ print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); print ''; print ''; print ''; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; @@ -162,7 +162,7 @@ print ''; // DISPLAY MARGIN RATES print ''; print ''; -print ''; // DISPLAY MARK RATES print ''; print ''; -print ''; print ''; print ''; -print '\n"; $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); @@ -289,13 +291,13 @@ if ($result) print ''; print "\n"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; } } diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index d418aba780e..a3b932e565c 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -183,6 +183,7 @@ dol_fiche_end(); $arrayfields=array(); $massactionbutton=''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); $sql = "SELECT"; $sql .= " f.ref, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty"; @@ -190,7 +191,7 @@ $sql .= " ,d.fk_product"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid"; -$sql .= " WHERE f.fk_statut > 0"; +$sql .= " WHERE f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql .= " AND f.entity IN (" . getEntity('invoice') . ") "; if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'"; if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'"; @@ -286,16 +287,16 @@ if ($result) { print $objp->description; } print ''; - print ''; - print ''; - print ''; - print ''; print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index fa264a81920..7a3777ecfb5 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -200,6 +200,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -218,7 +220,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PRE $sql.= " WHERE f.fk_soc = s.rowid"; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; @@ -307,7 +309,7 @@ if ($result) $invoicestatic->ref=$objp->ref; print $invoicestatic->getNomUrl(1); print "\n"; - print ""; } else { @@ -317,13 +319,13 @@ if ($result) print "\n"; } - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; $i++; @@ -352,13 +354,13 @@ if ($result) else print '"; - print "\n"; - print "\n"; - print "\n"; + print "\n"; + print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "\n"; + print "\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "\n"; + print "\n"; print "\n"; print "
'.$langs->trans("Description").''.$langs->trans("Value").''.$langs->trans("Value").''.$langs->trans("Description").'
'.$langs->trans("DisplayMarginRates").''; +print ''; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); @@ -185,7 +185,7 @@ print '
'.$langs->trans("DisplayMarkRates").''; +print ''; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); @@ -208,7 +208,7 @@ print '
'.$langs->trans("ForceBuyingPriceIfNull").''; +print ''; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 687a381d790..0885f12af67 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -132,6 +132,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; @@ -153,7 +155,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE)) $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))"; else $sql .= " AND sc.fk_user = u.rowid"; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; if ($agentid > 0) { @@ -212,13 +214,13 @@ if ($result) else print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, ' align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); print "
".$group_array['htmlname']."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."
'; + print ''; print price($objp->subprice); print ''; + print ''; print ''; print ''; + print ''; print $objp->qty; print ''; + print ''; print price($objp->total_ht); print '"; + print ""; print dol_print_date($db->jdate($objp->datef), 'day')."".$companystatic->getNomUrl(1, 'margin')."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."
'; print $langs->trans('TotalMargin')."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."
"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 95686967fd9..c390f9599c8 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -174,6 +174,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -190,7 +192,7 @@ if (! empty($TSelectedCats)) { } $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= ' AND f.entity IN ('.getEntity('invoice').')'; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0) $sql.= " AND d.fk_product =".$id; @@ -280,7 +282,7 @@ if ($result) $invoicestatic->ref=$objp->ref; print $invoicestatic->getNomUrl(1); print "
"; + print ""; print dol_print_date($db->jdate($objp->datef), 'day')."".$product_static->getNomUrl(1)."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".price($pv, null, null, null, null, $rounding)."".price($pa, null, null, null, null, $rounding)."".price($marge, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."
'; print $langs->trans('TotalMargin')."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".price($cumul_vente, null, null, null, null, $rounding)."".price($cumul_achat, null, null, null, null, $rounding)."".price($totalMargin, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."
"; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index bb4e8510c5b..78d0716f9bf 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -172,16 +172,16 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$object->id, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", "&id=".$object->id, '', $sortfield, $sortorder); print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", "&id=".$object->id, '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$object->id, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$object->id, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", "&id=".$object->id, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", "&id=".$object->id, '', $sortfield, $sortorder, 'right '); print "
'.img_object($langs->trans("ShowCompany"), "company").' '.dol_trunc($objp->name, 44).'".$objp->code_client.""; + print ""; print dol_print_date($db->jdate($objp->datef), 'day')."".price($objp->selling_price, null, null, null, null, $rounding)."".price($objp->buying_price, null, null, null, null, $rounding)."".price($objp->qty, null, null, null, null, $rounding)."".price($objp->marge, null, null, null, null, $rounding)."".price($objp->selling_price, null, null, null, null, $rounding)."".price($objp->buying_price, null, null, null, null, $rounding)."".price($objp->qty, null, null, null, null, $rounding)."".price($objp->marge, null, null, null, null, $rounding)."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."'.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).'
'.$langs->trans('TotalMargin')."'.price($cumul_vente, null, null, null, null, $rounding)."'.price($cumul_achat, null, null, null, null, $rounding)."'.price($cumul_qty, null, null, null, null, $rounding)."'.price($totalMargin, null, null, null, null, $rounding)."'.price($cumul_vente, null, null, null, null, $rounding)."'.price($cumul_achat, null, null, null, null, $rounding)."'.price($cumul_qty, null, null, null, null, $rounding)."'.price($totalMargin, null, null, null, null, $rounding)."'.(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."'.(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")." ".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")." 
"; print '
'; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 15fc2bcac0a..a69b98a9ac1 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -178,15 +178,15 @@ if ($socid > 0) print ''; print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder); - print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$_REQUEST["socid"], 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("SoldAmount", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("PurchasedAmount", $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("SoldAmount", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("PurchasedAmount", $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", "&socid=".$_REQUEST["socid"], 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", "&socid=".$_REQUEST["socid"], '', $sortfield, $sortorder, 'right '); print "\n"; $cumul_achat = 0; @@ -214,16 +214,16 @@ if ($socid > 0) $invoicestatic->ref=$objp->ref; print $invoicestatic->getNomUrl(1); print "\n"; - print ""; + print ""; print dol_print_date($db->jdate($objp->datef), 'day').""; - print "".price($objp->selling_price, null, null, null, null, $rounding)."\n"; - print "".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."\n"; - print "".$sign.price($objp->marge, null, null, null, null, $rounding)."\n"; + print "".price($objp->selling_price, null, null, null, null, $rounding)."\n"; + print "".price(($objp->type == 2 ? -1 : 1) * $objp->buying_price, null, null, null, null, $rounding)."\n"; + print "".$sign.price($objp->marge, null, null, null, null, $rounding)."\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '')?'n/a':$sign.price($marginRate, null, null, null, null, $rounding)."%")."\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; - print ''.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).''; + print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print ''.$invoicestatic->LibStatut($objp->paye, $objp->statut, 5).''; print "\n"; $i++; $cumul_vente += $objp->selling_price; @@ -248,14 +248,14 @@ if ($socid > 0) // Total print ''; print ''.$langs->trans('TotalMargin').""; - print "".price($cumul_vente, null, null, null, null, $rounding)."\n"; - print "".price($cumul_achat, null, null, null, null, $rounding)."\n"; - print "".price($totalMargin, null, null, null, null, $rounding)."\n"; + print "".price($cumul_vente, null, null, null, null, $rounding)."\n"; + print "".price($cumul_achat, null, null, null, null, $rounding)."\n"; + print "".price($totalMargin, null, null, null, null, $rounding)."\n"; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print "".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."\n"; + print "".(($marginRate === '')?'n/a':price($marginRate, null, null, null, null, $rounding)."%")."\n"; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; - print ' '; + print "".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."\n"; + print ' '; print "\n"; } else diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index 5590a678945..be644a1f2e4 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -114,7 +114,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''; print '' . $langs->trans("UseAboutPage") . ''; - print ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); } else { @@ -128,7 +128,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''; print '' . $langs->trans("UseDocFolder") . ''; - print ''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER'); } else { diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 7e290055d43..af51071d674 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -108,8 +108,8 @@ if ($dirins && $action == 'initmodule' && $modulename) $destdir = $dirins.'/'.strtolower($modulename); $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename ); $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); @@ -128,31 +128,45 @@ if ($dirins && $action == 'initmodule' && $modulename) } } - if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) + if (! empty($conf->global->MODULEBUILDER_USE_ABOUT)) { dol_delete_file($destdir.'/admin/about.php'); } - if (!empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) - { - dol_delete_dir($destdir.'/doc/'); - } - // Delete some files related to object (because to previous dolCopyDir has copied everything) + // Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first) + dol_delete_dir_recursive($destdir.'/build/doxygen'); + dol_delete_dir_recursive($destdir.'/core/modules/mailings'); + dol_delete_dir_recursive($destdir.'/core/tpl'); + dol_delete_dir_recursive($destdir.'/core/triggers'); + dol_delete_dir_recursive($destdir.'/doc'); + dol_delete_dir_recursive($destdir.'/.tx'); + dol_delete_dir_recursive($destdir.'/core/boxes'); + + dol_delete_file($destdir.'/sql/data.sql'); + dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql'); + dol_delete_dir($destdir.'/sql'); + + dol_delete_file($destdir.'/class/actions_'.strtolower($modulename).'.class.php'); + dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php'); + dol_delete_dir($destdir.'/class'); + + dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php'); + dol_delete_dir($destdir.'/scripts'); + + + // Delete some files related to Object (because the dolCopyDir has copied everything) dol_delete_file($destdir.'/myobject_card.php'); dol_delete_file($destdir.'/myobject_note.php'); dol_delete_file($destdir.'/myobject_document.php'); dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); - dol_delete_file($destdir.'/lib/mymodule_myobject.lib.php'); + dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); - dol_delete_file($destdir.'/sql/llx_mymodule_myobject.sql'); - dol_delete_file($destdir.'/sql/llx_mymodule_myobject_extrafields.sql'); - dol_delete_file($destdir.'/sql/llx_mymodule_myobject.key.sql'); - dol_delete_file($destdir.'/scripts/myobject.php'); + dol_delete_file($destdir.'/sql/llx'.strtolower($modulename).'_myobject.sql'); + dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); + dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); - dol_delete_file($destdir.'/class/api_mymodule.class.php'); - dol_delete_file($destdir.'/doc/*example*'); } // Edit PHP files @@ -163,18 +177,17 @@ if ($dirins && $action == 'initmodule' && $modulename) { //var_dump($phpfileval['fullname']); $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename, - 'MYMODULE'=>strtoupper($modulename), - 'My module'=>$modulename, - 'my module'=>$modulename, - 'Mon module'=>$modulename, - 'mon module'=>$modulename, - 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') ); - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); //var_dump($result); if ($result < 0) @@ -198,6 +211,132 @@ if ($dirins && $action == 'initmodule' && $modulename) } } +if ($dirins && $action == 'inithook' && !empty($module)) +{ + dol_mkdir($dirins.'/'.strtolower($module).'/class'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/class/actions_mymodule.class.php'; + $destfile = $dirins.'/'.strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; + //var_dump($srcfile);var_dump($destfile); + $result = dol_copy($srcfile, $destfile, 0, 0); +} +if ($dirins && $action == 'inittrigger' && !empty($module)) +{ + dol_mkdir($dirins.'/'.strtolower($module).'/core/triggers'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php'; + $destfile = $dirins.'/'.strtolower($module).'/core/triggers/interface_99_mod'.$module.'_'.$module.'Triggers.class.php'; + //var_dump($srcfile);var_dump($destfile); + $result = dol_copy($srcfile, $destfile, 0, 0); + + if ($result > 0) + { + $modulename = ucfirst($module); // Force first letter in uppercase + + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } +} +if ($dirins && $action == 'initwidget' && !empty($module)) +{ + dol_mkdir($dirins.'/'.strtolower($module).'/core/boxes'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/core/boxes/mymodulewidget1.php'; + $destfile = $dirins.'/'.strtolower($module).'/core/boxes/'.strtolower($module).'widget1.php'; + //var_dump($srcfile);var_dump($destfile); + $result = dol_copy($srcfile, $destfile, 0, 0); + + if ($result > 0) + { + $modulename = ucfirst($module); // Force first letter in uppercase + + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } +} +if ($dirins && $action == 'initcli' && !empty($module)) +{ + dol_mkdir($dirins.'/'.strtolower($module).'/scripts'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/scripts/mymodule.php'; + $destfile = $dirins.'/'.strtolower($module).'/scripts/'.strtolower($module).'.php'; + //var_dump($srcfile);var_dump($destfile); + $result = dol_copy($srcfile, $destfile, 0, 0); + + if ($result > 0) + { + $modulename = ucfirst($module); // Force first letter in uppercase + + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } +} +if ($dirins && $action == 'initdoc' && !empty($module)) +{ + dol_mkdir($dirins.'/'.strtolower($module).'/doc'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/doc/Specifications.asciidoc'; + $destfile = $dirins.'/'.strtolower($module).'/doc/Specifications.asciidoc'; + //var_dump($srcfile);var_dump($destfile); + $result = dol_copy($srcfile, $destfile, 0, 0); + + if ($result > 0) + { + $modulename = ucfirst($module); // Force first letter in uppercase + + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } +} + if ($dirins && $action == 'addlanguage' && !empty($module)) { $newlangcode=GETPOST('newlangcode', 'aZ09'); @@ -206,6 +345,20 @@ if ($dirins && $action == 'addlanguage' && !empty($module)) $result = dolCopyDir($srcfile, $destfile, 0, 0); } +if ($dirins && $action == 'confirm_removefile' && !empty($module)) +{ + $relativefilename=dol_sanitizePathName(GETPOST('file', 'none')); + if ($relativefilename) + { + $dirnametodelete = dirname($relativefilename); + $filetodelete = $dirins.'/'.$relativefilename; + $dirtodelete = $dirins.'/'.$dirnametodelete; + + $result = dol_delete_file($filetodelete); + if (dol_is_dir_empty($dirtodelete)) dol_delete_dir($dirtodelete); + } +} + if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', 'alpha')) { $tablename = GETPOST('initfromtablename', 'alpha'); @@ -413,17 +566,17 @@ if ($dirins && $action == 'initobject' && $module && $objectname) //var_dump($phpfileval['fullname']); $arrayreplacement=array( - 'mymodule'=>strtolower($module), - 'MyModule'=>$module, - 'MYMODULE'=>strtoupper($module), - 'My module'=>$module, - 'my module'=>$module, - 'mon module'=>$module, - 'Mon module'=>$module, - 'htdocs/modulebuilder/template/'=>strtolower($modulename), - 'myobject'=>strtolower($objectname), - 'MyObject'=>$objectname, - 'MYOBJECT'=>strtoupper($objectname) + 'mymodule'=>strtolower($module), + 'MyModule'=>$module, + 'MYMODULE'=>strtoupper($module), + 'My module'=>$module, + 'my module'=>$module, + 'mon module'=>$module, + 'Mon module'=>$module, + 'htdocs/modulebuilder/template/'=>strtolower($modulename), + 'myobject'=>strtolower($objectname), + 'MyObject'=>$objectname, + 'MYOBJECT'=>strtoupper($objectname) ); $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); @@ -1067,12 +1220,13 @@ if ($module == 'initmodule') print $langs->trans("EnterNameOfModuleDesc").'

'; print ''; + print ''; print ''; } elseif ($module == 'deletemodule') { - print '
'; + print ''; print ''; print ''; print ''; @@ -1162,6 +1316,11 @@ elseif (! empty($module)) $head2[$h][2] = 'widgets'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cli&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("CLI"); + $head2[$h][2] = 'cli'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("CronList"); $head2[$h][2] = 'cron'; @@ -1198,21 +1357,24 @@ elseif (! empty($module)) { dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 - print $langs->trans("ModuleBuilderDesc".$tab).'

'; + print ''.$langs->trans("ModuleBuilderDesc".$tab).'

'; + print ''; + + print ''; - print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ''; - print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ''; - print '
'; + print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'.img_picto($langs->trans("Edit"), 'edit').''; + print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print '
'.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; print '
'; print load_fiche_titre($langs->trans("DescriptorFile")); @@ -1344,66 +1506,15 @@ elseif (! empty($module)) dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 } - - if ($tab == 'specifications') - { - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("SpecDefDesc").'
'; - print '
'; - - $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/')); - - foreach ($specs as $spec) - { - $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; - $format='asciidoc'; - if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; - print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } - } - else - { - // Use MD or asciidoc - - //print $langs->trans("UseAsciiDocFormat").'
'; - - $fullpathoffile=dol_buildpath($file, 0); - - $content = file_get_contents($fullpathoffile); - - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; - - print '
'; - } - } - if ($tab == 'languages') { if ($action != 'editfile' || empty($file)) { - print $langs->trans("LanguageDefDesc").'
'; + print ''.$langs->trans("LanguageDefDesc").'
'; print '
'; - print '
'; + print ''; print ''; print ''; print ''; @@ -1418,13 +1529,16 @@ elseif (! empty($module)) $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); + print ''; foreach ($langfiles as $langfile) { $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; - print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ''; } + print '
'.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + print '
'; } else { @@ -1516,7 +1630,7 @@ elseif (! empty($module)) print ''; print ''; - print $langs->trans("EnterNameOfObjectDesc").'

'; + print ''.$langs->trans("EnterNameOfObjectDesc").'

'; print ''; print ''; @@ -1554,7 +1668,7 @@ elseif (! empty($module)) { // tabobj = module if ($action == 'deleteproperty') { - $formconfirm = $form->formconfirm( + $formconfirm = $form->formconfirm( $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey', 'alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey', 'alpha')), 'confirm_deleteproperty', '', 0, 1 ); @@ -1706,21 +1820,19 @@ elseif (! empty($module)) //var_dump($reflectorpropdefault); print ''; - - print ''; - print ''; - print '

'; - - - print load_fiche_titre($langs->trans("Properties"), '', ''); - - print ''; print ''; print ''; print ''; print ''; + print ''; + print ''; + print '

'; + + print load_fiche_titre($langs->trans("Properties"), '', ''); + + print '
'; print ''; print ''; @@ -1766,7 +1878,7 @@ elseif (! empty($module)) print ''; print ''; print ''; - print ''; @@ -1812,8 +1924,7 @@ elseif (! empty($module)) print $proptype; print ''; print ''; @@ -1826,7 +1937,7 @@ elseif (! empty($module)) print ''; - print ''; print ''; + if ($tab == 'specifications') + { + if ($action != 'editfile' || empty($file)) + { + print ''.$langs->trans("SpecDefDesc").'
'; + print '
'; + + $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/')); + + foreach ($specs as $spec) + { + $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; + $format='asciidoc'; + if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; + print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } + } + else + { + // Use MD or asciidoc + + //print $langs->trans("UseAsciiDocFormat").'
'; + + $fullpathoffile=dol_buildpath($file, 0); + + $content = file_get_contents($fullpathoffile); + + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + + print ''; + } + } + print ''; } print '
'; + print ''; print ''; print '
'; - if ($proparrayofkeyval) - { + if ($proparrayofkeyval) { print json_encode($proparrayofkeyval); } print ''; print $propindex?'1':''; print ''; + print ''; print $propposition; print ''; @@ -1853,7 +1964,56 @@ elseif (! empty($module)) } else { - print '
'.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').'
'.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').'
'; print '
'; @@ -1916,7 +2076,7 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { - print $langs->trans("MenusDefDesc", ''.$langs->trans('Menus').'').'
'; + print ''.$langs->trans("MenusDefDesc", ''.$langs->trans('Menus').'').'
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; @@ -2041,7 +2201,7 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { - print $langs->trans("PermissionsDefDesc", ''.$langs->trans('DefaultPermissions').'').'
'; + print ''.$langs->trans("PermissionsDefDesc", ''.$langs->trans('DefaultPermissions').'').'
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; @@ -2162,18 +2322,32 @@ elseif (! empty($module)) { if ($action != 'editfile' || empty($file)) { - print $langs->trans("HooksDefDesc").'
'; + print ''.$langs->trans("HooksDefDesc").'
'; print '
'; + print ''; + print ''; + print ''; + } + else + { + print ''.$langs->trans("FileNotYetGenerated").''; + print ''; + } + print ''; } else { @@ -2211,24 +2385,31 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { - print $langs->trans("TriggerDefDesc").'
'; + print ''.$langs->trans("TriggerDefDesc").'
'; print '
'; + print '
'; + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print '
'; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; - print ' '.$langs->trans("HooksFile").' : '.$pathtohook.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("HooksFile").' : '; + if (dol_is_file($dirins.'/'.$pathtohook)) + { + print ''.$pathtohook.''; + print '
'.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'; if (! empty($triggers)) { foreach ($triggers as $trigger) { $pathtofile = $trigger['relpath']; + print ''; + print ''; + print ''; } } else { - print $langs->trans("NoTrigger"); + print ''; + print ''; } + print '
'; print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'; + print ' '.$langs->trans("NoTrigger"); + print '
'; } else { @@ -2265,21 +2446,30 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { - if (! empty($widget)) + print ''.$langs->trans("WidgetDesc").'
'; + print '
'; + + print ''; + if (! empty($widgets)) { foreach ($widgets as $widget) { $pathtofile = $widget['relpath']; - print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; + print ''; + print ''; + print ''; } } else { - print $langs->trans("NoWidget"); + print ''; } + print '
'.$langs->trans("WidgetFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'.img_picto($langs->trans("Delete"), 'delete').'
'.$langs->trans("NoWidget"); + print ''; + print '
'; } else { @@ -2308,6 +2498,92 @@ elseif (! empty($module)) } } + if ($tab == 'cli') + { + $clifiles = array(); + $i = 0; + + $dircli=array('/'.strtolower($module).'/scripts'); + + foreach($dircli as $reldir) + { + $dir=dol_buildpath($reldir, 0); + $newdir=dol_osencode($dir); + + // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call) + if (! is_dir($newdir)) continue; + + $handle=opendir($newdir); + if (is_resource($handle)) + { + while (($tmpfile = readdir($handle))!==false) + { + if (is_readable($newdir.'/'.$file) && preg_match('/^(.+)\.php/', $tmpfile, $reg)) + { + if (preg_match('/\.back$/', $tmpfile)) continue; + + $clifiles[$i]['relpath'] = preg_replace('/^\//', '', $reldir).'/'.$tmpfile; + + $i++; + } + } + closedir($handle); + } + } + + if ($action != 'editfile' || empty($file)) + { + print ''.$langs->trans("CLIDesc").'
'; + print '
'; + + print ''; + if (! empty($clifiles)) + { + foreach ($clifiles as $clifile) + { + $pathtofile = $clifile['relpath']; + + print ''; + print ''; + print ''; + } + } + else + { + print ''; + } + print '
'.$langs->trans("CLIFile").' : '.$pathtofile.''; + print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'.$langs->trans("NoCLIFile"); + print ''; + print '
'; + } + else + { + $fullpathoffile=dol_buildpath($file, 0); + + $content = file_get_contents($fullpathoffile); + + // New module + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + + print '
'; + } + } + if ($tab == 'cron') { $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; @@ -2316,7 +2592,7 @@ elseif (! empty($module)) if ($action != 'editfile' || empty($file)) { - print $langs->trans("CronJobDefDesc", ''.$langs->transnoentities('CronList').'').'
'; + print ''.$langs->trans("CronJobDefDesc", ''.$langs->transnoentities('CronList').'').'
'; print '
'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; @@ -2430,6 +2706,70 @@ elseif (! empty($module)) } } + if ($tab == 'specifications') + { + if ($action != 'editfile' || empty($file)) + { + print ''.$langs->trans("SpecDefDesc").'
'; + print '
'; + + $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/')); + + print ''; + if (is_array($specs) && ! empty($specs)) + { + foreach ($specs as $spec) + { + $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; + $format='asciidoc'; + if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; + print ''; + print ''; + print ''; + } + } + else + { + print ''; + print ''; + } + print '
'; + print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; + print ''.img_picto($langs->trans("Edit"), 'edit').''.img_picto($langs->trans("Delete"), 'delete').'
'; + print ' '.$langs->trans("FileNotYetGenerated"); + print '
'; + } + else + { + // Use MD or asciidoc + + //print $langs->trans("UseAsciiDocFormat").'
'; + + $fullpathoffile=dol_buildpath($file, 0); + + $content = file_get_contents($fullpathoffile); + + // New module + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09')?GETPOST('format', 'aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + + print '
'; + } + } + if ($tab == 'buildpackage') { if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) @@ -2492,7 +2832,8 @@ elseif (! empty($module)) print '
'; - print '
'; + print ''; + print ''; print ''; print ''; print ''; @@ -2515,7 +2856,8 @@ elseif (! empty($module)) print '
'; - print ''; + print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 635e1eed5b0..f894c3ac6ae 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -87,14 +87,8 @@ Licenses ### Main code -![GPLv3 logo](img/gplv3.png) - -GPLv3 or (at your option) any later version. - -See file COPYING for more information. +GPLv3 or (at your option) any later version. See file COPYING for more information. #### Documentation -All texts and readmes. - -![GFDL logo](img/gfdl.png) +All texts and readmes are licensed under GFDL. diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index cdb5a4b74f4..acf7f65454d 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -31,7 +31,6 @@ dol_include_once('/mymodule/class/myobject.class.php'); /** * API class for mymodule myobject * - * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} */ @@ -205,7 +204,7 @@ class MyModuleApi extends DolibarrApi $this->myobject->$field = $value; } if( ! $this->myobject->create(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); } return $this->myobject->id; } @@ -235,13 +234,18 @@ class MyModuleApi extends DolibarrApi } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->myobject->$field = $value; } - if($this->myobject->update($id, DolibarrApiAccess::$user)) + if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) + { return $this->get($id); - - return false; + } + else + { + throw new RestException(500, $this->myobject->error); + } } /** @@ -254,21 +258,21 @@ class MyModuleApi extends DolibarrApi */ public function delete($id) { - if(! DolibarrApiAccess::$user->rights->myobject->delete) { + if (! DolibarrApiAccess::$user->rights->myobject->delete) { throw new RestException(401); } $result = $this->myobject->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'MyObject not found'); } - if( ! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) { + if (! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( !$this->myobject->delete(DolibarrApiAccess::$user, 0)) + if (! $this->myobject->delete(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error); } return array( @@ -280,14 +284,16 @@ class MyModuleApi extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); /*unset($object->note); @@ -303,10 +309,10 @@ class MyModuleApi extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Data to validate - * @return array + * @param array $data Array of data to validate + * @return array * - * @throws RestException + * @throws RestException */ private function _validate($data) { diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index 7416eb1c35e..ed35331f8e3 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -18,7 +18,7 @@ */ /** - * \file modulebuilder/template/core/boxes/mymodulewidget1.php + * \file htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php * \ingroup mymodule * \brief Widget provided by MyModule * @@ -186,7 +186,7 @@ class mymodulewidget1 extends ModeleBoxes 'tr' => 'class="left"', 'text' => '' ), - 0 => array( // TR + 1 => array( // TR 'tr' => 'class="left"', 'text' => '' ) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 83644cd1f0e..07419af532d 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -97,9 +97,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * This is the main function that returns the array of emails * * @param int $mailing_id Id of emailing + * @param array $cibles Array with targets * @return int <0 if error, number of emails added if ok */ - public function add_to_target($mailing_id) + public function add_to_target($mailing_id, $cibles) { // phpcs:enable $target = array(); diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 0f350e83226..c58452bc0aa 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -91,14 +91,14 @@ class modMyModule extends DolibarrModules 'substitutions' => 1, // Set this to 1 if module has its own menus handler directory (core/menus) 'menus' => 0, - // Set this to 1 if module has its own theme directory (theme) - 'theme' => 0, // Set this to 1 if module overwrite template dir (core/tpl) 'tpl' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) 'barcode' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) 'models' => 0, + // Set this to 1 if module has its own theme directory (theme) + 'theme' => 0, // Set this to relative path of css file if module has its own css file 'css' => array( '/mymodule/css/mymodule.css.php', diff --git a/htdocs/modulebuilder/template/doc/Specifications.asciidoc b/htdocs/modulebuilder/template/doc/Specifications.asciidoc index be8316c8cda..232ba7a705f 100644 --- a/htdocs/modulebuilder/template/doc/Specifications.asciidoc +++ b/htdocs/modulebuilder/template/doc/Specifications.asciidoc @@ -13,7 +13,7 @@ This document describe specifications of module MyModule [options="header",format="csv"] |=== Author, Date, Version ----Put here your own copyright and developer email---, Date YYY-MM-DD, Version 1.0 +---Put here your own copyright and developer email---, Date YYYY-MM-DD, Version 1.0 |=== diff --git a/htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc b/htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc index 72d1d5f4d82..6917d7cdd68 100644 --- a/htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc +++ b/htdocs/modulebuilder/template/doc/Specifications_full_en.example.asciidoc @@ -39,7 +39,7 @@ external documents stored in the *Appendices* directory accompanying this docume [options="header",format="csv"] |=== Author, Date, Version -John Doe, Date YYY-MM-DD, Version 1.0 +John Doe, Date YYYY-MM-DD, Version 1.0 |=== diff --git a/htdocs/modulebuilder/template/img/gfdl.png b/htdocs/modulebuilder/template/img/gfdl.png deleted file mode 100644 index f2bacfd179a..00000000000 Binary files a/htdocs/modulebuilder/template/img/gfdl.png and /dev/null differ diff --git a/htdocs/modulebuilder/template/img/gplv3.png b/htdocs/modulebuilder/template/img/gplv3.png deleted file mode 100644 index ba78d4c4941..00000000000 Binary files a/htdocs/modulebuilder/template/img/gplv3.png and /dev/null differ diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 39aca93a52f..637e9404f67 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -134,14 +134,14 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1,'customer',16); print ''; - print ''.price($obj->total_ttc).''; + print ''.price($obj->total_ttc).''; $i++; $total += $obj->total_ttc; } if ($total>0) { - print ''.$langs->trans("Total").''.price($total).""; + print ''.$langs->trans("Total").''.price($total).""; } } else @@ -195,7 +195,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); else print $langs->trans("BoxTitleLastModifiedCustomers",$max); print ''; - print ''.$langs->trans("DateModificationShort").''; + print ''.$langs->trans("DateModificationShort").''; print ''; if ($num) { @@ -210,10 +210,10 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $companystatic->canvas=$objp->canvas; print ''; print ''.$companystatic->getNomUrl(1,'customer',48).''; - print ''; + print ''; print $companystatic->getLibCustProspStatut(); print ""; - print ''.dol_print_date($db->jdate($objp->tms),'day').""; + print ''.dol_print_date($db->jdate($objp->tms),'day').""; print ''; $i++; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ff815e738fc..a310f4258e9 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -420,7 +420,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -448,7 +448,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print ''."\n"; @@ -516,7 +516,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -539,7 +539,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; else { if ($i == 1) diff --git a/htdocs/modulebuilder/template/scripts/myobject.php b/htdocs/modulebuilder/template/scripts/mymodule.php similarity index 96% rename from htdocs/modulebuilder/template/scripts/myobject.php rename to htdocs/modulebuilder/template/scripts/mymodule.php index 97310f11de6..765b1138f05 100644 --- a/htdocs/modulebuilder/template/scripts/myobject.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -18,14 +18,14 @@ */ /** - * \file htdocs/modulebuilder/template/scripts/myobject.php + * \file htdocs/modulebuilder/template/scripts/mymodule.php * \ingroup mymodule - * \brief This file is an example for a command line script to work on MyObject + * \brief This file is an example for a command line script for module MyModule */ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path=__DIR__.'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -81,8 +81,8 @@ $db->begin(); // Examples for manipulating class MyObject -dol_include_once("/mymodule/class/myobject.class.php"); -$myobject=new MyObject($db); +//dol_include_once("/mymodule/class/myobject.class.php"); +//$myobject=new MyObject($db); // Example for inserting creating object in database /* diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 0dff8b96b69..5982a8c271b 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -112,13 +112,14 @@ if (empty($reshook)) if (! $error) { - $object->titre = GETPOST('nouveautitre'); - $object->commentaires = GETPOST('nouveauxcommentaires'); - $object->mail_admin = GETPOST('nouvelleadresse'); + $object->titre = GETPOST('nouveautitre', 'nohtml'); + $object->commentaires = GETPOST('nouveauxcommentaires', 'nohtml'); + $object->description = GETPOST('nouveauxcommentaires', 'nohtml'); + $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; - $object->allow_comments = GETPOST('cancomment') == 'on' ? true : false; - $object->allow_spy = GETPOST('canseeothersvote') == 'on' ? true : false; - $object->mailsonde = GETPOST('mailsonde') == 'on' ? true : false; + $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? true : false; + $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? true : false; + $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; $res=$object->update($user); if ($res < 0) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index a688f12654b..8a5a102a9f5 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -49,7 +49,7 @@ class Opensurveysondage extends CommonObject public $id_sondage; /** * @deprecated - * @see description + * @see $description */ public $commentaires; @@ -519,6 +519,7 @@ class Opensurveysondage extends CommonObject $this->id_sondage=''; $this->commentaires='Comment of the specimen survey'; + $this->description='Comment of the specimen survey'; $this->mail_admin=''; $this->nom_admin=''; $this->titre='This is a specimen survey'; @@ -606,6 +607,7 @@ class Opensurveysondage extends CommonObject { $this->id_sondage = trim($this->id_sondage); $this->commentaires = trim($this->commentaires); + $this->description = trim($this->description); $this->mail_admin = trim($this->mail_admin); $this->nom_admin = trim($this->nom_admin); $this->titre = trim($this->titre); diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index c69b6fa3c0f..b93440f9afd 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -207,6 +207,7 @@ function ajouter_sondage() $opensurveysondage = new Opensurveysondage($db); $opensurveysondage->id_sondage = $sondage; $opensurveysondage->commentaires = $_SESSION['commentaires']; + $opensurveysondage->description = $_SESSION['commentaires']; $opensurveysondage->mail_admin = $_SESSION['adresse']; $opensurveysondage->nom_admin = $_SESSION['nom']; $opensurveysondage->titre = $_SESSION['titre']; diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index c95bcdcb8f4..756bbde5b29 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -468,15 +468,16 @@ class Products extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->regeximgext); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 1bafd063dec..3070515b020 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -316,8 +316,6 @@ class FormProduct $return = ''; - $measuring_units = array(); - require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php'; $measuringUnits = new CUnits($db); $result = $measuringUnits->fetchAll( @@ -340,7 +338,7 @@ class FormProduct foreach ($measuringUnits->records as $lines) { $return .= ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9ef3ba450cf..8d446682dfd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -14,6 +14,7 @@ * Copyright (C) 2014 Ion agorria * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -271,7 +272,7 @@ class Product extends CommonObject * Main barcode * barcode value * - * @var + * @var string */ public $barcode; @@ -554,7 +555,8 @@ class Product extends CommonObject $this->db->begin(); // For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts) - if ($this->barcode == -1) { $this->barcode = $this->get_barcode($this, $this->barcode_type_code); + if ($this->barcode == -1) { + $this->barcode = $this->get_barcode($this, $this->barcode_type_code); } // Check more parameters @@ -1001,9 +1003,10 @@ class Product extends CommonObject } if (! $error && ! $notrigger) { - // Call trigger - $result=$this->call_trigger('PRODUCT_MODIFY', $user); - if ($result < 0) { $error++; + // Call trigger + $result=$this->call_trigger('PRODUCT_MODIFY', $user); + if ($result < 0) { + $error++; } // End call triggers } @@ -1014,10 +1017,10 @@ class Product extends CommonObject $olddir = $conf->product->dir_output . "/" . dol_sanitizeFileName($this->oldcopy->ref); $newdir = $conf->product->dir_output . "/" . dol_sanitizeFileName($this->ref); if (file_exists($olddir)) { - //include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - //$res = dol_move($olddir, $newdir); - // do not use dol_move with directory - $res = @rename($olddir, $newdir); + //include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + //$res = dol_move($olddir, $newdir); + // do not use dol_move with directory + $res = @rename($olddir, $newdir); if (! $res) { $langs->load("errors"); $this->error=$langs->trans('ErrorFailToRenameDir', $olddir, $newdir); @@ -1052,8 +1055,10 @@ class Product extends CommonObject { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - if (empty($conf->barcode->enabled) || empty($this->barcode)) { $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists", $this->ref); - } else { $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists", $this->barcode); + if (empty($conf->barcode->enabled) || empty($this->barcode)) { + $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists", $this->ref); + } else { + $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists", $this->barcode); } $this->errors[]=$this->error; $this->db->rollback(); @@ -1096,8 +1101,10 @@ class Product extends CommonObject $error=0; // Clean parameters - if (empty($id)) { $id=$this->id; - } else { $this->fetch($id); + if (empty($id)) { + $id=$this->id; + } else { + $this->fetch($id); } // Check parameters @@ -1501,7 +1508,8 @@ class Product extends CommonObject $now=dol_now(); // Clean parameters - if (empty($this->price_by_qty)) { $this->price_by_qty=0; + if (empty($this->price_by_qty)) { + $this->price_by_qty=0; } // Add new price @@ -1561,7 +1569,7 @@ class Product extends CommonObject * @param Societe $thirdparty_buyer Buyer * @param int $pqp Id of product per price if a selection was done of such a price * @return array Array of price information - * @see get_buyprice() + * @see get_buyprice(), find_min_price_product_fournisseur() */ public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0) { @@ -1672,8 +1680,8 @@ class Product extends CommonObject * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search. * @param int $fk_soc If of supplier - * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) - * @see getSellPrice() + * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) + * @see getSellPrice(), find_min_price_product_fournisseur() */ public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0) { @@ -1834,13 +1842,16 @@ class Product extends CommonObject dol_syslog(get_class($this)."::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level." npr=".$newnpr." newdefaultvatcode=".$newdefaultvatcode); // Clean parameters - if (empty($this->tva_tx)) { $this->tva_tx=0; + if (empty($this->tva_tx)) { + $this->tva_tx=0; } - if (empty($newnpr)) { $newnpr=0; + if (empty($newnpr)) { + $newnpr=0; } // Check parameters - if ($newvat == '') { $newvat=$this->tva_tx; + if ($newvat == '') { + $newvat=$this->tva_tx; } // If multiprices are enabled, then we check if the current product is subject to price autogeneration @@ -1904,9 +1915,11 @@ class Product extends CommonObject $localtaxtype2='0'; $localtax2=get_localtax($newvat, 2); } - if (empty($localtax1)) { $localtax1=0; // If = '' then = 0 + if (empty($localtax1)) { + $localtax1=0; // If = '' then = 0 } - if (empty($localtax2)) { $localtax2=0; // If = '' then = 0 + if (empty($localtax2)) { + $localtax2=0; // If = '' then = 0 } $this->db->begin(); @@ -2132,7 +2145,8 @@ class Product extends CommonObject $this->fetch_optionals(); // multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) { $this->getMultiLangs(); + if (! empty($conf->global->MAIN_MULTILANGS)) { + $this->getMultiLangs(); } // Load multiprices array @@ -2361,7 +2375,7 @@ class Product extends CommonObject * Charge tableau des stats propale pour le produit/service * * @param int $socid Id societe - * @return array Tableau des stats + * @return integer Tableau des stats dans $this->stats_propale, <0 if ko >0 if ok */ public function load_stats_propale($socid = 0) { @@ -2374,16 +2388,19 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE p.rowid = pd.fk_propal"; $sql.= " AND p.fk_soc = s.rowid"; $sql.= " AND p.entity IN (".getEntity('propal').")"; $sql.= " AND pd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } //$sql.= " AND pr.fk_statut != 0"; - if ($socid > 0) { $sql.= " AND p.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND p.fk_soc = ".$socid; } $result = $this->db->query($sql); @@ -2457,7 +2474,7 @@ class Product extends CommonObject * @param int $socid Id societe pour filtrer sur une societe * @param string $filtrestatut Id statut pour filtrer sur un statut * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. - * @return array Array of stats (nb=nb of order, qty=qty ordered) + * @return integer Array of stats in $this->stats_commande (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok */ public function load_stats_commande($socid = 0, $filtrestatut = '', $forVirtualStock = 0) { @@ -2469,17 +2486,21 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE c.rowid = cd.fk_commande"; $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('commande').")"; $sql.= " AND cd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; } - if ($filtrestatut <> '') { $sql.= " AND c.fk_statut in (".$filtrestatut.")"; + if ($filtrestatut <> '') { + $sql.= " AND c.fk_statut in (".$filtrestatut.")"; } $result = $this->db->query($sql); @@ -2564,17 +2585,21 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE c.rowid = cd.fk_commande"; $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('supplier_order').")"; $sql.= " AND cd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; } - if ($filtrestatut != '') { $sql.= " AND c.fk_statut in (".$filtrestatut.")"; // Peut valoir 0 + if ($filtrestatut != '') { + $sql.= " AND c.fk_statut in (".$filtrestatut.")"; // Peut valoir 0 } $result = $this->db->query($sql); @@ -2614,7 +2639,8 @@ class Product extends CommonObject $sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE e.rowid = ed.fk_expedition"; $sql.= " AND c.rowid = cd.fk_commande"; @@ -2622,11 +2648,14 @@ class Product extends CommonObject $sql.= " AND e.entity IN (".getEntity('expedition').")"; $sql.= " AND ed.fk_origin_line = cd.rowid"; $sql.= " AND cd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { $sql.= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { + $sql.= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND e.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND e.fk_soc = ".$socid; } - if ($filtrestatut <> '') { $sql.= " AND c.fk_statut in (".$filtrestatut.")"; + if ($filtrestatut <> '') { + $sql.= " AND c.fk_statut in (".$filtrestatut.")"; } $result = $this->db->query($sql); @@ -2711,16 +2740,19 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE c.rowid = cd.fk_contrat"; $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('contract').")"; $sql.= " AND cd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } //$sql.= " AND c.statut != 0"; - if ($socid > 0) { $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; } $result = $this->db->query($sql); @@ -2757,16 +2789,19 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.rowid = fd.fk_facture"; $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND fd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } //$sql.= " AND f.fk_statut != 0"; - if ($socid > 0) { $sql .= " AND f.fk_soc = ".$socid; + if ($socid > 0) { + $sql .= " AND f.fk_soc = ".$socid; } $result = $this->db->query($sql); @@ -2803,16 +2838,19 @@ class Product extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.rowid = fd.fk_facture_fourn"; $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('facture_fourn').")"; $sql.= " AND fd.fk_product = ".$this->id; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } //$sql.= " AND f.fk_statut != 0"; - if ($socid > 0) { $sql .= " AND f.fk_soc = ".$socid; + if ($socid > 0) { + $sql .= " AND f.fk_soc = ".$socid; } $result = $this->db->query($sql); @@ -2850,9 +2888,11 @@ class Product extends CommonObject while ($i < $num) { $arr = $this->db->fetch_array($resql); - if ($mode == 'byunit') { $tab[$arr[1]] = $arr[0]; // 1st field + if ($mode == 'byunit') { + $tab[$arr[1]] = $arr[0]; // 1st field } - if ($mode == 'bynumber') { $tab[$arr[1]] = $arr[2]; // 3rd field + if ($mode == 'bynumber') { + $tab[$arr[1]] = $arr[2]; // 3rd field } $i++; } @@ -2913,24 +2953,32 @@ class Product extends CommonObject global $user; $sql = "SELECT sum(d.qty), date_format(f.datef, '%Y%m')"; - if ($mode == 'bynumber') { $sql.= ", count(DISTINCT f.rowid)"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT f.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."facturedet as d, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as p"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.rowid = d.fk_facture"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND f.fk_soc = $socid"; + if ($socid > 0) { + $sql.= " AND f.fk_soc = $socid"; } $sql.=$morefilter; $sql.= " GROUP BY date_format(f.datef,'%Y%m')"; @@ -2958,24 +3006,32 @@ class Product extends CommonObject global $user; $sql = "SELECT sum(d.qty), date_format(f.datef, '%Y%m')"; - if ($mode == 'bynumber') { $sql.= ", count(DISTINCT f.rowid)"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT f.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as d, ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as p"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.rowid = d.fk_facture_fourn"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.entity IN (".getEntity('facture_fourn').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND f.fk_soc = $socid"; + if ($socid > 0) { + $sql.= " AND f.fk_soc = $socid"; } $sql.=$morefilter; $sql.= " GROUP BY date_format(f.datef,'%Y%m')"; @@ -3002,24 +3058,32 @@ class Product extends CommonObject global $user; $sql = "SELECT sum(d.qty), date_format(p.datep, '%Y%m')"; - if ($mode == 'bynumber') { $sql.= ", count(DISTINCT p.rowid)"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT p.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as prod"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as prod"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE p.rowid = d.fk_propal"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype; } $sql.= " AND p.fk_soc = s.rowid"; $sql.= " AND p.entity IN (".getEntity('propal').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND p.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND p.fk_soc = ".$socid; } $sql.=$morefilter; $sql.= " GROUP BY date_format(p.datep,'%Y%m')"; @@ -3046,24 +3110,32 @@ class Product extends CommonObject global $user; $sql = "SELECT sum(d.qty), date_format(p.date_valid, '%Y%m')"; - if ($mode == 'bynumber') { $sql.= ", count(DISTINCT p.rowid)"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT p.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d, ".MAIN_DB_PREFIX."supplier_proposal as p, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as prod"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as prod"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE p.rowid = d.fk_supplier_proposal"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND prod.rowid = d.fk_product AND prod.fk_product_type =".$filteronproducttype; } $sql.= " AND p.fk_soc = s.rowid"; $sql.= " AND p.entity IN (".getEntity('supplier_proposal').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND p.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND p.fk_soc = ".$socid; } $sql.=$morefilter; $sql.= " GROUP BY date_format(p.date_valid,'%Y%m')"; @@ -3089,24 +3161,32 @@ class Product extends CommonObject global $conf, $user; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; - if ($mode == 'bynumber') { $sql.= ", count(DISTINCT c.rowid)"; + if ($mode == 'bynumber') { + $sql.= ", count(DISTINCT c.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as d, ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as p"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE c.rowid = d.fk_commande"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('commande').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; } $sql.=$morefilter; $sql.= " GROUP BY date_format(c.date_commande,'%Y%m')"; @@ -3136,21 +3216,28 @@ class Product extends CommonObject $sql.= ", count(DISTINCT c.rowid)"; } $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) { $sql.=", ".MAIN_DB_PREFIX."product as p"; + if ($filteronproducttype >= 0) { + $sql.=", ".MAIN_DB_PREFIX."product as p"; } - if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE c.rowid = d.fk_commande"; - if ($this->id > 0) { $sql.= " AND d.fk_product =".$this->id; - } else { $sql.=" AND d.fk_product > 0"; + if ($this->id > 0) { + $sql.= " AND d.fk_product =".$this->id; + } else { + $sql.=" AND d.fk_product > 0"; } - if ($filteronproducttype >= 0) { $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; + if ($filteronproducttype >= 0) { + $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; } $sql.= " AND c.fk_soc = s.rowid"; $sql.= " AND c.entity IN (".getEntity('supplier_order').")"; - if (!$user->rights->societe->client->voir && !$socid) { $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->societe->client->voir && !$socid) { + $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } - if ($socid > 0) { $sql.= " AND c.fk_soc = ".$socid; + if ($socid > 0) { + $sql.= " AND c.fk_soc = ".$socid; } $sql.=$morefilter; $sql.= " GROUP BY date_format(c.date_commande,'%Y%m')"; @@ -3173,15 +3260,19 @@ class Product extends CommonObject { // phpcs:enable // Clean parameters - if (! is_numeric($id_pere)) { $id_pere=0; + if (! is_numeric($id_pere)) { + $id_pere=0; } - if (! is_numeric($id_fils)) { $id_fils=0; + if (! is_numeric($id_fils)) { + $id_fils=0; } - if (! is_numeric($incdec)) { $incdec=0; + if (! is_numeric($incdec)) { + $incdec=0; } $result=$this->del_sousproduit($id_pere, $id_fils); - if ($result < 0) { return $result; + if ($result < 0) { + return $result; } // Check not already father of id_pere (to avoid father -> child -> father links) @@ -3231,13 +3322,17 @@ class Product extends CommonObject { // phpcs:enable // Clean parameters - if (! is_numeric($id_pere)) { $id_pere=0; + if (! is_numeric($id_pere)) { + $id_pere=0; } - if (! is_numeric($id_fils)) { $id_fils=0; + if (! is_numeric($id_fils)) { + $id_fils=0; } - if (! is_numeric($incdec)) { $incdec=1; + if (! is_numeric($incdec)) { + $incdec=1; } - if (! is_numeric($qty)) { $qty=1; + if (! is_numeric($qty)) { + $qty=1; } $sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association SET '; @@ -3266,9 +3361,11 @@ class Product extends CommonObject public function del_sousproduit($fk_parent, $fk_child) { // phpcs:enable - if (! is_numeric($fk_parent)) { $fk_parent=0; + if (! is_numeric($fk_parent)) { + $fk_parent=0; } - if (! is_numeric($fk_child)) { $fk_child=0; + if (! is_numeric($fk_child)) { + $fk_child=0; } $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association"; @@ -4054,83 +4151,73 @@ class Product extends CommonObject { // phpcs:enable global $conf, $langs; - + $langs->load('products'); if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch"); } - + if ($type == 2) { switch ($mode) { - case 0: - return ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch')); - case 1: - return ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort')); - case 2: - return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2); - case 3: - if ($status == 0) { - return img_picto($langs->trans('ProductStatusNotOnBatch'), 'statut5'); - } - return img_picto($langs->trans('ProductStatusOnBatch'), 'statut4'); - case 4: - return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2); - case 5: - return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2); - default: - return $langs->trans('Unknown'); + case 0: + $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatch') : $langs->trans('ProductStatusOnBatch')); + return dolGetStatus($label); + case 1: + $label = ($status == 0 ? $langs->trans('ProductStatusNotOnBatchShort') : $langs->trans('ProductStatusOnBatchShort')); + return dolGetStatus($label); + case 2: + return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 1, 2); + case 3: + return dolGetStatus($langs->trans('ProductStatusNotOnBatch'), '','',empty($status)?'status5':'status4',3,'dot'); + case 4: + return $this->LibStatut($status, 3, 2).' '.$this->LibStatut($status, 0, 2); + case 5: + return $this->LibStatut($status, 1, 2).' '.$this->LibStatut($status, 3, 2); + default: + return dolGetStatus($langs->trans('Unknown')); } } - if ($mode == 0) { - if ($status == 0) { - return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); - } elseif ($status == 1) { - return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); + + $statuttrans=empty($status)?'status5':'status4'; + + if($status == 0){ + // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" + if($type==0){ + $labelstatut = $langs->trans('ProductStatusNotOnSellShort'); + $labelstatutShort = $langs->trans('ProductStatusNotOnSell'); + } + elseif($type == 1){ + $labelstatut = $langs->trans('ProductStatusNotOnBuyShort'); + $labelstatutShort = $langs->trans('ProductStatusNotOnBuy'); + } + elseif($type == 2){ + $labelstatut = $langs->trans('ProductStatusNotOnBatch'); + $labelstatutShort = $langs->trans('ProductStatusNotOnBatchShort'); } } - elseif ($mode == 1) { - if ($status == 0) { - return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); - } elseif ($status == 1) { - return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); + elseif($status == 1){ + // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" + if($type==0){ + $labelstatut = $langs->trans('ProductStatusOnSellShort'); + $labelstatutShort = $langs->trans('ProductStatusOnSell'); + } + elseif($type == 1){ + $labelstatut = $langs->trans('ProductStatusOnBuyShort'); + $labelstatutShort = $langs->trans('ProductStatusOnBuy'); + } + elseif($type == 2){ + $labelstatut = $langs->trans('ProductStatusOnBatch'); + $labelstatutShort = $langs->trans('ProductStatusOnBatchShort'); } } - elseif ($mode == 2) { - if ($status == 0) { - return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); - } elseif ($status == 1) { - return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); - } + + + if($mode>6){ + return dolGetStatus($langs->trans('Unknown'),'', '', 'status0', 0); } - elseif ($mode == 3) { - if ($status == 0) { - return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); - } elseif ($status == 1) { - return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"'); - } - } - elseif ($mode == 4) { - if ($status == 0) { - return img_picto($langs->trans('ProductStatusNotOnSell'), 'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); - } elseif ($status == 1) { - return img_picto($langs->trans('ProductStatusOnSell'), 'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); - } - } - elseif ($mode == 5) { - if ($status == 0) { - return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); - } elseif ($status == 1) { - return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"'); - } - } - elseif ($mode == 6) { - if ($status == 0) { - return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); - } elseif ($status == 1) { - return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')), 'statut4', 'class="pictostatus"'); - } - } - return $langs->trans('Unknown'); + else{ + return dolGetStatus($labelstatut, $labelstatutShort, '', $statuttrans, $mode); + } } @@ -4695,7 +4782,7 @@ class Product extends CommonObject * * @param Product $object Object product or service * @param string $type Barcode type (ean, isbn, ...) - * @return void + * @return string */ public function get_barcode($object, $type = '') { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index b37a0d31df9..45066e5ccdc 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -797,7 +797,7 @@ if ($resql) // Label if (! empty($arrayfields['p.label']['checked'])) { - print ''.dol_trunc($obj->label, 40).''; + print ''.dol_trunc($obj->label, 70).''; if (! $i) $totalarray['nbfield']++; } @@ -818,7 +818,7 @@ if ($resql) // Duration if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) { - print ''; + print ''; if (preg_match('/([^a-z]+)[a-z]$/i', $obj->duration)) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index f4ee61190e8..ae2150e8464 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -515,7 +515,7 @@ else print ''.$objp->produit.''; print ''; - $valtoshow=price2num($objp->value, 'MS'); + $valtoshow=price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function print empty($valtoshow)?'0':$valtoshow; print ''; $totalunit+=$objp->value; diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 4c5971b8cc4..12cf15110fe 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -274,15 +274,16 @@ class StockMovements extends DolibarrApi + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param MouvementStock $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove useless data diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 18286cea931..e0a05af4226 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -243,15 +243,16 @@ class Warehouses extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Entrepot $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove the subscriptions because they are handled as a subresource. diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 39a9bb94bed..130bece6372 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -88,7 +88,7 @@ class MouvementStock extends CommonObject $this->db = $db; } - + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Add a movement of stock (in one direction only) * @@ -111,9 +111,10 @@ class MouvementStock extends CommonObject * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ - private function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) + public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) { - global $conf, $langs; + // phpcs:disable + global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; @@ -710,34 +711,42 @@ class MouvementStock extends CommonObject * @param date $sellby sell-by date * @param string $batch batch number * @param int $id_product_batch Id product_batch + * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0) + public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode='') { global $conf; $skip_batch = empty($conf->productbatch->enabled); - return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); + return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } /** * Increase stock for product and subproducts * - * @param User $user Object user - * @param int $fk_product Id product - * @param int $entrepot_id Warehouse id - * @param int $qty Quantity - * @param int $price Price - * @param string $label Label of stock movement - * @param date $eatby eat-by date - * @param date $sellby sell-by date - * @param string $batch batch number - * @return int <0 if KO, >0 if OK + * @param User $user Object user + * @param int $fk_product Id product + * @param int $entrepot_id Warehouse id + * @param int $qty Quantity + * @param int $price Price + * @param string $label Label of stock movement + * @param date $eatby eat-by date + * @param date $sellby sell-by date + * @param string $batch batch number + * @param string $datem Force date of movement + * @param int $id_product_batch Id product_batch + * @param string $inventorycode Inventory code + * @return int <0 if KO, >0 if OK */ - public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '') + public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode='') { - return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', '', $eatby, $sellby, $batch); + global $conf; + + $skip_batch = empty($conf->productbatch->enabled); + + return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 532f46ccfe4..9680cd66591 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -534,15 +534,16 @@ class Projects extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->titre); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 40c3e78f7e6..9fafcb98343 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -547,15 +547,16 @@ class Tasks extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->barcode_type); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 34a36e859dc..02bf2679b1b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -74,7 +74,7 @@ class Project extends CommonObject /** * @var string * @deprecated - * @see title + * @see $title */ public $titre; @@ -107,7 +107,7 @@ class Project extends CommonObject /** * @var int Creation date * @deprecated - * @see date_c + * @see $date_c */ public $datec; @@ -119,7 +119,7 @@ class Project extends CommonObject /** * @var int Modification date * @deprecated - * @see date_m + * @see $date_m */ public $datem; @@ -1535,12 +1535,12 @@ class Project extends CommonObject /** * Shift project task date from current date to delta * - * @param timestamp $old_project_dt_start old project start date - * @return int 1 if OK or < 0 if KO + * @param integer $old_project_dt_start Old project start date + * @return int 1 if OK or < 0 if KO */ public function shiftTaskDate($old_project_dt_start) { - global $user,$langs,$conf; + global $user, $langs, $conf; $error=0; diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index b3920480729..aa10dd9f538 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -281,7 +281,7 @@ class ProjectStats extends Stats { $foundintocache=1; - $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate; + $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate; } else { @@ -332,7 +332,7 @@ class ProjectStats extends Stats @chmod($newpathofdestfile, octdec($newmask)); } else dol_syslog("Failed to write cache file", LOG_ERR); - $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; + $this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; } return $data; @@ -401,7 +401,7 @@ class ProjectStats extends Stats if ($filedate >= ($nowgmt - $cachedelay)) { $foundintocache = 1; - $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate; + $this->lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $filedate; } else { dol_syslog(get_class($this) . '::' . __FUNCTION__ . " cache file " . $newpathofdestfile . " is not found or older than now - cachedelay (" . $nowgmt . " - " . $cachedelay . ") so we can't use it."); } @@ -443,7 +443,7 @@ class ProjectStats extends Stats $newmask = $conf->global->MAIN_UMASK; @chmod($newpathofdestfile, octdec($newmask)); - $this->_lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt; + $this->lastfetchdate[get_class($this) . '_' . __FUNCTION__] = $nowgmt; } return $data; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9b393f8a1bf..8ffb6b38831 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -436,7 +436,7 @@ $listofreferent=array( 'table'=>'projet_task', 'datefieldname'=>'task_date', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/projet/tasks.php?id='.$id, + 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?id='.$id, 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->rights->projet->creer, 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 936da02dbb8..de928a95c50 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -34,6 +34,13 @@ if (! defined('NOLOGIN')) define('NOLOGIN', '1'); $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); if (is_numeric($entity)) define("DOLENTITY", $entity); +// Error if CLI mode +if (php_sapi_name() == "cli") +{ + echo "Error: This page can't be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.\n"; + exit(-1); +} + // librarie core // Dolibarr environment require '../../main.inc.php'; @@ -46,6 +53,8 @@ global $langs, $conf; // Language Management $langs->loadLangs(array("admin", "cron")); + + /* * View */ diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index ca29f89d39e..5e241c4edfb 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -45,10 +45,11 @@ $langs->loadLangs(array('companies', 'other', 'ticket', 'errors')); $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'alpha'); -/*************************************************** - * VIEW - * - ****************************************************/ + +/* + * View + */ + $form = new Form($db); $formticket = new FormTicket($db); @@ -62,9 +63,9 @@ if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { print ''; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 13d61bc17ac..bba4d329c24 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -238,7 +238,7 @@ else print '
'; - print ''; + print '
'; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 97fc83a3545..772d8d3fe10 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -379,15 +379,16 @@ class Contacts extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->total_ht); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3cc1dd51b1a..954535d1c87 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1626,14 +1626,16 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->nom); // ->name already defined and nom deprecated diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index fff105d5985..d545a3e1177 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -873,7 +873,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $arrayofstripecard[$companypaymentmodetemp->stripe_card_ref]=$companypaymentmodetemp->stripe_card_ref; - print ''; + print ''; print ''; diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 5e11e81ed3e..036c8ed2ba6 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -169,7 +169,7 @@ class ActionsStripeconnect /** * addMoreActionsButtons * - * @param arra $parameters Parameters + * @param array $parameters Parameters * @param Object $object Object * @param string $action action * @return int 0 diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index c8a161d7b90..933faf3b34a 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -551,7 +551,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -820,7 +820,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 15f4278bf49..5ac77fe85bb 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -190,15 +190,16 @@ class Supplierproposals extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->name); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 9163b718077..e7d21acbc75 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -60,9 +60,16 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); + + if ($conf->global->TAKEPOS_ORDER_NOTES==1) + { + $extrafields = new ExtraFields($db); + $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); + } dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -142,6 +149,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ print ''; + + print ''; } // Payment numpad diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index ce43af774dc..ce2c120b63f 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -30,7 +30,8 @@ require '../main.inc.php'; // Load $user and permissions $langs->loadLangs(array("bills", "cashdesk")); $place = GETPOST('place', 'int'); - +$idline = GETPOST('idline', 'int'); +$action = GETPOST('action'); /* * View @@ -41,16 +42,23 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); ?>
- +trans('Price').'">'; +if ($action=="addnote") echo ''; +?>
diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index 506c067790a..d3152b047a3 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -38,9 +38,6 @@ $query= GETPOST('query', 'alpha'); * View */ -header('Cache-Control: max-age=604800, public, must-revalidate'); -header('Pragma: cache'); - if ($query=="cat") { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -63,7 +60,7 @@ if ($query=="cat") { $filename=$obj['photo']; } - $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); + $file=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); header('Location: '.$file); exit; } @@ -80,7 +77,7 @@ elseif ($query=="pro") preg_match('@src="([^"]+)"@', $image, $match); $file = array_pop($match); if ($file=="") header('Location: ../../public/theme/common/nophoto.png'); - else header('Location: '.$file); + else header('Location: '.$file.'&cache=1'); } else { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ed778f28b50..4d8130daeb4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -120,6 +120,18 @@ if ($action == "freezone") { $invoice->fetch($placeid); } +if ($action == "addnote") { + foreach($invoice->lines as $line) + { + if ($line->id == $number) + { + $line->array_options['order_notes'] = $desc; + $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + } + } + $invoice->fetch($placeid); +} + if ($action == "deleteline") { if ($idline > 0 and $placeid > 0) { //If exist invoice and line, to avoid errors if deleted from other device or no line selected $invoice->deleteline($idline); @@ -185,7 +197,9 @@ if ($action == "order" and $placeid != 0) { if ($count > 0) { $sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='3' where rowid=$line->rowid"; $db->query($sql); - $order_receipt_printer1.= '' . $line->product_label . ''; + $order_receipt_printer1.= '' . $line->product_label . ''; } } @@ -200,7 +214,9 @@ if ($action == "order" and $placeid != 0) { if ($count > 0) { $sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet set special_code='3' where rowid=$line->rowid"; $db->query($sql); - $order_receipt_printer2.= '' . $line->product_label . ''; + $order_receipt_printer2.= '' . $line->product_label . ''; } } @@ -325,7 +341,9 @@ if ($placeid > 0) { print ' order'; } print '" id="' . $line->rowid . '">'; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index fe6bf6b0a19..41f4c99a508 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -246,7 +246,11 @@ function Floors(){ } function FreeZone(){ - $.colorbox({href:"freezone.php?place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"trans("FreeZone");?>"}); + $.colorbox({href:"freezone.php?action=freezone&place="+place, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"trans("FreeZone");?>"}); +} + +function TakeposOrderNotes(){ + $.colorbox({href:"freezone.php?action=addnote&place="+place+"&idline="+selectedline, onClosed: function () { Refresh(); },width:"80%", height:"30%", transition:"none", iframe:"true", title:"trans("OrderNotes");?>"}); } function Refresh(){ @@ -457,6 +461,10 @@ if($conf->global->TAKEPOS_BAR_RESTAURANT){ if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'TakeposPrinting(placeid);'); else $menus[$r++]=array('title'=>$langs->trans("Receipt"),'action'=>'Print(placeid);'); } + if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1){ + $menus[$r++]=array('title'=>$langs->trans("OrderNotes"), + 'action'=>'TakeposOrderNotes();'); + } } if ($conf->global->TAKEPOSCONNECTOR){ diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php new file mode 100644 index 00000000000..7384fffed5f --- /dev/null +++ b/htdocs/theme/eldy/badges.inc.php @@ -0,0 +1,201 @@ + +/*
'; print $companypaymentmodetemp->id; print ''; print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); print '
'; + print $langs->trans("OrderNotes"); + print ''; + print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); + print '
' . $line->qty . '
' . $line->qty; + if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer1.="
(".$line->array_options['options_order_notes'].")"; + $order_receipt_printer1.='
' . $line->qty . '
' . $line->qty; + if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer2.="
(".$line->array_options['options_order_notes'].")"; + $order_receipt_printer2.='
' . $line->product_label . $line->desc . '' . $line->product_label . $line->desc; + if (!empty($line->array_options['options_order_notes'])) echo "
(".$line->array_options['options_order_notes'].")"; + print '
' . $line->qty . '' . price($line->total_ttc) . '