From 386c91790a1661b2719f755f3fcee60f93acf6fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Dec 2023 20:32:08 +0100 Subject: [PATCH 01/28] Fix warning --- htdocs/core/lib/admin.lib.php | 7 ++++--- htdocs/fourn/class/paiementfourn.class.php | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 6ce62e51f77..11e2e36dcfe 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -869,12 +869,13 @@ function security_prepare_head() /** * Prepare array with list of tabs - * @param object $object descriptor class + * + * @param object $object Descriptor class * @return array Array of tabs to show */ function modulehelp_prepare_head($object) { - global $langs, $conf, $user; + global $langs, $conf; $h = 0; $head = array(); @@ -912,7 +913,7 @@ function modulehelp_prepare_head($object) */ function translation_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf; $h = 0; $head = array(); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 00c26f25c56..49f877d0bf3 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -130,7 +130,6 @@ class PaiementFourn extends Paiement $this->date = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp); $this->num_payment = $obj->num_payment; - $this->numero = $obj->num_payment; $this->bank_account = $obj->fk_account; $this->fk_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; From 309b308adc192423aa9f39f66f05c1d119f323bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Dec 2023 20:45:02 +0100 Subject: [PATCH 02/28] Debug php-cs-fixer --- .gitignore | 1 + .php-cs-fixer.dist.php | 2 ++ dev/tools/.gitignore | 1 + dev/tools/run-php-cs-fixer.sh | 8 +++++++- 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 dev/tools/.gitignore mode change 100644 => 100755 dev/tools/run-php-cs-fixer.sh diff --git a/.gitignore b/.gitignore index 4f432c0b674..dabdebc9ca9 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ doc/install.lock /build/phpstan/phpstan /build/phpstan/bootstrap_custom.php phpstan_custom.neon +/.php-cs-fixer.cache diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d145f9e143d..b8709b88a33 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -3,6 +3,8 @@ $finder = (new PhpCsFixer\Finder()) ->in(__DIR__) ->exclude([ + 'documents', + 'htdocs/custom', 'htdocs/includes', ]) ->notPath([ diff --git a/dev/tools/.gitignore b/dev/tools/.gitignore new file mode 100644 index 00000000000..57872d0f1e5 --- /dev/null +++ b/dev/tools/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/dev/tools/run-php-cs-fixer.sh b/dev/tools/run-php-cs-fixer.sh old mode 100644 new mode 100755 index 309e1dfec59..8bd52e34da9 --- a/dev/tools/run-php-cs-fixer.sh +++ b/dev/tools/run-php-cs-fixer.sh @@ -6,7 +6,7 @@ # Optionally set COMPOSER_VENDOR_DIR to your vendor path for composer. # # Run php-cs-fixer by calling this script: -# ./run-php-cs-fixer.sh check # Only checks (the default) +# ./run-php-cs-fixer.sh check # Only checks # ./run-php-cs-fixer.sh fix # Fixes # # You can fix only a few files using @@ -42,6 +42,12 @@ if [ ! -r "${PHP_CS_FIXER}" ] ; then fi +if [ "x$1" = "x" ]; then + echo "***** run-php-cs-fixer.sh *****" + echo "Syntax: run-php-cs-fixer.sh check|fix [path]" + exit 1; +fi + ( cd "${MYDIR}/../.." || exit CMD= From 40c6a5b3e428e7572beffeb7728ee52648908361 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Dec 2023 20:57:54 +0100 Subject: [PATCH 03/28] Debug php-cs-fixer --- .php-cs-fixer.dist.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b8709b88a33..1a713128d4a 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -16,11 +16,19 @@ return (new PhpCsFixer\Config()) ->setRules([ // Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www // '@PSR12' => true, // Disabled for now to limit number of changes + // Minimum version Dolibarr v18.0.0 - '@PHP71Migration' => true, + // Compatibility with min 7.1 is announced with Dolibarr18.0 but + // app is still working with 7.0 so no reason to abandon compatiblity with this target for the moment. + // So we use target PHP70 for the moment. + '@PHP70Migration' => true, + //'@PHP71Migration' => true, + //'strict_param' => true, //'array_syntax' => ['syntax' => 'short'], + //'list_syntax' => false, 'array_syntax' => false, + 'ternary_to_null_coalescing' => false ]) ->setFinder($finder) // TAB Indent violates PSR-12 "must" rule, but used in code From fca403b49bbee1ac7af7f99d34706d44eb8d3afc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Dec 2023 20:57:54 +0100 Subject: [PATCH 04/28] Debug php-cs-fixer --- .php-cs-fixer.dist.php | 10 +++++++++- dev/tools/php-cs-fixer/.gitignore | 1 + dev/tools/{ => php-cs-fixer}/run-php-cs-fixer.sh | 2 +- dev/tools/rector/README.md | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 dev/tools/php-cs-fixer/.gitignore rename dev/tools/{ => php-cs-fixer}/run-php-cs-fixer.sh (97%) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b8709b88a33..1a713128d4a 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -16,11 +16,19 @@ return (new PhpCsFixer\Config()) ->setRules([ // Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www // '@PSR12' => true, // Disabled for now to limit number of changes + // Minimum version Dolibarr v18.0.0 - '@PHP71Migration' => true, + // Compatibility with min 7.1 is announced with Dolibarr18.0 but + // app is still working with 7.0 so no reason to abandon compatiblity with this target for the moment. + // So we use target PHP70 for the moment. + '@PHP70Migration' => true, + //'@PHP71Migration' => true, + //'strict_param' => true, //'array_syntax' => ['syntax' => 'short'], + //'list_syntax' => false, 'array_syntax' => false, + 'ternary_to_null_coalescing' => false ]) ->setFinder($finder) // TAB Indent violates PSR-12 "must" rule, but used in code diff --git a/dev/tools/php-cs-fixer/.gitignore b/dev/tools/php-cs-fixer/.gitignore new file mode 100644 index 00000000000..57872d0f1e5 --- /dev/null +++ b/dev/tools/php-cs-fixer/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/dev/tools/run-php-cs-fixer.sh b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh similarity index 97% rename from dev/tools/run-php-cs-fixer.sh rename to dev/tools/php-cs-fixer/run-php-cs-fixer.sh index 8bd52e34da9..96a3b69cd8f 100755 --- a/dev/tools/run-php-cs-fixer.sh +++ b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh @@ -49,7 +49,7 @@ if [ "x$1" = "x" ]; then fi ( - cd "${MYDIR}/../.." || exit + cd "${MYDIR}/../../.." || exit CMD= # If no argument, run check by default [[ "$1" == "" ]] && CMD=check diff --git a/dev/tools/rector/README.md b/dev/tools/rector/README.md index 859f4bf03c0..c28f7a8d6c5 100644 --- a/dev/tools/rector/README.md +++ b/dev/tools/rector/README.md @@ -13,6 +13,7 @@ Install rector with composer composer install ``` + #### Usage ##### To make changes (Add --dry-run for test mode only) From 31ab27f63197477c542ba1bcb8380b190ca68c3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:10:44 +0100 Subject: [PATCH 05/28] Fix phpcs --- .php-cs-fixer.dist.php | 3 ++- scripts/bank/export-bank-receipts.php | 6 +++--- scripts/contracts/email_expire_services_to_customers.php | 4 ++-- .../contracts/email_expire_services_to_representatives.php | 6 +++--- scripts/emailings/mailing-send.php | 2 +- scripts/invoices/email_unpaid_invoices_to_customers.php | 6 +++--- .../invoices/email_unpaid_invoices_to_representatives.php | 6 +++--- scripts/members/sync_members_ldap2dolibarr.php | 4 ++-- scripts/user/sync_groups_ldap2dolibarr.php | 2 +- scripts/website/migrate-news-joomla2dolibarr.php | 4 +++- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1a713128d4a..c5135d3dab5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -3,6 +3,7 @@ $finder = (new PhpCsFixer\Finder()) ->in(__DIR__) ->exclude([ + 'custom', 'documents', 'htdocs/custom', 'htdocs/includes', @@ -15,7 +16,7 @@ $finder = (new PhpCsFixer\Finder()) return (new PhpCsFixer\Config()) ->setRules([ // Apply PSR-12 as per https://wiki.dolibarr.org/index.php?title=Langages_et_normes#PHP:~:text=utiliser%20est%20le-,PSR%2D12,-(https%3A//www - // '@PSR12' => true, // Disabled for now to limit number of changes + '@PSR12' => true, // Disabled for now to limit number of changes // Minimum version Dolibarr v18.0.0 // Compatibility with min 7.1 is announced with Dolibarr18.0 but diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index a0e896b8064..80a9cea0f42 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -177,7 +177,7 @@ if (!isset($num)) { } $sql .= " AND b.fk_account = ba.rowid"; $sql .= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day - // print $sql; +// print $sql; $resql = $db->query($sql); if ($resql) { @@ -365,7 +365,7 @@ if ($resql) { $debit = $credit = ''; if ($objp->amount < 0) { $totald = $totald + abs($objp->amount); - $debit = price2num($objp->amount * - 1); + $debit = price2num($objp->amount * -1); } else { $totalc = $totalc + abs($objp->amount); $credit = price2num($objp->amount); @@ -411,7 +411,7 @@ if ($resql) { } } else { dol_print_error($db); - $ret = - 1; + $ret = -1; } $db->close(); diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 1fd6d2e09b1..f66df4b011d 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -181,7 +181,7 @@ if ($resql) { $outputlangs->loadLangs(array("main", "contracts", "bills", "products")); if (dol_strlen($newemail)) { - $message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$outputlangs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)."), ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n"; + $message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$outputlangs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)."), ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n"; dol_syslog("email_expire_services_to_customers.php: ".$newemail." ".$message); $foundtoprocess++; } @@ -266,7 +266,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $sendto = $oldemail; $from = $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; - $msgishtml = - 1; + $msgishtml = -1; print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n"; dol_syslog("email_expire_services_to_customers.php: send mail to ".$oldemail); diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index af0f5818e3d..2fb61e73c85 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -136,7 +136,7 @@ if ($resql) { $outputlangs->loadLangs(array("main", "contracts", "bills", "products")); if (dol_strlen($obj->email)) { - $message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency).") ".$obj->name.", ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n"; + $message .= $outputlangs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".dol_concatdesc($obj->plabel, $obj->description)." (".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency).") ".$obj->name.", ".$outputlangs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite), 'day')."\n\n"; dol_syslog("email_expire_services_to_representatives.php: ".$obj->email); $foundtoprocess++; } @@ -215,7 +215,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $sendto = $oldemail; $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; - $msgishtml = - 1; + $msgishtml = -1; print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n"; dol_syslog("email_expire_services_to_representatives.php: send mail to ".$oldemail); @@ -236,7 +236,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $allmessage .= $newlangs->transnoentities("NoteListOfYourExpiredServices").($usehtml ? "
\n" : "\n").($usehtml ? "
\n" : "\n"); } $allmessage .= $message.($usehtml ? "
\n" : "\n"); - $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, - 1, $conf->currency).($usehtml ? "
\n" : "\n"); + $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "
\n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER')) { $allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER; if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER)) { diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 3b1daded389..d24b3dfcd15 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -137,7 +137,7 @@ if ($resql) { $replyto = $emailing->email_replyto; $errorsto = $emailing->email_errorsto; // Le message est-il en html - $msgishtml = - 1; // Unknown by default + $msgishtml = -1; // Unknown by default if (preg_match('/[\s\t]*/i', $message)) { $msgishtml = 1; } diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index de44ab3049a..6d51a2bd24a 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -184,7 +184,7 @@ if ($resql) { $outputlangs->loadLangs(array("main", "bills")); if (dol_strlen($newemail)) { - $message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)."\n"; + $message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)."\n"; dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message); $foundtoprocess++; } @@ -258,7 +258,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $sendto = $oldemail; $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; - $msgishtml = - 1; + $msgishtml = -1; print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n"; dol_syslog("email_unpaid_invoices_to_customers.php: send mail to ".$oldemail); @@ -280,7 +280,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $allmessage .= "Note: This list contains only unpaid invoices.".($usehtml ? "
\n" : "\n"); } $allmessage .= $message.($usehtml ? "
\n" : "\n"); - $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, - 1, $conf->currency).($usehtml ? "
\n" : "\n"); + $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "
\n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER')) { $allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER; if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) { diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 4a3e982fc08..058966e6a2b 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -146,7 +146,7 @@ if ($resql) { $outputlangs->loadLangs(array("main", "bills")); if (dol_strlen($obj->email)) { - $message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, - 1, $conf->currency)." : ".$obj->name."\n"; + $message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency)." : ".$obj->name."\n"; dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email); $foundtoprocess++; } @@ -214,7 +214,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $sendto = $oldemail; $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; - $msgishtml = - 1; + $msgishtml = -1; print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n"; dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail); @@ -235,7 +235,7 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $allmessage .= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml ? "
\n" : "\n"); } $allmessage .= $message.($usehtml ? "
\n" : "\n"); - $allmessage .= $langs->trans("Total")." = ".price($total, 0, $newlangs, 0, 0, - 1, $conf->currency).($usehtml ? "
\n" : "\n"); + $allmessage .= $langs->trans("Total")." = ".price($total, 0, $newlangs, 0, 0, -1, $conf->currency).($usehtml ? "
\n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER')) { $allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER; if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) { diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 3c483a0a548..d0496c9d7c0 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -225,7 +225,7 @@ if ($result >= 0) { $member->public = 1; $member->birth = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_BIRTHDATE')]); - $member->statut = - 1; + $member->statut = -1; if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) { $member->datec = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')]); $member->datevalid = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')]); @@ -263,7 +263,7 @@ if ($result >= 0) { $datelast = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE')]); $pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]); } elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) { - $datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')]), - 1, 'y') + 60 * 60 * 24; + $datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')]), -1, 'y') + 60 * 60 * 24; $pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]); // Cas special ou date derniere <= date premiere diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 5c09fd99880..fd718d132d0 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -181,7 +181,7 @@ if ($result >= 0) { continue; } if (empty($userList[$userdn])) { // Récupération de l'utilisateur - // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement + // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement if (getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS') === 'memberUid') { $userKey = array($userdn); } else { // Pour les autres schémas, les membres sont listés sous forme de DN complets diff --git a/scripts/website/migrate-news-joomla2dolibarr.php b/scripts/website/migrate-news-joomla2dolibarr.php index bb02274a6a3..237ff9919aa 100755 --- a/scripts/website/migrate-news-joomla2dolibarr.php +++ b/scripts/website/migrate-news-joomla2dolibarr.php @@ -126,7 +126,9 @@ if ($blogpostfooter === false) { $db->begin(); -$i = 0; $nbimported = 0; $nbalreadyexists = 0; +$i = 0; +$nbimported = 0; +$nbalreadyexists = 0; while ($obj = $dbjoomla->fetch_object($resql)) { if ($obj) { $i++; From 697c8d14b77932c306ff17dd81fba89879edbf37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:16:54 +0100 Subject: [PATCH 06/28] Fix phpcs --- build/dmg/dolimamp/install.forced.php | 31 +++++------ build/generate_filelist_xml.php | 74 +++++++++++++-------------- build/phpstan/bootstrap.php | 9 +++- build/rpm/conf.php | 1 + 4 files changed, 61 insertions(+), 54 deletions(-) diff --git a/build/dmg/dolimamp/install.forced.php b/build/dmg/dolimamp/install.forced.php index 31d0b5ae685..45a9875e78a 100644 --- a/build/dmg/dolimamp/install.forced.php +++ b/build/dmg/dolimamp/install.forced.php @@ -1,16 +1,17 @@ $tmp) { print "\n"; //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; -$outputdir=dirname(dirname(__FILE__)).'/htdocs/install'; +$outputdir = dirname(dirname(__FILE__)).'/htdocs/install'; print 'Delete current files '.$outputdir.'/filelist*.xml*'."\n"; dol_delete_file($outputdir.'/filelist*.xml*', 0, 1, 1); -$checksumconcat=array(); +$checksumconcat = array(); -$outputfile=$outputdir.'/filelist-'.$release.'.xml'; +$outputfile = $outputdir.'/filelist-'.$release.'.xml'; $fp = fopen($outputfile, 'w'); if (empty($fp)) { print 'Failed to open file '.$outputfile."\n"; @@ -156,8 +156,8 @@ fputs($fp, ''."\n"); foreach ($tmp as $constname => $constvalue) { - $valueforchecksum=(empty($constvalue)?'0':$constvalue); - $checksumconcat[]=$valueforchecksum; + $valueforchecksum = (empty($constvalue) ? '0' : $constvalue); + $checksumconcat[] = $valueforchecksum; fputs($fp, ' '.$valueforchecksum.''."\n"); } fputs($fp, ''."\n"); @@ -172,26 +172,26 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom */ // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php) $regextoinclude = '\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude = '('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); -$dir=''; -$needtoclose=0; +$dir = ''; +$needtoclose = 0; foreach ($files as $filetmp) { $file = $filetmp['fullname']; //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); - if ($newdir!=$dir) { + if ($newdir != $dir) { if ($needtoclose) { fputs($fp, ' '."\n"); } fputs($fp, ' '."\n"); $dir = $newdir; - $needtoclose=1; + $needtoclose = 1; } - if (filetype($file)=="file") { - $md5=md5_file($file); - $checksumconcat[]=$md5; + if (filetype($file) == "file") { + $md5 = md5_file($file); + $checksumconcat[] = $md5; fputs($fp, ' '.$md5.''."\n"); } } @@ -205,7 +205,7 @@ fputs($fp, md5(join(',', $checksumconcat))."\n"); fputs($fp, ''."\n"); -$checksumconcat=array(); +$checksumconcat = array(); fputs($fp, ''."\n"); @@ -215,27 +215,27 @@ $iterator2 = new RecursiveIteratorIterator($dir_iterator2); // Need to ignore document custom etc. Note: this also ignore natively symbolic links. $files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); */ -$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; -$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs +$regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; +$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs $files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); -$dir=''; -$needtoclose=0; +$dir = ''; +$needtoclose = 0; foreach ($files as $filetmp) { $file = $filetmp['fullname']; //$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); $newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); - if ($newdir!=$dir) { + if ($newdir != $dir) { if ($needtoclose) { fputs($fp, ' '."\n"); } fputs($fp, ' '."\n"); $dir = $newdir; - $needtoclose=1; + $needtoclose = 1; } - if (filetype($file)=="file") { - $md5=md5_file($file); - $checksumconcat[]=$md5; + if (filetype($file) == "file") { + $md5 = md5_file($file); + $checksumconcat[] = $md5; fputs($fp, ' '.$md5.''."\n"); } } diff --git a/build/phpstan/bootstrap.php b/build/phpstan/bootstrap.php index 8883bb158a5..2d5eab1c4e6 100644 --- a/build/phpstan/bootstrap.php +++ b/build/phpstan/bootstrap.php @@ -1,11 +1,16 @@ Date: Mon, 4 Dec 2023 10:22:29 +0100 Subject: [PATCH 07/28] Fix phpcs --- dev/tools/apstats.php | 8 +-- dev/tools/dolibarr-postgres2mysql.php | 34 +++++------ dev/tools/spider.php | 88 +++++++++++++++------------ 3 files changed, 70 insertions(+), 60 deletions(-) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index ed23307cf8a..e15c8b5ace2 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -34,7 +34,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit(); } -error_reporting(E_ALL & ~ E_DEPRECATED); +error_reporting(E_ALL & ~E_DEPRECATED); define('PRODUCT', "apstats"); define('VERSION', "1.0"); @@ -51,7 +51,7 @@ $outputpath = $argv[1]; $outputdir = dirname($outputpath); $outputfile = basename($outputpath); -if (! is_dir($outputdir)) { +if (!is_dir($outputdir)) { print 'Error: dir '.$outputdir.' does not exists or is not writable'."\n"; exit(1); } @@ -111,8 +111,8 @@ exec($commandcheck, $output_arrtd, $resexectd); $arrayoflineofcode = array(); $arraycocomo = array(); $arrayofmetrics = array( - 'proj'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0), - 'dep'=>array('Bytes'=>0, 'Files'=>0, 'Lines'=>0, 'Blanks'=>0, 'Comments'=>0, 'Code'=>0, 'Complexity'=>0) + 'proj' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0), + 'dep' => array('Bytes' => 0, 'Files' => 0, 'Lines' => 0, 'Blanks' => 0, 'Comments' => 0, 'Code' => 0, 'Complexity' => 0) ); // Analyse $output_arrproj diff --git a/dev/tools/dolibarr-postgres2mysql.php b/dev/tools/dolibarr-postgres2mysql.php index 659f6bd73dd..b69d83ab510 100644 --- a/dev/tools/dolibarr-postgres2mysql.php +++ b/dev/tools/dolibarr-postgres2mysql.php @@ -37,14 +37,14 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit(); } -error_reporting(E_ALL & ~ E_DEPRECATED); +error_reporting(E_ALL & ~E_DEPRECATED); define('PRODUCT', "pg2mysql"); define('VERSION', "2.0"); // this is the default, it can be overridden here, or specified as the third parameter on the command line $config['engine'] = "InnoDB"; -if (! ($argv[1] && $argv[2])) { +if (!($argv[1] && $argv[2])) { echo "Usage: php pg2mysql_cli.php [engine]\n"; exit(); } else { @@ -141,7 +141,7 @@ function pg2mysql_large($infilename, $outfilename) echo "Filesize: " . formatsize($fs) . "\n"; while ($instr = fgets($infp)) { - $linenum ++; + $linenum++; $memusage = round(memory_get_usage(true) / 1024 / 1024); $len = strlen($instr); $pgsqlchunk[] = $instr; @@ -163,7 +163,7 @@ function pg2mysql_large($infilename, $outfilename) } if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) { - $chunkcount ++; + $chunkcount++; if ($linenum % 10000 == 0) { $currentpos = ftell($infp); @@ -302,7 +302,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n"; } $output .= $line; - $linenumber ++; + $linenumber++; continue; } @@ -313,7 +313,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $output .= $tbl_extra; $output .= $line; - $linenumber ++; + $linenumber++; $tbl_extra = ""; continue; } @@ -395,10 +395,10 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) if (strstr($line, " CONSTRAINT ")) { $line = ""; // and if the previous output ended with a , remove the , - $lastchr = substr($output, - 2, 1); + $lastchr = substr($output, -2, 1); // echo "lastchr=$lastchr"; if ($lastchr == ",") { - $output = substr($output, 0, - 2) . "\n"; + $output = substr($output, 0, -2) . "\n"; } } @@ -408,9 +408,9 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) if (substr($line, 0, 11) == "INSERT INTO") { $line = str_replace('public.', '', $line); - if (substr($line, - 3, - 1) == ");") { + if (substr($line, -3, -1) == ");") { // we have a complete insert on one line - list ($before, $after) = explode(" VALUES ", $line, 2); + list($before, $after) = explode(" VALUES ", $line, 2); // we only replace the " with ` in what comes BEFORE the VALUES // (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2'); // should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2'); @@ -424,13 +424,13 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $after = str_replace(", E'", ", '", $after); $output .= $before . " VALUES " . $after; - $linenumber ++; + $linenumber++; continue; } else { // this insert spans multiple lines, so keep dumping the lines until we reach a line // that ends with ");" - list ($before, $after) = explode(" VALUES ", $line, 2); + list($before, $after) = explode(" VALUES ", $line, 2); // we only replace the " with ` in what comes BEFORE the VALUES // (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2'); // should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2'); @@ -453,7 +453,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $output .= $before . " VALUES " . $after; do { - $linenumber ++; + $linenumber++; // in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string') // ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character @@ -477,7 +477,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) } // echo "inquotes=$inquotes\n"; } - } while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes); + } while (substr($lines[$linenumber], -3, -1) != ");" || $inquotes); } } if (substr($line, 0, 16) == "ALTER TABLE ONLY") { @@ -486,14 +486,14 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $line = str_replace("public.", "", $line); $pkey = $line; - $linenumber ++; + $linenumber++; if (!empty($lines[$linenumber])) { $line = $lines[$linenumber]; } else { $line = ''; } - if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") { + if (strstr($line, " PRIMARY KEY ") && substr($line, -3, -1) == ");") { $reg2 = array(); if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) { if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) { @@ -580,7 +580,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) } } - $linenumber ++; + $linenumber++; } return array('output' => $output,'outputatend' => $outputatend); diff --git a/dev/tools/spider.php b/dev/tools/spider.php index 3278d3a7715..28871122e2c 100644 --- a/dev/tools/spider.php +++ b/dev/tools/spider.php @@ -24,8 +24,8 @@ * - Exclude param optioncss, token, sortfield, sortorder */ -$crawledLinks=array(); -const MAX_DEPTH=2; +$crawledLinks = array(); +const MAX_DEPTH = 2; /** @@ -36,35 +36,38 @@ const MAX_DEPTH=2; function followLink($url, $depth = 0) { global $crawledLinks; - $crawling=array(); - if ($depth>MAX_DEPTH) { + $crawling = array(); + if ($depth > MAX_DEPTH) { echo "
The Crawler is giving up!
"; return; } - $options=array( - 'http'=>array( - 'method'=>"GET", - 'user-agent'=>"gfgBot/0.1\n" + $options = array( + 'http' => array( + 'method' => "GET", + 'user-agent' => "gfgBot/0.1\n" ) ); - $context=stream_context_create($options); - $doc=new DomDocument(); + $context = stream_context_create($options); + $doc = new DomDocument(); @$doc->loadHTML(file_get_contents($url, false, $context)); - $links=$doc->getElementsByTagName('a'); - $pageTitle=getDocTitle($doc, $url); - $metaData=getDocMetaData($doc); + $links = $doc->getElementsByTagName('a'); + $pageTitle = getDocTitle($doc, $url); + $metaData = getDocMetaData($doc); foreach ($links as $i) { - $link=$i->getAttribute('href'); - if (ignoreLink($link)) continue; - $link=convertLink($url, $link); + $link = $i->getAttribute('href'); + if (ignoreLink($link)) { + continue; + } + $link = convertLink($url, $link); if (!in_array($link, $crawledLinks)) { - $crawledLinks[]=$link; - $crawling[]=$link; + $crawledLinks[] = $link; + $crawling[] = $link; insertIntoDatabase($link, $pageTitle, $metaData, $depth); } } - foreach ($crawling as $crawlURL) - followLink($crawlURL, $depth+1); + foreach ($crawling as $crawlURL) { + followLink($crawlURL, $depth + 1); + } } /** @@ -74,14 +77,16 @@ function followLink($url, $depth = 0) */ function convertLink($site, $path) { - if (substr_compare($path, "//", 0, 2)==0) + if (substr_compare($path, "//", 0, 2) == 0) { return parse_url($site)['scheme'].$path; - elseif (substr_compare($path, "http://", 0, 7)==0 - or substr_compare($path, "https://", 0, 8)==0 - or substr_compare($path, "www.", 0, 4)==0 - ) + } elseif (substr_compare($path, "http://", 0, 7) == 0 + or substr_compare($path, "https://", 0, 8) == 0 + or substr_compare($path, "www.", 0, 4) == 0 + ) { return $path; - else return $site.'/'.$path; + } else { + return $site.'/'.$path; + } } /** @@ -90,7 +95,7 @@ function convertLink($site, $path) */ function ignoreLink($url) { - return $url[0]=="#" or substr($url, 0, 11) == "javascript:"; + return $url[0] == "#" or substr($url, 0, 11) == "javascript:"; } /** @@ -116,11 +121,12 @@ function insertIntoDatabase($link, $title, &$metaData, $depth) */ function getDocTitle(&$doc, $url) { - $titleNodes=$doc->getElementsByTagName('title'); - if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue)) + $titleNodes = $doc->getElementsByTagName('title'); + if (count($titleNodes) == 0 or !isset($titleNodes[0]->nodeValue)) { return $url; - $title=str_replace('', '\n', $titleNodes[0]->nodeValue); - return (strlen($title)<1)?$url:$title; + } + $title = str_replace('', '\n', $titleNodes[0]->nodeValue); + return (strlen($title) < 1) ? $url : $title; } /** @@ -129,16 +135,20 @@ function getDocTitle(&$doc, $url) */ function getDocMetaData(&$doc) { - $metaData=array(); - $metaNodes=$doc->getElementsByTagName('meta'); - foreach ($metaNodes as $node) + $metaData = array(); + $metaNodes = $doc->getElementsByTagName('meta'); + foreach ($metaNodes as $node) { $metaData[$node->getAttribute("name")] = $node->getAttribute("content"); - if (!isset($metaData['description'])) - $metaData['description']='No Description Available'; - if (!isset($metaData['keywords'])) $metaData['keywords']=''; + } + if (!isset($metaData['description'])) { + $metaData['description'] = 'No Description Available'; + } + if (!isset($metaData['keywords'])) { + $metaData['keywords'] = ''; + } return array( - 'keywords'=>str_replace('', '\n', $metaData['keywords']), - 'description'=>str_replace('', '\n', $metaData['description']) + 'keywords' => str_replace('', '\n', $metaData['keywords']), + 'description' => str_replace('', '\n', $metaData['description']) ); } From 23c6b59818f6b58cbf62d94ca5d6ad1fea5ae35e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:23:11 +0100 Subject: [PATCH 08/28] Fix phpcs --- .../src/Renaming/EmptyGlobalToFunction.php | 12 +++++----- .../rector/src/Renaming/GlobalToFunction.php | 22 ++++++++++--------- .../src/Renaming/UserRightsToFunction.php | 6 ++--- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php b/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php index 9af29f4fc1b..0bd1575adcd 100644 --- a/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/EmptyGlobalToFunction.php @@ -53,9 +53,11 @@ class EmptyGlobalToFunction extends AbstractRector { return new RuleDefinition( 'Change $conf->global to getDolGlobal', - [new CodeSample('$conf->global->CONSTANT', + [new CodeSample( + '$conf->global->CONSTANT', 'getDolGlobalInt(\'CONSTANT\')' - )]); + )] + ); } /** @@ -106,7 +108,7 @@ class EmptyGlobalToFunction extends AbstractRector return new FuncCall( new Name('getDolGlobalString'), [new Arg($constName)] - ); + ); } @@ -136,7 +138,7 @@ class EmptyGlobalToFunction extends AbstractRector return new BooleanNot(new FuncCall( new Name('getDolGlobalString'), [new Arg($constName)] - )); + )); } return null; @@ -169,7 +171,7 @@ class EmptyGlobalToFunction extends AbstractRector } return \true; } - ); + ); } /** diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index 7cf89d24f4c..d20c2867cdb 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -56,9 +56,11 @@ class GlobalToFunction extends AbstractRector { return new RuleDefinition( 'Change $conf->global to getDolGlobal', - [new CodeSample('$conf->global->CONSTANT', + [new CodeSample( + '$conf->global->CONSTANT', 'getDolGlobalInt(\'CONSTANT\')' - )]); + )] + ); } /** @@ -188,36 +190,36 @@ class GlobalToFunction extends AbstractRector new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'GreaterOrEqual') { return new GreaterOrEqual( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'Smaller') { return new Smaller( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } if ($typeofcomparison == 'SmallerOrEqual') { return new SmallerOrEqual( new FuncCall( new Name($funcName), [new Arg($constName)] - ), + ), $node->right - ); + ); } } diff --git a/dev/tools/rector/src/Renaming/UserRightsToFunction.php b/dev/tools/rector/src/Renaming/UserRightsToFunction.php index fbb8edfb594..dd93fbdc4d5 100644 --- a/dev/tools/rector/src/Renaming/UserRightsToFunction.php +++ b/dev/tools/rector/src/Renaming/UserRightsToFunction.php @@ -2,7 +2,6 @@ namespace Dolibarr\Rector\Renaming; - use PhpParser\Node; use PhpParser\Node\Arg; use PhpParser\Node\Scalar\String_; @@ -36,7 +35,8 @@ class UserRightsToFunction extends AbstractRector [new CodeSample( '$user->rights->module->permission', '$user->hasRight(\'module\', \'permission\')' - )]); + )] + ); } /** @@ -122,7 +122,7 @@ class UserRightsToFunction extends AbstractRector return null; } // Add a test to avoid rector error on html.formsetup.class.php - if (! $node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) { + if (!$node->name instanceof Node\Expr\Variable && is_null($this->getName($node))) { //var_dump($node); return null; //exit; From fa594ab7794453b8e27f7fc0a2c3ce940361171f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:24:06 +0100 Subject: [PATCH 09/28] fix phpcs --- dev/initdemo/sftpget_and_loaddump.php | 81 ++++++++++++------------ dev/initdemo/updatedemo.php | 88 +++++++++++++-------------- 2 files changed, 85 insertions(+), 84 deletions(-) diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 63b5ac65054..5c940496f45 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -21,7 +21,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -30,39 +30,39 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$error=0; +$error = 0; -$sourceserver=isset($argv[1])?$argv[1]:''; // user@server:/src/file -$password=isset($argv[2])?$argv[2]:''; -$dataserver=isset($argv[3])?$argv[3]:''; -$database=isset($argv[4])?$argv[4]:''; -$loginbase=isset($argv[5])?$argv[5]:''; -$passwordbase=isset($argv[6])?$argv[6]:''; +$sourceserver = isset($argv[1]) ? $argv[1] : ''; // user@server:/src/file +$password = isset($argv[2]) ? $argv[2] : ''; +$dataserver = isset($argv[3]) ? $argv[3] : ''; +$database = isset($argv[4]) ? $argv[4] : ''; +$loginbase = isset($argv[5]) ? $argv[5] : ''; +$passwordbase = isset($argv[6]) ? $argv[6] : ''; // Include Dolibarr environment -$res=0; -if (! $res && file_exists($path."../../master.inc.php")) { - $res=@include $path."../../master.inc.php"; +$res = 0; +if (!$res && file_exists($path."../../master.inc.php")) { + $res = @include $path."../../master.inc.php"; } -if (! $res && file_exists($path."../../htdocs/master.inc.php")) { - $res=@include $path."../../htdocs/master.inc.php"; +if (!$res && file_exists($path."../../htdocs/master.inc.php")) { + $res = @include $path."../../htdocs/master.inc.php"; } -if (! $res && file_exists("../master.inc.php")) { - $res=@include "../master.inc.php"; +if (!$res && file_exists("../master.inc.php")) { + $res = @include "../master.inc.php"; } -if (! $res && file_exists("../../master.inc.php")) { - $res=@include "../../master.inc.php"; +if (!$res && file_exists("../../master.inc.php")) { + $res = @include "../../master.inc.php"; } -if (! $res && file_exists("../../../master.inc.php")) { - $res=@include "../../../master.inc.php"; +if (!$res && file_exists("../../../master.inc.php")) { + $res = @include "../../../master.inc.php"; } -if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { - $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { + $res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only } -if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { - $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { + $res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only } -if (! $res) { +if (!$res) { die("Failed to include master.inc.php file\n"); } include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -72,13 +72,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; * Main */ -$login=''; -$server=''; +$login = ''; +$server = ''; if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg)) { - $login=$reg[1]; - $server=$reg[2]; - $sourcefile=$reg[3]; - $targetfile=basename($sourcefile); + $login = $reg[1]; + $server = $reg[2]; + $sourcefile = $reg[3]; + $targetfile = basename($sourcefile); } if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase)) { print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n"; @@ -88,22 +88,23 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile } -$targetdir='/tmp'; +$targetdir = '/tmp'; print "Get dump file from server ".$server.", path ".$sourcefile.", connect with login ".$login." loaded into localhost\n"; -$sftpconnectstring=$sourceserver; +$sftpconnectstring = $sourceserver; print 'SFTP connect string : '.$sftpconnectstring."\n"; //print 'SFTP password '.$password."\n"; // SFTP connect -if (! function_exists("ssh2_connect")) { - dol_print_error('', 'ssh2_connect function does not exists'); exit(1); +if (!function_exists("ssh2_connect")) { + dol_print_error('', 'ssh2_connect function does not exists'); + exit(1); } $connection = ssh2_connect($server, 22); if ($connection) { - if (! @ssh2_auth_password($connection, $login, $password)) { + if (!@ssh2_auth_password($connection, $login, $password)) { dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR); exit(-5); } else { @@ -121,16 +122,16 @@ if ($connection) { print 'Get file '.$sourcefile.' into '.$targetdir.$targetfile."\n"; ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile); - $fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; + $fullcommand = "cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; if (preg_match('/\.bz2$/', $targetfile)) { - $fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; + $fullcommand = "bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; } if (preg_match('/\.gz$/', $targetfile)) { - $fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; + $fullcommand = "gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database; } print "Load dump with ".$fullcommand."\n"; - $output=array(); - $return_var=0; + $output = array(); + $return_var = 0; print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n"; exec($fullcommand, $output, $return_var); foreach ($output as $line) { diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 37e6189c559..98e33835589 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -21,7 +21,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -30,34 +30,34 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$error=0; +$error = 0; -$confirm=isset($argv[1])?$argv[1]:''; +$confirm = isset($argv[1]) ? $argv[1] : ''; // Include Dolibarr environment -$res=0; -if (! $res && file_exists($path."../../master.inc.php")) { - $res=@include $path."../../master.inc.php"; +$res = 0; +if (!$res && file_exists($path."../../master.inc.php")) { + $res = @include $path."../../master.inc.php"; } -if (! $res && file_exists($path."../../htdocs/master.inc.php")) { - $res=@include $path."../../htdocs/master.inc.php"; +if (!$res && file_exists($path."../../htdocs/master.inc.php")) { + $res = @include $path."../../htdocs/master.inc.php"; } -if (! $res && file_exists("../master.inc.php")) { - $res=@include "../master.inc.php"; +if (!$res && file_exists("../master.inc.php")) { + $res = @include "../master.inc.php"; } -if (! $res && file_exists("../../master.inc.php")) { - $res=@include "../../master.inc.php"; +if (!$res && file_exists("../../master.inc.php")) { + $res = @include "../../master.inc.php"; } -if (! $res && file_exists("../../../master.inc.php")) { - $res=@include "../../../master.inc.php"; +if (!$res && file_exists("../../../master.inc.php")) { + $res = @include "../../../master.inc.php"; } -if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { - $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { + $res = @include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only } -if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { - $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only +if (!$res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) { + $res = @include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only } -if (! $res) { +if (!$res) { die("Failed to include master.inc.php file\n"); } include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -76,56 +76,56 @@ if (empty($confirm)) { } -$tmp=dol_getdate(dol_now()); +$tmp = dol_getdate(dol_now()); -$tables=array( - 'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'), - 'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'), - 'facture'=>array(0=>'datec', 1=>'datef', 2=>'date_valid', 3=>'date_lim_reglement'), - 'paiement'=>array(0=>'datep'), - 'bank'=>array(0=>'datev', 1=>'dateo'), - 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'), - 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'), - 'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'), - 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'), - 'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close') +$tables = array( + 'propal' => array(0 => 'datep', 1 => 'fin_validite', 2 => 'date_valid', 3 => 'date_cloture'), + 'commande' => array(0 => 'date_commande', 1 => 'date_valid', 2 => 'date_cloture'), + 'facture' => array(0 => 'datec', 1 => 'datef', 2 => 'date_valid', 3 => 'date_lim_reglement'), + 'paiement' => array(0 => 'datep'), + 'bank' => array(0 => 'datev', 1 => 'dateo'), + 'commande_fournisseur' => array(0 => 'date_commande', 1 => 'date_valid', 3 => 'date_creation', 4 => 'date_approve', 5 => 'date_approve2', 6 => 'date_livraison'), + 'supplier_proposal' => array(0 => 'datec', 1 => 'date_valid', 2 => 'date_cloture'), + 'expensereport' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 4 => 'date_approve', 5 => 'date_refuse', 6 => 'date_cancel'), + 'holiday' => array(0 => 'date_debut', 1 => 'date_fin', 2 => 'date_create', 3 => 'date_valid', 5 => 'date_refuse', 6 => 'date_cancel'), + 'ticket' => array(0 => 'datec', 1 => 'date_read', 2 => 'date_close') ); -$year=2010; -$currentyear=$tmp['year']; +$year = 2010; +$currentyear = $tmp['year']; while ($year <= $currentyear) { //$year=2021; - $delta1=($currentyear - $year); - $delta2=($currentyear - $year - 1); + $delta1 = ($currentyear - $year); + $delta2 = ($currentyear - $year - 1); //$delta=-1; if ($delta1) { foreach ($tables as $tablekey => $tableval) { print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." "; - $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)"; + $sql = "select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)"; //$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num) { - $obj=$db->fetch_object($resql); + $obj = $db->fetch_object($resql); if ($obj) { print "."; - $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set "; - $j=0; + $sql2 = "UPDATE ".MAIN_DB_PREFIX.$tablekey." set "; + $j = 0; foreach ($tableval as $field) { if ($j) { - $sql2.=", "; + $sql2 .= ", "; } - $sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)"); + $sql2 .= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)"); $j++; } - $sql2.=" WHERE rowid = ".$obj->rowid; + $sql2 .= " WHERE rowid = ".$obj->rowid; //print $sql2."\n"; $resql2 = $db->query($sql2); - if (! $resql2) { + if (!$resql2) { dol_print_error($db); } } From 085f6e26f39919335c23370c0658735b201c4b62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 10:25:02 +0100 Subject: [PATCH 10/28] Fix phpcs --- dev/examples/code/create_invoice.php | 32 ++++++++++++++-------------- dev/examples/code/create_order.php | 26 +++++++++++----------- dev/examples/code/create_product.php | 14 ++++++------ dev/examples/code/create_user.php | 18 ++++++++-------- dev/examples/code/get_contracts.php | 16 +++++++------- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index 0278f0c3bef..3d3313ed3a3 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -25,7 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$version='1.7'; -$error=0; +$version = '1.7'; +$error = 0; // -------------------- START OF YOUR CODE HERE -------------------- @@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language @set_time_limit(0); // Load user and its permissions -$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. -if (! $result > 0) { +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (!$result > 0) { dol_print_error('', $user->error); exit; } @@ -74,20 +74,20 @@ $obj->note_public = 'A public comment'; $obj->note_private = 'A private comment'; $obj->cond_reglement_id = 1; -$line1=new FactureLigne($db); -$line1->tva_tx=10.0; -$line1->remise_percent=0; -$line1->qty=1; -$line1->total_ht=100; -$line1->total_tva=10; -$line1->total_ttc=110; -$obj->lines[]=$line1; +$line1 = new FactureLigne($db); +$line1->tva_tx = 10.0; +$line1->remise_percent = 0; +$line1->qty = 1; +$line1->total_ht = 100; +$line1->total_tva = 10; +$line1->total_ttc = 110; +$obj->lines[] = $line1; // Create invoice -$idobject=$obj->create($user); +$idobject = $obj->create($user); if ($idobject > 0) { // Change status to validated - $result=$obj->validate($user); + $result = $obj->validate($user); if ($result > 0) { print "OK Object created with id ".$idobject."\n"; } else { @@ -102,7 +102,7 @@ if ($idobject > 0) { // -------------------- END OF YOUR CODE -------------------- -if (! $error) { +if (!$error) { $db->commit(); print '--- end ok'."\n"; } else { diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index 6d43e323191..1a6b3d04dc4 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -25,7 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$version='1.11'; -$error=0; +$version = '1.11'; +$error = 0; // -------------------- START OF YOUR CODE HERE -------------------- @@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language @set_time_limit(0); // Load user and its permissions -$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. -if (! $result > 0) { +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (!$result > 0) { dol_print_error('', $user->error); exit; } @@ -75,17 +75,17 @@ $com->note_private = 'A private comment'; $com->source = 1; $com->remise_percent = 0; -$orderline1=new OrderLine($db); -$orderline1->tva_tx=10.0; -$orderline1->remise_percent=0; -$orderline1->qty=1; -$com->lines[]=$orderline1; +$orderline1 = new OrderLine($db); +$orderline1->tva_tx = 10.0; +$orderline1->remise_percent = 0; +$orderline1->qty = 1; +$com->lines[] = $orderline1; // Create order -$idobject=$com->create($user); +$idobject = $com->create($user); if ($idobject > 0) { // Change status to validated - $result=$com->valid($user); + $result = $com->valid($user); if ($result > 0) { print "OK Object created with id ".$idobject."\n"; } else { @@ -100,7 +100,7 @@ if ($idobject > 0) { // -------------------- END OF YOUR CODE -------------------- -if (! $error) { +if (!$error) { $db->commit(); print '--- end ok'."\n"; } else { diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php index e3c8c3c9d76..2fb818d5b5f 100755 --- a/dev/examples/code/create_product.php +++ b/dev/examples/code/create_product.php @@ -25,7 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$version='1.10'; -$error=0; +$version = '1.10'; +$error = 0; // -------------------- START OF YOUR CODE HERE -------------------- @@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language @set_time_limit(0); // Load user and its permissions -$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. -if (! $result > 0) { +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (!$result > 0) { dol_print_error('', $user->error); exit; } @@ -65,7 +65,7 @@ $db->begin(); require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; // Create instance of object -$myproduct=new Product($db); +$myproduct = new Product($db); // Definition of product instance properties $myproduct->ref = '1234'; @@ -91,7 +91,7 @@ if ($idobject > 0) { // -------------------- END OF YOUR CODE -------------------- -if (! $error) { +if (!$error) { $db->commit(); print '--- end ok'."\n"; } else { diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index fb24c6aa39a..834c5b078a4 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -25,7 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$version='1.7'; -$error=0; +$version = '1.7'; +$error = 0; // -------------------- START OF YOUR CODE HERE -------------------- @@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language @set_time_limit(0); // Load user and its permissions -$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. -if (! $result > 0) { +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (!$result > 0) { dol_print_error('', $user->error); exit; } @@ -71,10 +71,10 @@ $obj->login = 'ABCDEF'; $obj->nom = 'ABCDEF'; // Create user -$idobject=$obj->create($user); +$idobject = $obj->create($user); if ($idobject > 0) { // Change status to validated - $result=$obj->setStatut(1); + $result = $obj->setStatut(1); if ($result > 0) { print "OK Object created with id ".$idobject."\n"; } else { @@ -82,7 +82,7 @@ if ($idobject > 0) { dol_print_error($db, $obj->error); } } elseif ($obj->error == 'ErrorLoginAlreadyExists') { - print "User with login ".$obj->login." already exists\n"; + print "User with login ".$obj->login." already exists\n"; } else { $error++; dol_print_error($db, $obj->error); @@ -91,7 +91,7 @@ if ($idobject > 0) { // -------------------- END OF YOUR CODE -------------------- -if (! $error) { +if (!$error) { $db->commit(); print '--- end ok'."\n"; } else { diff --git a/dev/examples/code/get_contracts.php b/dev/examples/code/get_contracts.php index 1b30e6b2e17..117ea9d48b5 100755 --- a/dev/examples/code/get_contracts.php +++ b/dev/examples/code/get_contracts.php @@ -25,7 +25,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); -$path=dirname(__FILE__).'/'; +$path = dirname(__FILE__).'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { @@ -34,8 +34,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') { } // Global variables -$version='1.7'; -$error=0; +$version = '1.7'; +$error = 0; // -------------------- START OF YOUR CODE HERE -------------------- @@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language @set_time_limit(0); // Load user and its permissions -$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. -if (! $result > 0) { +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. +if (!$result > 0) { dol_print_error('', $user->error); exit; } @@ -57,7 +57,7 @@ $user->getrights(); print "***** ".$script_file." (".$version.") *****\n"; -if (! isset($argv[1])) { // Check parameters +if (!isset($argv[1])) { // Check parameters print "Usage: ".$script_file." id_thirdparty ...\n"; exit; } @@ -72,9 +72,9 @@ require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; // Create contract object $obj = new Contrat($db); -$obj->socid=$argv[1]; +$obj->socid = $argv[1]; -$listofcontractsforcompany=$obj->getListOfContracts('all'); +$listofcontractsforcompany = $obj->getListOfContracts('all'); print $listofcontractsforcompany; From cbd4d75c22b01d69d4f2c83d66591133557ac38e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 11:11:14 +0100 Subject: [PATCH 11/28] Fix php-cs-fixer for PHP 7.1 --- .php-cs-fixer.dist.php | 19 +++++++- dev/tools/php-cs-fixer/.gitignore | 2 + dev/tools/php-cs-fixer/run-php-cs-fixer.sh | 50 ++++++++++++++++------ 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c5135d3dab5..ed371e20231 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,19 @@ in(__DIR__) +->exclude([ + 'custom', + 'documents', + 'htdocs/custom', + 'htdocs/includes', +]) +->notPath('vendor'); + + +/* PHP 7.4+ */ +/* $finder = (new PhpCsFixer\Finder()) ->in(__DIR__) ->exclude([ @@ -10,8 +24,8 @@ $finder = (new PhpCsFixer\Finder()) ]) ->notPath([ 'vendor', - ]) -; + ]); +*/ return (new PhpCsFixer\Config()) ->setRules([ @@ -28,6 +42,7 @@ return (new PhpCsFixer\Config()) //'strict_param' => true, //'array_syntax' => ['syntax' => 'short'], //'list_syntax' => false, + //'visibility_required' => false, 'array_syntax' => false, 'ternary_to_null_coalescing' => false ]) diff --git a/dev/tools/php-cs-fixer/.gitignore b/dev/tools/php-cs-fixer/.gitignore index 57872d0f1e5..afb52232818 100644 --- a/dev/tools/php-cs-fixer/.gitignore +++ b/dev/tools/php-cs-fixer/.gitignore @@ -1 +1,3 @@ /vendor/ +/composer.json +/composer.lock diff --git a/dev/tools/php-cs-fixer/run-php-cs-fixer.sh b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh index 96a3b69cd8f..b62befcf011 100755 --- a/dev/tools/php-cs-fixer/run-php-cs-fixer.sh +++ b/dev/tools/php-cs-fixer/run-php-cs-fixer.sh @@ -6,7 +6,7 @@ # Optionally set COMPOSER_VENDOR_DIR to your vendor path for composer. # # Run php-cs-fixer by calling this script: -# ./run-php-cs-fixer.sh check # Only checks +# ./run-php-cs-fixer.sh check # Only checks (not available with PHP 7.0) # ./run-php-cs-fixer.sh fix # Fixes # # You can fix only a few files using @@ -19,7 +19,7 @@ # COMPOSER_CMD="php ~/composer.phar" COMPOSER_VENDOR_DIR="~/vendor" ./run-php-cs-fixer.sh # # or export them: -# export COMPOSER_CMD="php ~/composer.phar" +# export COMPOSER_CMD="~/composer.phar" # export COMPOSER_VENDOR_DIR="~/vendor" # ./run-php-cs-fixer.sh # @@ -29,30 +29,52 @@ MYDIR=$(dirname "$(realpath "$0")") export COMPOSER_VENDOR_DIR=${COMPOSER_VENDOR_DIR:=$MYDIR/vendor} -COMPOSER_CMD=${COMPOSER_CMD:=composer} +COMPOSER_CMD=${COMPOSER_CMD:composer} +MINPHPVERSION="7.0" -# -# Install/update -# -PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer" -if [ ! -r "${PHP_CS_FIXER}" ] ; then - [[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install - [[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update - ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer -fi +echo "***** run-php-cs-fixer.sh *****" if [ "x$1" = "x" ]; then - echo "***** run-php-cs-fixer.sh *****" echo "Syntax: run-php-cs-fixer.sh check|fix [path]" exit 1; fi + +# +# Check composer is available +# +if [ ! -r "${COMPOSER_CMD}" ] ; then + echo composer is not available or not in path. You can give the path of composer by setting COMPOSER_CMD=/pathto/composer + echo Example: export COMPOSER_CMD="~/composer.phar" + echo Example: export COMPOSER_CMD="/usr/local/bin/composer" + exit 1; +fi + + +# +# Install/update php-cs-fixer +# +echo Install php-cs-fixer +PHP_CS_FIXER="${COMPOSER_VENDOR_DIR}/bin/php-cs-fixer" +if [ ! -r "${PHP_CS_FIXER}" ] ; then + [[ ! -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} install + [[ -e "${COMPOSER_VENDOR_DIR}" ]] && ${COMPOSER_CMD} update + php${MINPHPVERSION} ${COMPOSER_CMD} require --dev friendsofphp/php-cs-fixer + echo +fi + + +# With PHP 7.0, php-cs-fixer is V2 (command check not supported) +# With PHP 8.2, php-cs-fixer is V3 + ( + echo cd "${MYDIR}/../../.." cd "${MYDIR}/../../.." || exit CMD= # If no argument, run check by default [[ "$1" == "" ]] && CMD=check # shellcheck disable=SC2086 - "${PHP_CS_FIXER}" $CMD "$@" + echo php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@" + php${MINPHPVERSION} "${PHP_CS_FIXER}" $CMD "$@" ) From 881e32f03aaddb429c6cfea7aec7e9599ca52703 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 11:21:01 +0100 Subject: [PATCH 12/28] Fix with php-cs-fixer --- .gitignore | 1 + dev/initdata/generate-invoice.php | 5 ++-- dev/initdata/generate-order.php | 2 +- dev/initdata/generate-product.php | 23 +++++++++++++------ dev/initdata/generate-proposal.php | 2 +- dev/initdata/generate-thirdparty.php | 12 ++++++---- dev/initdata/import-products.php | 6 ++--- dev/initdata/import-thirdparties.php | 8 +++---- dev/initdata/import-users.php | 4 ++-- .../src/Renaming/UserRightsToFunction.php | 1 - dev/tools/test/testtcpdf.php | 1 + dev/tools/test/testutf.php | 1 + dev/translation/autotranslator.class.php | 7 +++--- dev/translation/sanity_check_en_langfiles.php | 15 ++++++------ dev/translation/strip_language_file.php | 8 +++---- 15 files changed, 56 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index dabdebc9ca9..f0ed21691df 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ doc/install.lock /build/phpstan/bootstrap_custom.php phpstan_custom.neon /.php-cs-fixer.cache +/.php_cs.cache diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index 074d85c6561..802adf92aa6 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; define('GEN_NUMBER_FACTURE', $argv[1] ?? 1); $year = 2016; -$dates = array (mktime(12, 0, 0, 1, 3, $year), +$dates = array(mktime(12, 0, 0, 1, 3, $year), mktime(12, 0, 0, 1, 9, $year), mktime(12, 0, 0, 2, 13, $year), mktime(12, 0, 0, 2, 23, $year), @@ -168,7 +168,8 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) { $result=$object->validate($fuser); if ($result) { - print " OK with ref ".$object->ref."\n";; + print " OK with ref ".$object->ref."\n"; + ; } else { dol_print_error($db, $object->error); } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index c5eb294252c..554e8ad49d6 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"; define('GEN_NUMBER_COMMANDE', $argv[1] ?? 10); $year = 2016; -$dates = array (mktime(12, 0, 0, 1, 3, $year), +$dates = array(mktime(12, 0, 0, 1, 3, $year), mktime(12, 0, 0, 1, 9, $year), mktime(12, 0, 0, 2, 13, $year), mktime(12, 0, 0, 2, 23, $year), diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 48accbaa438..20f83932e64 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -64,18 +64,24 @@ $user->getrights(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; $i++; + $row = $db->fetch_row($resql); + $productsid[$i] = $row[0]; + $i++; } } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; $i++; + $row = $db->fetch_row($resql); + $societesid[$i] = $row[0]; + $i++; } } else { print "err"; @@ -84,9 +90,12 @@ if ($resql) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { - $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; $i++; + $row = $db->fetch_row($resql); + $commandesid[$i] = $row[0]; + $i++; } } else { print "err"; @@ -99,7 +108,7 @@ for ($s = 0; $s < GEN_NUMBER_PRODUIT; $s++) { $produit = new Product($db); $produit->type = mt_rand(0, 1); $produit->status = 1; - $produit->ref = ($produit->type?'S':'P').time().$s; + $produit->ref = ($produit->type ? 'S' : 'P').time().$s; $produit->label = 'Label '.time().$s; $produit->description = 'Description '.time().$s; $produit->price = mt_rand(1, 999.99); diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index c3553671552..cf9a708de9e 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; define('GEN_NUMBER_PROPAL', $argv[1] ?? 10); $year = 2016; -$dates = array (mktime(12, 0, 0, 1, 3, $year), +$dates = array(mktime(12, 0, 0, 1, 3, $year), mktime(12, 0, 0, 1, 9, $year), mktime(12, 0, 0, 2, 13, $year), mktime(12, 0, 0, 2, 23, $year), diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 187b02ef8e1..287eaeb173f 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -67,7 +67,8 @@ $user->getrights(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { $row = $db->fetch_row($resql); $productsid[$i] = $row[0]; @@ -78,7 +79,8 @@ if ($resql) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; @@ -91,7 +93,8 @@ if ($resql) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); $i = 0; + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; @@ -117,7 +120,8 @@ for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) { $soc->country_id=1; $soc->country_code='FR'; // Un client sur 3 a une remise de 5% - $user_remise=mt_rand(1, 3); if ($user_remise==3) { + $user_remise=mt_rand(1, 3); + if ($user_remise==3) { $soc->remise_percent=5; } print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n"; diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index d4e06302d56..18bc7611491 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -62,9 +62,9 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv)); $mode = $argv[1]; $filepath = $argv[2]; $filepatherr = $filepath.'.err'; -$defaultlang = empty($argv[3])?'en_US':$argv[3]; -$startlinenb = empty($argv[4])?1:$argv[4]; -$endlinenb = empty($argv[5])?0:$argv[5]; +$defaultlang = empty($argv[3]) ? 'en_US' : $argv[3]; +$startlinenb = empty($argv[4]) ? 1 : $argv[4]; +$endlinenb = empty($argv[5]) ? 0 : $argv[5]; if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) { print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n"; diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 91f28f11769..5a5bde31905 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -63,8 +63,8 @@ $mode = $argv[1]; $filepath = $argv[2]; $filepatherr = $filepath.'.err'; //$defaultlang = empty($argv[3])?'en_US':$argv[3]; -$startlinenb = empty($argv[3])?1:$argv[3]; -$endlinenb = empty($argv[4])?0:$argv[4]; +$startlinenb = empty($argv[3]) ? 1 : $argv[3]; +$endlinenb = empty($argv[4]) ? 0 : $argv[4]; if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) { print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; @@ -128,8 +128,8 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) $object->client = $fields[7]; $object->fournisseur = $fields[8]; - $object->name = $fields[13]?trim($fields[13]):$fields[0]; - $object->name_alias = $fields[0]!=$fields[13]?trim($fields[0]):''; + $object->name = $fields[13] ? trim($fields[13]) : $fields[0]; + $object->name_alias = $fields[0]!=$fields[13] ? trim($fields[0]) : ''; $object->address = trim($fields[14]); $object->zip = trim($fields[15]); diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 3c28493c106..a1a3b299e7b 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -63,8 +63,8 @@ $mode = $argv[1]; $filepath = $argv[2]; $filepatherr = $filepath.'.err'; //$defaultlang = empty($argv[3])?'en_US':$argv[3]; -$startlinenb = empty($argv[3])?1:$argv[3]; -$endlinenb = empty($argv[4])?0:$argv[4]; +$startlinenb = empty($argv[3]) ? 1 : $argv[3]; +$endlinenb = empty($argv[4]) ? 0 : $argv[4]; if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) { print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; diff --git a/dev/tools/rector/src/Renaming/UserRightsToFunction.php b/dev/tools/rector/src/Renaming/UserRightsToFunction.php index dd93fbdc4d5..5a141ddad5b 100644 --- a/dev/tools/rector/src/Renaming/UserRightsToFunction.php +++ b/dev/tools/rector/src/Renaming/UserRightsToFunction.php @@ -62,7 +62,6 @@ class UserRightsToFunction extends AbstractRector */ public function refactor(Node $node) { - if ($node instanceof Node\Stmt\ClassMethod) { $excludeMethods = ['getrights', 'hasRight']; /** @var \PHPStan\Analyser\MutatingScope $scope */ diff --git a/dev/tools/test/testtcpdf.php b/dev/tools/test/testtcpdf.php index fe09c5c4764..e2bd066d073 100755 --- a/dev/tools/test/testtcpdf.php +++ b/dev/tools/test/testtcpdf.php @@ -1,4 +1,5 @@ getTranslationFilesArray($this->_refLang); $counter = 1; foreach ($files as $file) { @@ -276,7 +275,7 @@ class autoTranslator private function getLineValue($line) { $arraykey = explode('=', $line, 2); - return trim(isset($arraykey[1])?$arraykey[1]:''); + return trim(isset($arraykey[1]) ? $arraykey[1] : ''); } /** @@ -334,8 +333,8 @@ class autoTranslator //print "Url to translate: ".$url."\n"; if (! function_exists("curl_init")) { - print "Error, your PHP does not support curl functions.\n"; - die(); + print "Error, your PHP does not support curl functions.\n"; + die(); } $ch = curl_init(); diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 95ea90e3f34..02a45c71bfd 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -210,7 +210,8 @@ foreach ($dups as $string => $pages) { $inadmin=0; foreach ($pages as $file => $lines) { if ($file == 'main.lang') { - $inmain=1; $inadmin=0; + $inmain=1; + $inadmin=0; } if ($file == 'admin.lang' && ! $inmain) { $inadmin=1; @@ -568,16 +569,16 @@ if ((!empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($ar if (empty($unused)) { print "No string not used found.\n"; } else { - $filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang'; + $filetosave='/tmp/'.($argv[2] ? $argv[2] : "").'notused.lang'; print "Strings in en_US that are never used are saved into file ".$filetosave.":\n"; file_put_contents($filetosave, implode("", $unused)); print "To remove from original file, run command :\n"; - if (($argv[2]?$argv[2]:"")) { - print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; "; + if (($argv[2] ? $argv[2] : "")) { + print 'cd htdocs/langs/en_US; mv '.($argv[2] ? $argv[2] : "")." ".($argv[2] ? $argv[2] : "").".tmp; "; } - print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:""); - if (($argv[2]?$argv[2]:"")) { - print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n"; + print "diff ".($argv[2] ? $argv[2] : "").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2] ? $argv[2] : ""); + if (($argv[2] ? $argv[2] : "")) { + print "; rm ".($argv[2] ? $argv[2] : "").".tmp;\n"; } } } diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index b2427c9f57a..b308731096f 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -58,10 +58,10 @@ $rc = 0; // Get and check arguments -$lPrimary = isset($argv[1])?$argv[1]:''; -$lSecondary = isset($argv[2])?$argv[2]:''; +$lPrimary = isset($argv[1]) ? $argv[1] : ''; +$lSecondary = isset($argv[2]) ? $argv[2] : ''; $lEnglish = 'en_US'; -$filesToProcess = isset($argv[3])?$argv[3]:''; +$filesToProcess = isset($argv[3]) ? $argv[3] : ''; if (empty($lPrimary) || empty($lSecondary) || empty($filesToProcess)) { $rc = 1; @@ -308,7 +308,7 @@ foreach ($filesToProcess as $fileToProcess) { || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key) ) { //print "Key $key differs (aSecondary=".$aSecondary[$key].", aPrimary=".$aPrimary[$key].", aEnglish=".$aEnglish[$key].") so we add it into new secondary language (line: $cnt).\n"; - fwrite($oh, $key."=".(empty($aSecondary[$key])?$aPrimary[$key]:$aSecondary[$key])."\n"); + fwrite($oh, $key."=".(empty($aSecondary[$key]) ? $aPrimary[$key] : $aSecondary[$key])."\n"); } } if (! feof($handle)) { From de7d3c2bf8427b2468433761c80c06efddc1d256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 11:22:28 +0100 Subject: [PATCH 13/28] Fix with php-cs-fixer --- scripts/doc/regenerate_docs.php | 3 +- test/other/test_dol_escape_htmltag.php | 12 ++++++-- test/other/test_serialize.php | 16 +++++++--- test/other/test_uncrypt.php | 12 ++++++-- test/phpunit/AccountingAccountTest.php | 3 +- test/phpunit/ActionCommTest.php | 3 +- test/phpunit/AdherentTest.php | 24 ++++++++------- test/phpunit/AllTests.php | 24 +++++++-------- test/phpunit/AssetModelTest.php | 8 ++--- test/phpunit/BuildDocTest.php | 21 ++++++++----- test/phpunit/CodingPhpTest.php | 10 +++---- test/phpunit/CommandeFournisseurTest.php | 3 +- test/phpunit/CommandeTest.php | 3 +- test/phpunit/DateLibTest.php | 8 +++-- test/phpunit/EntrepotTest.php | 3 +- test/phpunit/FactureRecTest.php | 4 +-- test/phpunit/FactureTest.php | 10 ++++--- test/phpunit/FilesLibTest.php | 4 ++- test/phpunit/FunctionsLibTest.php | 18 ++++++++---- test/phpunit/InventoryTest.php | 4 +-- test/phpunit/KnowledgeRecordTest.php | 3 +- test/phpunit/MouvementStockTest.php | 3 +- test/phpunit/ODFTest.php | 4 ++- test/phpunit/PaypalTest.php | 3 +- test/phpunit/PdfDocTest.php | 6 ++-- test/phpunit/ProductTest.php | 3 +- test/phpunit/ReceptionTest.php | 34 +++++++++++++++------- test/phpunit/RestAPIContactTest.php | 3 +- test/phpunit/RestAPIUserTest.php | 3 +- test/phpunit/SocieteTest.php | 9 ++++-- test/phpunit/StripeTest.php | 3 +- test/phpunit/SupplierProposalTest.php | 3 +- test/phpunit/TargetTest.php | 8 ++--- test/phpunit/UserTest.php | 13 +++++---- test/phpunit/WebservicesInvoicesTest.php | 4 +-- test/phpunit/WebservicesThirdpartyTest.php | 2 +- test/phpunit/WebservicesUserTest.php | 2 +- 37 files changed, 190 insertions(+), 109 deletions(-) diff --git a/scripts/doc/regenerate_docs.php b/scripts/doc/regenerate_docs.php index e76cc615298..e4aa60b1e4a 100755 --- a/scripts/doc/regenerate_docs.php +++ b/scripts/doc/regenerate_docs.php @@ -140,7 +140,8 @@ if ($tmpobject) { } if ($result < 0) { $nbko++; - } if ($result == 0) { + } + if ($result == 0) { print 'File for ref '.$tmpobject->ref.' returned 0 during regeneration with template '.$tmpobject->model_pdf."\n"; $nbok++; } else { diff --git a/test/other/test_dol_escape_htmltag.php b/test/other/test_dol_escape_htmltag.php index 1b73f885a98..ab0c913d882 100755 --- a/test/other/test_dol_escape_htmltag.php +++ b/test/other/test_dol_escape_htmltag.php @@ -6,9 +6,15 @@ $path = __DIR__ . '/'; $res=@include_once $path.'/../htdocs/master.inc.php'; $res=@include_once $path.'/../../htdocs/master.inc.php'; -if (! $res) @include_once '../../master.inc.php'; -if (! $res) @include_once '../master.inc.php'; -if (! $res) @include_once './master.inc.php'; +if (! $res) { + @include_once '../../master.inc.php'; +} +if (! $res) { + @include_once '../master.inc.php'; +} +if (! $res) { + @include_once './master.inc.php'; +} // Show information diff --git a/test/other/test_serialize.php b/test/other/test_serialize.php index 74d1d40e025..3fede8fd2a9 100644 --- a/test/other/test_serialize.php +++ b/test/other/test_serialize.php @@ -6,9 +6,15 @@ $path = __DIR__ . '/'; $res=@include_once $path.'/../htdocs/master.inc.php'; $res=@include_once $path.'/../../htdocs/master.inc.php'; -if (! $res) @include_once '../../master.inc.php'; -if (! $res) @include_once '../master.inc.php'; -if (! $res) @include_once './master.inc.php'; +if (! $res) { + @include_once '../../master.inc.php'; +} +if (! $res) { + @include_once '../master.inc.php'; +} +if (! $res) { + @include_once './master.inc.php'; +} include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -25,7 +31,9 @@ foreach ($tmp as $key => $value) { ))) { continue; // Discard if not into a dedicated list } - if (!is_object($value)) $object->thirdparty->{$key} = $value; + if (!is_object($value)) { + $object->thirdparty->{$key} = $value; + } } diff --git a/test/other/test_uncrypt.php b/test/other/test_uncrypt.php index f57815aa2a2..339ab9bde69 100755 --- a/test/other/test_uncrypt.php +++ b/test/other/test_uncrypt.php @@ -6,9 +6,15 @@ $path = __DIR__ . '/'; $res=@include_once $path.'/../htdocs/master.inc.php'; $res=@include_once $path.'/../../htdocs/master.inc.php'; -if (! $res) @include_once '../../master.inc.php'; -if (! $res) @include_once '../master.inc.php'; -if (! $res) @include_once './master.inc.php'; +if (! $res) { + @include_once '../../master.inc.php'; +} +if (! $res) { + @include_once '../master.inc.php'; +} +if (! $res) { + @include_once './master.inc.php'; +} print "Decode a value crypted with crypted:.... in conf.php file\n"; diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index 80a793f4d19..8bd7653970b 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -86,7 +86,8 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (!isModEnabled('accounting')) { - print __METHOD__." module accouting must be enabled.\n"; exit(-1); + print __METHOD__." module accouting must be enabled.\n"; + exit(-1); } print __METHOD__."\n"; diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 8f86c13d067..c7ce60fad07 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -86,7 +86,8 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (!isModEnabled('agenda')) { - print __METHOD__." module agenda must be enabled.\n"; die(1); + print __METHOD__." module agenda must be enabled.\n"; + die(1); } print __METHOD__."\n"; diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 6bd72c297dd..8ced6f41f90 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -92,10 +92,12 @@ class AdherentTest extends PHPUnit\Framework\TestCase die(1); } if (getDolGlobalString('MAIN_MODULE_LDAP')) { - print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1); + print "\n".__METHOD__." module LDAP must be disabled.\n"; + die(1); } if (getDolGlobalString('MAIN_MODULE_MAILMANSPIP')) { - print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(1); + print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; + die(1); } print __METHOD__."\n"; @@ -358,15 +360,15 @@ class AdherentTest extends PHPUnit\Framework\TestCase return $localobject; } - /** - * testAdherentSetUserId - * - * @param Adherent $localobject Member instance - * @return Adherent - * - * @depends testAdherentMakeSubstitution - * The depends says test is run only if previous is ok - */ + /** + * testAdherentSetUserId + * + * @param Adherent $localobject Member instance + * @return Adherent + * + * @depends testAdherentMakeSubstitution + * The depends says test is run only if previous is ok + */ public function testAdherentSetUserId(Adherent $localobject) { global $conf,$user,$langs,$db; diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 6deaafd7707..5a5c2f48b02 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -237,18 +237,18 @@ class AllTests // Test only with php7.2 or less //if ((float) phpversion() < 7.3) //{ - require_once dirname(__FILE__).'/WebservicesProductsTest.php'; - $suite->addTestSuite('WebservicesProductsTest'); - require_once dirname(__FILE__).'/WebservicesInvoicesTest.php'; - $suite->addTestSuite('WebservicesInvoicesTest'); - require_once dirname(__FILE__).'/WebservicesOrdersTest.php'; - $suite->addTestSuite('WebservicesOrdersTest'); - require_once dirname(__FILE__).'/WebservicesOtherTest.php'; - $suite->addTestSuite('WebservicesOtherTest'); - require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; - $suite->addTestSuite('WebservicesThirdpartyTest'); - require_once dirname(__FILE__).'/WebservicesUserTest.php'; - $suite->addTestSuite('WebservicesUserTest'); + require_once dirname(__FILE__).'/WebservicesProductsTest.php'; + $suite->addTestSuite('WebservicesProductsTest'); + require_once dirname(__FILE__).'/WebservicesInvoicesTest.php'; + $suite->addTestSuite('WebservicesInvoicesTest'); + require_once dirname(__FILE__).'/WebservicesOrdersTest.php'; + $suite->addTestSuite('WebservicesOrdersTest'); + require_once dirname(__FILE__).'/WebservicesOtherTest.php'; + $suite->addTestSuite('WebservicesOtherTest'); + require_once dirname(__FILE__).'/WebservicesThirdpartyTest.php'; + $suite->addTestSuite('WebservicesThirdpartyTest'); + require_once dirname(__FILE__).'/WebservicesUserTest.php'; + $suite->addTestSuite('WebservicesUserTest'); //} require_once dirname(__FILE__).'/ExportTest.php'; diff --git a/test/phpunit/AssetModelTest.php b/test/phpunit/AssetModelTest.php index 6572459a5fc..b8a14c144a5 100644 --- a/test/phpunit/AssetModelTest.php +++ b/test/phpunit/AssetModelTest.php @@ -82,7 +82,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() : void + public static function setUpBeforeClass(): void { global $conf, $user, $langs, $db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. @@ -95,7 +95,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function setUp() : void + protected function setUp(): void { global $conf, $user, $langs, $db; $conf = $this->savconf; @@ -111,7 +111,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() : void + protected function tearDown(): void { print __METHOD__."\n"; } @@ -121,7 +121,7 @@ class AssetModelTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function tearDownAfterClass() : void + public static function tearDownAfterClass(): void { global $conf, $user, $langs, $db; $db->rollback(); diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 71a5daa35f9..fd2459de0b3 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -115,25 +115,32 @@ class BuildDocTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('facture')) { - print __METHOD__." invoice module not enabled\n"; die(1); + print __METHOD__." invoice module not enabled\n"; + die(1); } if (!isModEnabled('commande')) { - print __METHOD__." order module not enabled\n"; die(1); + print __METHOD__." order module not enabled\n"; + die(1); } if (!isModEnabled('propal')) { - print __METHOD__." propal module not enabled\n"; die(1); + print __METHOD__." propal module not enabled\n"; + die(1); } if (!isModEnabled('projet')) { - print __METHOD__." project module not enabled\n"; die(1); + print __METHOD__." project module not enabled\n"; + die(1); } if (!isModEnabled('expedition')) { - print __METHOD__." shipment module not enabled\n"; die(1); + print __METHOD__." shipment module not enabled\n"; + die(1); } if (!isModEnabled('ficheinter')) { - print __METHOD__." intervention module not enabled\n"; die(1); + print __METHOD__." intervention module not enabled\n"; + die(1); } if (!isModEnabled('expensereport')) { - print __METHOD__." expensereport module not enabled\n"; die(1); + print __METHOD__." expensereport module not enabled\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 0be380a15ba..5e19e42eed0 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -343,9 +343,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase preg_match_all('/\$sql \.= \'\s*VALUES.*\$/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { //if ($val[1] != '\'"' && $val[1] != '\'\'') { - var_dump($matches); - $ok=false; - break; + var_dump($matches); + $ok=false; + break; //} //if ($reg[0] != 'db') $ok=false; } @@ -504,8 +504,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase // Check string ='print_liste_field_titre\(\$langs'. preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { - $ok=false; - break; + $ok=false; + break; } $this->assertTrue($ok, 'Found a use of print_liste_field_titre with first parameter that is a translated value instead of just the translation key in file '.$file['relativename'].'. Bad.'); diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 4aba4486244..f378694bb45 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -149,7 +149,8 @@ class CommandeFournisseurTest extends PHPUnit\Framework\TestCase $product=new ProductFournisseur($db); $product->fetch(0, 'PINKDRESS'); if ($product->id <= 0) { - print "\n".__METHOD__." A product with ref PINKDRESS must exists into database"; die(1); + print "\n".__METHOD__." A product with ref PINKDRESS must exists into database"; + die(1); } $quantity=10; diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 7e7804610ed..e855775a130 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -86,7 +86,8 @@ class CommandeTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (!isModEnabled('commande')) { - print __METHOD__." module customer order must be enabled.\n"; die(1); + print __METHOD__." module customer order must be enabled.\n"; + die(1); } print __METHOD__."\n"; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 428b55de164..c9be8ac347a 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -517,12 +517,16 @@ class DateLibTest extends PHPUnit\Framework\TestCase { global $conf; - $day=3; $month=2; $year=2015; + $day=3; + $month=2; + $year=2015; $conf->global->MAIN_START_WEEK = 1; // start on monday $prev = dol_get_first_day_week($day, $month, $year); $this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2 - $day=3; $month=2; $year=2015; + $day=3; + $month=2; + $year=2015; $conf->global->MAIN_START_WEEK = 0; // start on sunday $prev = dol_get_first_day_week($day, $month, $year); $this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index 5ef30cc07e9..4bdec4b1534 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -85,7 +85,8 @@ class EntrepotTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('stock')) { - print __METHOD__." Module Stock must be enabled.\n"; die(1); + print __METHOD__." Module Stock must be enabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index 14d2a329aa9..abda040b6eb 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -221,10 +221,10 @@ class FactureRecTest extends PHPUnit\Framework\TestCase continue; } if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } } } diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 6437c69e1ab..a6806179236 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -86,10 +86,12 @@ class FactureTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('facture')) { - print __METHOD__." module customer invoice must be enabled.\n"; die(1); + print __METHOD__." module customer invoice must be enabled.\n"; + die(1); } if (isModEnabled('ecotaxdeee')) { - print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(1); + print __METHOD__." ecotaxdeee module must not be enabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. @@ -380,10 +382,10 @@ class FactureTest extends PHPUnit\Framework\TestCase continue; } if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } } } diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 8f235f3e868..be1365e79c7 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -469,7 +469,9 @@ class FilesLibTest extends PHPUnit\Framework\TestCase // Test compression of a directory // $dirout is $conf->admin->dir_temp.'/testdirgz' $excludefiles = '/(\.back|\.old|\.log|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; - if (preg_match($excludefiles, 'a/temp/b')) { echo '----- Regex OK -----'."\n"; } + if (preg_match($excludefiles, 'a/temp/b')) { + echo '----- Regex OK -----'."\n"; + } $result=dol_compress_dir($dirout, $conf->admin->dir_temp.'/testcompressdirzip.zip', 'zip', $excludefiles); print __METHOD__." dol_compress_dir result=".$result."\n"; print join(', ', $conf->logbuffer); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 6509b6e9b72..596dee81378 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -118,15 +118,18 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (! function_exists('mb_substr')) { - print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(1); + print "\n".__METHOD__." function mb_substr must be enabled.\n"; + die(1); } if ($conf->global->MAIN_MAX_DECIMALS_UNIT != 5) { - print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 5 for this test.\n"; die(1); + print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 5 for this test.\n"; + die(1); } if ($conf->global->MAIN_MAX_DECIMALS_TOT != 2) { - print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 2 for this test.\n"; die(1); + print "\n".__METHOD__." bad setup for number of digits for unit amount. Must be 2 for this test.\n"; + die(1); } print __METHOD__."\n"; @@ -661,15 +664,18 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase */ public function testDolConcat() { - $text1="A string 1"; $text2="A string 2"; // text 1 and 2 are text, concat need only \n + $text1="A string 1"; + $text2="A string 2"; // text 1 and 2 are text, concat need only \n $after=dol_concatdesc($text1, $text2); $this->assertEquals("A string 1\nA string 2", $after); - $text1="A
string 1"; $text2="A string 2"; // text 1 is html, concat need
\n + $text1="A
string 1"; + $text2="A string 2"; // text 1 is html, concat need
\n $after=dol_concatdesc($text1, $text2); $this->assertEquals("A
string 1
\nA string 2", $after); - $text1="A string 1"; $text2="A string 2"; // text 2 is html, concat need
\n + $text1="A string 1"; + $text2="A string 2"; // text 2 is html, concat need
\n $after=dol_concatdesc($text1, $text2); $this->assertEquals("A string 1
\nA string 2", $after); diff --git a/test/phpunit/InventoryTest.php b/test/phpunit/InventoryTest.php index ced18910790..baf26893448 100644 --- a/test/phpunit/InventoryTest.php +++ b/test/phpunit/InventoryTest.php @@ -372,10 +372,10 @@ class InventoryTest extends PHPUnit\Framework\TestCase continue; } if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } } } diff --git a/test/phpunit/KnowledgeRecordTest.php b/test/phpunit/KnowledgeRecordTest.php index 7103345a096..13c86e66449 100644 --- a/test/phpunit/KnowledgeRecordTest.php +++ b/test/phpunit/KnowledgeRecordTest.php @@ -89,7 +89,8 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (!isModEnabled('knowledgemanagement')) { - print __METHOD__." module knowledgemanagement must be enabled.\n"; die(1); + print __METHOD__." module knowledgemanagement must be enabled.\n"; + die(1); } } diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index c2bf052751e..9bfa21918f5 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -117,7 +117,8 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase $db=$this->savdb; if (!isModEnabled('productbatch')) { - print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; die(1); + print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; + die(1); } print __METHOD__."\n"; diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php index a7d972bf345..87d062a3412 100644 --- a/test/phpunit/ODFTest.php +++ b/test/phpunit/ODFTest.php @@ -363,7 +363,9 @@ class ODFTest extends PHPUnit\Framework\TestCase ]; $odf=new Odf($filename, array()); - if (is_object($odf)) $result = 1; // Just to test + if (is_object($odf)) { + $result = 1; + } // Just to test foreach ($to_test as $case) { if ($case['charset'] !== null) { diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index 086e62dc9af..04b546ef34e 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -86,7 +86,8 @@ class PaypalTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('paypal')) { - print __METHOD__." Module Paypal must be enabled.\n"; die(1); + print __METHOD__." Module Paypal must be enabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index d468af76ebd..d58f1db8985 100644 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -145,11 +145,13 @@ class PdfDocTest extends PHPUnit\Framework\TestCase $localproduct=new Product($db); $result = $localproduct->fetch(0, 'PINKDRESS'); if ($result < 0) { - print "\n".__METHOD__." Failed to make the fetch of product PINKDRESS. ".$localproduct->error; die(1); + print "\n".__METHOD__." Failed to make the fetch of product PINKDRESS. ".$localproduct->error; + die(1); } $product_id = $localproduct->id; if ($product_id <= 0) { - print "\n".__METHOD__." A product with ref PINKDRESS must exists into database. Create it manually before running the test"; die(1); + print "\n".__METHOD__." A product with ref PINKDRESS must exists into database. Create it manually before running the test"; + die(1); } $localobject=new Facture($db); diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 2c4dfd6a829..40c98ab29d6 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -85,7 +85,8 @@ class ProductTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('product')) { - print __METHOD__." Module Product must be enabled.\n"; die(1); + print __METHOD__." Module Product must be enabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/ReceptionTest.php b/test/phpunit/ReceptionTest.php index be69b957967..fb1767a3cb1 100644 --- a/test/phpunit/ReceptionTest.php +++ b/test/phpunit/ReceptionTest.php @@ -143,7 +143,9 @@ class ReceptionTest extends PHPUnit\Framework\TestCase $soc = new Societe($db); $soc->name = "ReceptionTest Unittest"; $soc_id = $soc->create($user); - $this->assertLessThanOrEqual($soc_id, 0, + $this->assertLessThanOrEqual( + $soc_id, + 0, "Cannot create Societe object: ". $soc->errorsToString() ); @@ -217,7 +219,7 @@ class ReceptionTest extends PHPUnit\Framework\TestCase global $db, $user, $conf; $conf->global->MAIN_USE_ADVANCED_PERMS = ''; - $user->rights->reception = new stdClass; + $user->rights->reception = new stdClass(); $user->rights->reception->creer = 1; $result = $user->fetch($user->id); @@ -265,19 +267,31 @@ class ReceptionTest extends PHPUnit\Framework\TestCase $result = $localobject->setClosed($user); $this->assertLessThanOrEqual($result, 0, "Cannot close Reception object:\n". $localobject->errorsToString()); - $this->assertEquals(Reception::STATUS_CLOSED, $localobject->status, - "Checking that \$localobject->status is STATUS_CLOSED"); - $this->assertEquals(Reception::STATUS_CLOSED, $localobject->statut, - "Checking that \$localobject->statut is STATUS_CLOSED"); + $this->assertEquals( + Reception::STATUS_CLOSED, + $localobject->status, + "Checking that \$localobject->status is STATUS_CLOSED" + ); + $this->assertEquals( + Reception::STATUS_CLOSED, + $localobject->statut, + "Checking that \$localobject->statut is STATUS_CLOSED" + ); $obj = new Reception($db); $result = $obj->fetch($localobject->id); $this->assertLessThanOrEqual($result, 0, "Cannot fetch Reception object:\n". $obj->errorsToString()); - $this->assertEquals(Reception::STATUS_CLOSED, $obj->status, - "Checking that \$obj->status is STATUS_CLOSED"); - $this->assertEquals(Reception::STATUS_CLOSED, $obj->statut, - "Checking that \$obj->statut is STATUS_CLOSED"); + $this->assertEquals( + Reception::STATUS_CLOSED, + $obj->status, + "Checking that \$obj->status is STATUS_CLOSED" + ); + $this->assertEquals( + Reception::STATUS_CLOSED, + $obj->statut, + "Checking that \$obj->statut is STATUS_CLOSED" + ); return $obj; } diff --git a/test/phpunit/RestAPIContactTest.php b/test/phpunit/RestAPIContactTest.php index ccc3aad1ebb..9dfab608dfb 100644 --- a/test/phpunit/RestAPIContactTest.php +++ b/test/phpunit/RestAPIContactTest.php @@ -76,7 +76,8 @@ class RestAPIContactTest extends PHPUnit\Framework\TestCase $this->savdb=$db; if (!isModEnabled('api')) { - print __METHOD__." module api must be enabled.\n"; die(1); + print __METHOD__." module api must be enabled.\n"; + die(1); } print __METHOD__." db->type=".$db->type." user->id=".$user->id; diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index f9de4f95c9c..8ef6ca5a65e 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -76,7 +76,8 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase $this->savdb=$db; if (!isModEnabled('api')) { - print __METHOD__." module api must be enabled.\n"; die(1); + print __METHOD__." module api must be enabled.\n"; + die(1); } print __METHOD__." db->type=".$db->type." user->id=".$user->id; diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 193e84ca86b..44d306c4f22 100644 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -86,15 +86,18 @@ class SocieteTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') { - print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '" . getDolGlobalString('SOCIETE_CODECLIENT_ADDON')."'.\n"; die(1); + print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '" . getDolGlobalString('SOCIETE_CODECLIENT_ADDON')."'.\n"; + die(1); } if (getDolGlobalString('MAIN_DISABLEPROFIDRULES')) { - print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(1); + print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; + die(1); } if ($langs->defaultlang != 'en_US') { - print "\n".__METHOD__." default language of company must be set to autodetect.\n"; die(1); + print "\n".__METHOD__." default language of company must be set to autodetect.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/StripeTest.php b/test/phpunit/StripeTest.php index f44b598270a..6884993cda8 100644 --- a/test/phpunit/StripeTest.php +++ b/test/phpunit/StripeTest.php @@ -86,7 +86,8 @@ class StripeTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (!isModEnabled('stripe')) { - print __METHOD__." Module Stripe must be enabled.\n"; die(1); + print __METHOD__." Module Stripe must be enabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index 01eca9be0ff..0afef774103 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -89,7 +89,8 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (!getDolGlobalString('MAIN_MODULE_SUPPLIERPROPOSAL')) { - print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; die(1); + print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; + die(1); } print __METHOD__."\n"; diff --git a/test/phpunit/TargetTest.php b/test/phpunit/TargetTest.php index 3cf8fce21ab..fa18d159951 100644 --- a/test/phpunit/TargetTest.php +++ b/test/phpunit/TargetTest.php @@ -82,7 +82,7 @@ class TargetTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function setUpBeforeClass() : void + public static function setUpBeforeClass(): void { global $conf, $user, $langs, $db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. @@ -95,7 +95,7 @@ class TargetTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function setUp() : void + protected function setUp(): void { global $conf, $user, $langs, $db; $conf = $this->savconf; @@ -111,7 +111,7 @@ class TargetTest extends PHPUnit\Framework\TestCase * * @return void */ - protected function tearDown() : void + protected function tearDown(): void { print __METHOD__."\n"; } @@ -121,7 +121,7 @@ class TargetTest extends PHPUnit\Framework\TestCase * * @return void */ - public static function tearDownAfterClass() : void + public static function tearDownAfterClass(): void { global $conf, $user, $langs, $db; $db->rollback(); diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 9ce42e8ee99..b6c752d0688 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -85,7 +85,8 @@ class UserTest extends PHPUnit\Framework\TestCase global $conf,$user,$langs,$db; if (getDolGlobalString('MAIN_MODULE_LDAP')) { - print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1); + print "\n".__METHOD__." module LDAP must be disabled.\n"; + die(1); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. @@ -285,8 +286,10 @@ class UserTest extends PHPUnit\Framework\TestCase //$this->assertNotEquals($user->date_creation, ''); $localobject->addrights(0, 'supplier_proposal'); $this->assertEquals($localobject->hasRight('member', ''), 0); - $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); - $this->assertEquals($localobject->hasRight('member', 'member'), 0);$this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0); + $this->assertEquals($localobject->hasRight('product', 'member', 'read'), 0); + $this->assertEquals($localobject->hasRight('member', 'member'), 0); + $this->assertEquals($localobject->hasRight('produit', 'member', 'read'), 0); return $localobject; } @@ -491,10 +494,10 @@ class UserTest extends PHPUnit\Framework\TestCase continue; } if (! $ignoretype && ($oVarsA[$sKey] !== $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } if ($ignoretype && ($oVarsA[$sKey] != $oVarsB[$sKey])) { - $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); + $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey]) ? get_class($oVarsA[$sKey]) : $oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey]) ? get_class($oVarsB[$sKey]) : $oVarsB[$sKey]); } } } diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 7ca227a0f84..8ef049ce9d9 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -203,7 +203,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase $WS_METHOD = 'createInvoice'; - $body = array ( + $body = array( "id" => null, "ref" => null, "ref_ext" => "ref-phpunit-2", @@ -354,7 +354,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase $WS_METHOD = 'updateInvoice'; // update status to 2 - $body = array ( + $body = array( "id" => null, "ref" => null, "ref_ext" => "ref-phpunit-2", diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 632728b998e..1e4734c9c3a 100644 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -171,7 +171,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase 'password'=>'admin', 'entity'=>''); - $body = array ( + $body = array( "id" => null, "ref" => "name", "ref_ext" => "12", diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 2ed16c238bb..b3126df7c02 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -193,7 +193,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase } print __METHOD__." count(result)=".count($result)."\n"; - $this->assertEquals('OK', empty($result['result']['result_code'])?'':$result['result']['result_code'], 'Test on ref admin'); + $this->assertEquals('OK', empty($result['result']['result_code']) ? '' : $result['result']['result_code'], 'Test on ref admin'); // Test URL $result=''; From 987d6c41b95a7bdd86f1f30bb28e9b823c1558cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 11:41:14 +0100 Subject: [PATCH 14/28] Fix with php-cs-fixer --- htdocs/accountancy/admin/account.php | 9 +- htdocs/accountancy/admin/accountmodel.php | 33 ++-- htdocs/accountancy/admin/categories_list.php | 30 ++-- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/accountancy/admin/journals_list.php | 28 ++-- htdocs/accountancy/admin/productaccount.php | 9 +- htdocs/accountancy/admin/subaccount.php | 7 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/export.php | 10 +- htdocs/accountancy/bookkeeping/list.php | 10 +- .../accountancy/bookkeeping/listbyaccount.php | 62 ++++++-- .../class/accountancycategory.class.php | 9 +- .../class/accountancyexport.class.php | 17 +- .../class/accountingjournal.class.php | 26 +++- .../accountancy/class/bookkeeping.class.php | 4 +- htdocs/accountancy/class/lettering.class.php | 35 +++-- htdocs/accountancy/closure/index.php | 46 ++++-- htdocs/accountancy/customer/index.php | 38 +++-- htdocs/accountancy/customer/list.php | 13 +- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 7 +- htdocs/accountancy/journal/bankjournal.php | 6 +- .../accountancy/journal/purchasesjournal.php | 60 +++---- htdocs/accountancy/journal/sellsjournal.php | 62 ++++---- htdocs/accountancy/journal/variousjournal.php | 28 +++- htdocs/accountancy/supplier/index.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 13 +- htdocs/adherents/admin/member.php | 4 +- htdocs/adherents/agenda.php | 6 +- htdocs/adherents/card.php | 27 ++-- htdocs/adherents/cartes/carte.php | 2 +- htdocs/adherents/class/adherent.class.php | 8 +- .../adherents/class/adherent_type.class.php | 12 +- htdocs/adherents/document.php | 2 +- htdocs/adherents/list.php | 6 +- htdocs/adherents/partnership.php | 4 +- htdocs/adherents/stats/geo.php | 6 +- htdocs/adherents/subscription/card.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- htdocs/adherents/type.php | 8 +- htdocs/adherents/type_translation.php | 4 +- htdocs/admin/accountant.php | 28 ++-- htdocs/admin/accounting.php | 2 +- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extsites.php | 9 +- htdocs/admin/agenda_other.php | 6 +- htdocs/admin/agenda_reminder.php | 4 +- htdocs/admin/agenda_xcal.php | 24 +-- htdocs/admin/bank.php | 5 +- htdocs/admin/bom.php | 6 +- htdocs/admin/boxes.php | 8 +- htdocs/admin/chequereceipts.php | 2 +- htdocs/admin/commande.php | 6 +- htdocs/admin/company.php | 2 +- htdocs/admin/company_socialnetworks.php | 2 +- htdocs/admin/const.php | 2 +- htdocs/admin/contract.php | 6 +- htdocs/admin/defaultvalues.php | 28 ++-- htdocs/admin/delais.php | 7 +- htdocs/admin/delivery.php | 8 +- htdocs/admin/dict.php | 147 +++++++++++------- .../class/PSWebServiceLibrary.class.php | 2 - htdocs/admin/emailcollector_card.php | 12 +- htdocs/admin/emailcollector_list.php | 4 +- htdocs/admin/eventorganization.php | 6 +- htdocs/admin/expedition.php | 8 +- htdocs/admin/expensereport.php | 6 +- htdocs/admin/expensereport_ik.php | 2 +- htdocs/admin/facture.php | 6 +- htdocs/admin/facture_situation.php | 2 +- htdocs/admin/fckeditor.php | 2 +- htdocs/admin/fichinter.php | 8 +- htdocs/admin/holiday.php | 6 +- htdocs/admin/hrm.php | 10 +- htdocs/admin/ihm.php | 14 +- htdocs/admin/index.php | 12 +- htdocs/admin/knowledgemanagement.php | 6 +- htdocs/admin/limits.php | 22 ++- htdocs/admin/mails.php | 16 +- htdocs/admin/mails_emailing.php | 10 +- htdocs/admin/mails_senderprofile_list.php | 5 +- htdocs/admin/mails_templates.php | 31 ++-- htdocs/admin/mails_ticket.php | 13 +- htdocs/admin/menus/edit.php | 3 +- htdocs/admin/modulehelp.php | 4 +- htdocs/admin/modules.php | 31 ++-- htdocs/admin/mrp.php | 6 +- htdocs/admin/notification.php | 2 +- htdocs/admin/openinghours.php | 2 +- htdocs/admin/payment.php | 2 +- htdocs/admin/propal.php | 8 +- htdocs/admin/reception_setup.php | 8 +- htdocs/admin/security_file.php | 2 +- htdocs/admin/security_other.php | 6 +- htdocs/admin/stock.php | 6 +- htdocs/admin/stocktransfer.php | 56 +++++-- htdocs/admin/supplier_invoice.php | 12 +- htdocs/admin/supplier_order.php | 2 +- htdocs/admin/supplier_payment.php | 20 +-- htdocs/admin/supplier_proposal.php | 8 +- htdocs/admin/syslog.php | 8 +- htdocs/admin/system/database.php | 3 +- htdocs/admin/system/dbtable.php | 2 +- htdocs/admin/system/dolibarr.php | 4 +- htdocs/admin/system/modules.php | 2 +- htdocs/admin/system/security.php | 13 +- htdocs/admin/system/web.php | 3 +- htdocs/admin/system/xdebug.php | 4 +- htdocs/admin/ticket.php | 4 +- htdocs/admin/tools/dolibarr_export.php | 9 +- htdocs/admin/tools/dolibarr_import.php | 38 ++--- htdocs/admin/tools/export.php | 2 +- htdocs/admin/tools/export_files.php | 2 +- htdocs/admin/tools/listevents.php | 41 +++-- htdocs/admin/translation.php | 7 +- htdocs/admin/user.php | 2 +- htdocs/admin/usergroup.php | 2 +- htdocs/admin/webhook.php | 8 +- htdocs/admin/website.php | 15 +- htdocs/admin/website_options.php | 4 +- htdocs/admin/workflow.php | 2 +- htdocs/admin/workstation.php | 8 +- htdocs/api/admin/explorer_withredoc.php | 2 +- htdocs/api/admin/index.php | 4 +- htdocs/api/class/api_documents.class.php | 18 +-- htdocs/api/class/api_login.class.php | 2 +- htdocs/api/class/api_setup.class.php | 34 ++-- htdocs/api/index.php | 2 +- htdocs/asset/accountancy_codes.php | 8 +- htdocs/asset/admin/setup.php | 8 +- htdocs/asset/agenda.php | 8 +- htdocs/asset/card.php | 18 ++- htdocs/asset/class/asset.class.php | 67 +++++--- .../class/assetaccountancycodes.class.php | 8 +- .../class/assetdepreciationoptions.class.php | 8 +- htdocs/asset/depreciation.php | 12 +- htdocs/asset/depreciation_options.php | 16 +- htdocs/asset/disposal.php | 12 +- htdocs/asset/document.php | 8 +- htdocs/asset/list.php | 18 ++- htdocs/asset/model/accountancy_codes.php | 12 +- htdocs/asset/model/agenda.php | 16 +- htdocs/asset/model/card.php | 16 +- htdocs/asset/model/depreciation_options.php | 16 +- htdocs/asset/model/list.php | 14 +- htdocs/asset/model/note.php | 16 +- htdocs/asset/note.php | 8 +- .../asset/tpl/accountancy_codes_view.tpl.php | 4 +- .../tpl/depreciation_options_edit.tpl.php | 2 +- 151 files changed, 1183 insertions(+), 709 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 2a6557be0b9..6f36d04d7b9 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -39,7 +39,7 @@ $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); $massaction = GETPOST('massaction', 'aZ09'); $optioncss = GETPOST('optioncss', 'alpha'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $search_account = GETPOST('search_account', 'alpha'); @@ -49,7 +49,7 @@ $search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); $search_import_key = GETPOST('search_import_key', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $confirm = GETPOST('confirm', 'alpha'); $chartofaccounts = GETPOST('chartofaccounts', 'int'); @@ -66,7 +66,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) { } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -111,7 +111,8 @@ $hookmanager->initHooks(array('accountancyadminaccount')); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index f88d48961a5..29cb1300f4c 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -47,7 +47,7 @@ if (isModEnabled('accounting')) { // Load translation files required by the page $langs->loadLangs(array('accountancy', 'admin', 'companies', 'compta', 'errors', 'holiday', 'hrm', 'resource')); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; $confirm = GETPOST('confirm', 'alpha'); $id = 31; $rowid = GETPOST('rowid', 'alpha'); @@ -59,7 +59,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"') $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"'); $listoffset = GETPOST('listoffset', 'alpha'); -$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; +$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000; $active = 1; $sortfield = GETPOST("sortfield", 'aZ09comma'); @@ -472,7 +472,8 @@ if ($id) { } if ($fieldlist[$field] == 'country') { if (in_array('region_id', $fieldlist)) { - print ' '; continue; + print ' '; + continue; } // For region page, we do not show the country input $valuetoshow = $langs->trans("Country"); } @@ -519,7 +520,8 @@ if ($id) { $tmpaction = 'create'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'add'); @@ -616,7 +618,8 @@ if ($id) { $tmpaction = 'edit'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit'); @@ -629,7 +632,8 @@ if ($id) { $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { foreach ($fieldlist as $field => $value) { @@ -669,9 +673,11 @@ if ($id) { } // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + $iserasable = 1; + $canbedisabled = 1; + $canbemodified = 1; // true by default - $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + $url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : ''); if ($param) { $url .= '&'.$param; } @@ -769,16 +775,17 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = 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]}:'')); + 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]} : '')); } else { - print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); + print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1); } print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } else { print ''; - $size = ''; $class = ''; + $size = ''; + $class = ''; if ($fieldlist[$field] == 'code') { $size = 'size="8" '; } @@ -791,7 +798,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') { $size = 'size="2" '; } - print ''; + print ''; print ''; } } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 59d9f219ee4..95714b0ce87 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php // Load translation files required by the page $langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; $confirm = GETPOST('confirm', 'alpha'); $id = 32; $rowid = GETPOST('rowid', 'alpha'); @@ -53,7 +53,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"') $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"'); $listoffset = GETPOST('listoffset', 'alpha'); -$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; +$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000; $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); @@ -581,7 +581,8 @@ if ($tabname[$id]) { $tmpaction = 'create'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add'); @@ -784,7 +785,8 @@ if ($resql) { $tmpaction = 'edit'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; // Actions if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -810,13 +812,16 @@ if ($resql) { } } else { // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + $iserasable = 1; + $canbedisabled = 1; + $canbemodified = 1; // true by default if (isset($obj->code)) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { - $iserasable = 0; $canbedisabled = 0; + $iserasable = 0; + $canbedisabled = 0; } } - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : ''); if ($param) { $url .= '&'.$param; } @@ -828,7 +833,8 @@ if ($resql) { $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; // Actions if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -872,7 +878,7 @@ if ($resql) { // Show value for field if ($showfield) { - print ''.dol_escape_htmltag($valuetoshow).''; + print ''.dol_escape_htmltag($valuetoshow).''; } } } @@ -981,10 +987,10 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co } } elseif ($fieldlist[$field] == 'category_type') { print ''; - print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); + print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''), 1); print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } else { print ''; $class = ''; @@ -994,7 +1000,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; } - print ''; + print ''; print ''; } } diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index d9b26c9b3ac..4cbb6045d74 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; $action = GETPOST('action', 'aZ09'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index ef8a0f2767f..02158f7536a 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "compta", "accountancy")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; $confirm = GETPOST('confirm', 'alpha'); $id = 35; $rowid = GETPOST('rowid', 'alpha'); @@ -56,7 +56,7 @@ $actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"') $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"'); $listoffset = GETPOST('listoffset', 'alpha'); -$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; +$listlimit = GETPOST('listlimit', 'int') > 0 ? GETPOST('listlimit', 'int') : 1000; $active = 1; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -452,7 +452,8 @@ if ($id) { $tmpaction = 'create'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { fieldListJournal($fieldlist, $obj, $tabname[$id], 'add'); @@ -561,7 +562,8 @@ if ($id) { $tmpaction = 'edit'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; // Show fields if (empty($reshook)) { @@ -580,7 +582,8 @@ if ($id) { $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks - $error = $hookmanager->error; $errors = $hookmanager->errors; + $error = $hookmanager->error; + $errors = $hookmanager->errors; if (empty($reshook)) { $langs->load("accountancy"); @@ -607,7 +610,9 @@ if ($id) { } // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + $iserasable = 1; + $canbedisabled = 1; + $canbemodified = 1; // true by default if (isset($obj->code) && $id != 10) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; @@ -617,7 +622,7 @@ if ($id) { $canbemodified = $iserasable; - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : ''); if ($param) { $url .= '&'.$param; } @@ -700,13 +705,14 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'nature') { print ''; - print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); + print $form->selectarray('nature', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')); print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } else { print ''; - $size = ''; $class = ''; + $size = ''; + $class = ''; if ($fieldlist[$field] == 'code') { $class = 'maxwidth100'; } @@ -716,7 +722,7 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') { $size = 'size="2" '; } - print ''; + print ''; print ''; } } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index b6923b36022..ca5516547ec 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -85,7 +85,7 @@ if (empty($accounting_product_mode)) { $accounting_product_mode = 'ACCOUNTANCY_SELL'; } -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalInt('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -136,7 +136,8 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -184,7 +185,9 @@ if ($action == 'update') { //$msg .= '
' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '
'; $arrayofdifferentselectedvalues = array(); - $cpt = 0; $ok = 0; $ko = 0; + $cpt = 0; + $ok = 0; + $ko = 0; foreach ($chk_prod as $productid) { $accounting_account_id = GETPOST('codeventil_'.$productid); diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 8c660feb769..69c2f458786 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -40,7 +40,7 @@ $rowid = GETPOST('rowid', 'int'); $massaction = GETPOST('massaction', 'aZ09'); $optioncss = GETPOST('optioncss', 'alpha'); $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search $search_subaccount = GETPOST('search_subaccount', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -55,7 +55,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) { } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -89,7 +89,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 6b5f09693ce..a1881cf212d 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -64,7 +64,7 @@ if ($search_accountancy_code_end == - 1) { $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 105a86c6b69..5323c3c9cce 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -134,7 +134,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -237,7 +237,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { $param = ''; if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; @@ -1028,7 +1029,8 @@ print "\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');} + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); +} 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); } @@ -1093,7 +1095,7 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $total_debit = 0; $total_credit = 0; -$totalarray['val'] = array (); +$totalarray['val'] = array(); $totalarray['val']['totaldebit'] = 0; $totalarray['val']['totalcredit'] = 0; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 98fb46ff9c2..f722e32df08 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -129,7 +129,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -225,7 +225,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { $param = ''; if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') { $massaction = ''; @@ -979,7 +980,8 @@ print "\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');} + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); +} 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); } @@ -1044,7 +1046,7 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $total_debit = 0; $total_credit = 0; -$totalarray['val'] = array (); +$totalarray['val'] = array(); $totalarray['val']['totaldebit'] = 0; $totalarray['val']['totalcredit'] = 0; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index ab2e186b927..864508e99d8 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -966,7 +966,7 @@ $displayed_account_number = null; // Start with undefined to be able to distingu $i = 0; $totalarray = array(); -$totalarray['val'] = array (); +$totalarray['val'] = array(); $totalarray['nbfield'] = 0; $total_debit = 0; $total_credit = 0; @@ -993,18 +993,40 @@ while ($i < min($num, $limit)) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { $colspan++; } - if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.piece_num']['checked'])) { + $colspan++; + } + if (!empty($arrayfields['t.code_journal']['checked'])) { + $colspan++; + } + if (!empty($arrayfields['t.doc_date']['checked'])) { + $colspan++; + } + if (!empty($arrayfields['t.doc_ref']['checked'])) { + $colspan++; + } + if (!empty($arrayfields['t.label_operation']['checked'])) { + $colspan++; + } + if (!empty($arrayfields['t.lettering_code']['checked'])) { + $colspan++; + } - if (!empty($arrayfields['t.balance']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.import_key']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.balance']['checked'])) { + $colspanend++; + } + if (!empty($arrayfields['t.date_export']['checked'])) { + $colspanend++; + } + if (!empty($arrayfields['t.date_validated']['checked'])) { + $colspanend++; + } + if (!empty($arrayfields['t.lettering_code']['checked'])) { + $colspanend++; + } + if (!empty($arrayfields['t.import_key']['checked'])) { + $colspanend++; + } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { $colspan++; $colspanend--; @@ -1022,7 +1044,9 @@ while ($i < min($num, $limit)) { } print ''.price(price2num($sous_total_debit, 'MT')).''; print ''.price(price2num($sous_total_credit, 'MT')).''; - if ($colspanend > 0) print ''; + if ($colspanend > 0) { + print ''; + } print ''; // Show balance of last shown account $balance = $sous_total_debit - $sous_total_credit; @@ -1039,7 +1063,9 @@ while ($i < min($num, $limit)) { print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print ''; } - if ($colspanend > 0) print ''; + if ($colspanend > 0) { + print ''; + } print ''; } @@ -1310,7 +1336,9 @@ if ($num > 0 && $colspan > 0) { print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; print ''.price(price2num($sous_total_debit, 'MT')).''; print ''.price(price2num($sous_total_credit, 'MT')).''; - if ($colspanend > 0) print ''; + if ($colspanend > 0) { + print ''; + } print ''; // Show balance of last shown account $balance = $sous_total_debit - $sous_total_credit; @@ -1327,7 +1355,9 @@ if ($num > 0 && $colspan > 0) { print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print ''; } - if ($colspanend > 0) print ''; + if ($colspanend > 0) { + print ''; + } print ''; } diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 208888cdf7d..40354b297b2 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -228,7 +228,8 @@ class AccountancyCategory // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -369,7 +370,8 @@ class AccountancyCategory // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -407,7 +409,8 @@ class AccountancyCategory // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 5252f548b27..1b08cc85ed6 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -489,7 +489,7 @@ class AccountancyExport case self::$EXPORT_TYPE_FEC2: $archiveFileList = $this->exportFEC2($TData, $exportFile, $archiveFileList, $withAttachment); break; - case self::$EXPORT_TYPE_ISUITEEXPERT : + case self::$EXPORT_TYPE_ISUITEEXPERT: $this->exportiSuiteExpert($TData, $exportFile); break; default: @@ -1003,7 +1003,9 @@ class AccountancyExport // skip native invoice pdfs (canelle) // We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr. if ($line->doc_type == 'supplier_invoice') { - if ($fileFound['name'] === $objectFileName.'.pdf') continue; + if ($fileFound['name'] === $objectFileName.'.pdf') { + continue; + } } elseif ($fileFound['name'] !== $objectFileName.'.pdf') { continue; } @@ -1141,7 +1143,6 @@ class AccountancyExport */ public function exportEbp($objectLines, $exportFile = null) { - $separator = ','; $end_line = "\n"; @@ -1472,7 +1473,9 @@ class AccountancyExport // skip native invoice pdfs (canelle) // We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr. if ($line->doc_type == 'supplier_invoice') { - if ($fileFound['name'] === $objectFileName.'.pdf') continue; + if ($fileFound['name'] === $objectFileName.'.pdf') { + continue; + } } elseif ($fileFound['name'] !== $objectFileName.'.pdf') { continue; } @@ -1681,7 +1684,9 @@ class AccountancyExport // skip native invoice pdfs (canelle) // We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr. if ($line->doc_type == 'supplier_invoice') { - if ($fileFound['name'] === $objectFileName.'.pdf') continue; + if ($fileFound['name'] === $objectFileName.'.pdf') { + continue; + } } elseif ($fileFound['name'] !== $objectFileName.'.pdf') { continue; } @@ -1883,7 +1888,6 @@ class AccountancyExport */ public function exportLDCompta($objectLines, $exportFile = null) { - $separator = ';'; $end_line = "\r\n"; @@ -2490,7 +2494,6 @@ class AccountancyExport */ public function exportGestimumV5($objectLines, $exportFile = null) { - $separator = ','; $end_line = "\r\n"; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 74cdb100516..797b9e909f7 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -84,12 +84,12 @@ class AccountingJournal extends CommonObject /** * @var array Accounting account cached */ - static public $accounting_account_cached = array(); + public static $accounting_account_cached = array(); /** * @var array Nature mapping */ - static public $nature_maps = array( + public static $nature_maps = array( 1 => 'variousoperations', 2 => 'sells', 3 => 'purchases', @@ -386,8 +386,12 @@ class AccountingJournal extends CommonObject global $hookmanager; // Clean parameters - if (empty($type)) $type = 'view'; - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; + if (empty($type)) { + $type = 'view'; + } + if (empty($in_bookkeeping)) { + $in_bookkeeping = 'notyet'; + } $data = array(); @@ -659,9 +663,11 @@ class AccountingJournal extends CommonObject $lines[0][$accountancy_code_depreciation_asset] = -$last_cumulative_amount_ht; $lines[0][$accountancy_code_asset] = $element_static->acquisition_value_ht; - $disposal_amount_vat = $disposal_subject_to_vat ? (double) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0; + $disposal_amount_vat = $disposal_subject_to_vat ? (float) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0; $lines[1][$accountancy_code_receivable_on_assignment] = -($disposal_amount + $disposal_amount_vat); - if ($disposal_subject_to_vat) $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat; + if ($disposal_subject_to_vat) { + $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat; + } $lines[1][$accountancy_code_proceeds_from_sales] = $disposal_amount; foreach ($lines as $lines_block) { @@ -925,7 +931,9 @@ class AccountingJournal extends CommonObject { global $conf, $langs, $hookmanager; - if (empty($sep)) $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + if (empty($sep)) { + $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + } $out = ''; // Hook @@ -976,7 +984,9 @@ class AccountingJournal extends CommonObject ); } - if (!empty($header)) $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; + if (!empty($header)) { + $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; + } foreach ($journal_data as $element_id => $element) { foreach ($element['blocks'] as $lines) { foreach ($lines as $line) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index b0e2cea6c76..b9bd1b75780 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2474,7 +2474,9 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, label, date_start, date_end, statut"; $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; $sql .= " WHERE entity = " . ((int) $conf->entity); - if (!empty($filter)) $sql .= " AND (" . $filter . ')'; + if (!empty($filter)) { + $sql .= " AND (" . $filter . ')'; + } $sql .= $this->db->order('date_start', 'ASC'); $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 5cda6cad5b4..e31b6e803e7 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -469,9 +469,15 @@ class Lettering extends BookKeeping $group_error++; break; } - if (!isset($lettering_code)) $lettering_code = (string) $line_infos['lettering_code']; - if (!empty($line_infos['lettering_code'])) $do_it = true; - } elseif (!empty($line_infos['lettering_code'])) $do_it = false; + if (!isset($lettering_code)) { + $lettering_code = (string) $line_infos['lettering_code']; + } + if (!empty($line_infos['lettering_code'])) { + $do_it = true; + } + } elseif (!empty($line_infos['lettering_code'])) { + $do_it = false; + } } // Check balance amount @@ -482,8 +488,11 @@ class Lettering extends BookKeeping // Lettering/Unlettering the group of bookkeeping lines if (!$group_error && $do_it) { - if ($unlettering) $result = $this->deleteLettering($bookkeeping_lines); - else $result = $this->updateLettering($bookkeeping_lines); + if ($unlettering) { + $result = $this->deleteLettering($bookkeeping_lines); + } else { + $result = $this->updateLettering($bookkeeping_lines); + } if ($result < 0) { $group_error++; } elseif ($result > 0) { @@ -534,7 +543,9 @@ class Lettering extends BookKeeping $sql .= " AND pn.piece_num = ab.piece_num"; $sql .= " )"; } - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; + if ($only_has_subledger_account) { + $sql .= " AND ab.subledger_account != ''"; + } dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG); $resql = $this->db->query($sql); @@ -608,7 +619,9 @@ class Lettering extends BookKeeping $sql .= " AND dpn.piece_num = ab.piece_num"; $sql .= " )"; $sql .= ")"; - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; + if ($only_has_subledger_account) { + $sql .= " AND ab.subledger_account != ''"; + } dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG); $resql = $this->db->query($sql); @@ -629,7 +642,9 @@ class Lettering extends BookKeeping } $this->db->free($resql); - if (!empty($group)) $grouped_lines[] = $group; + if (!empty($group)) { + $grouped_lines[] = $group; + } } } @@ -831,7 +846,9 @@ class Lettering extends BookKeeping foreach ($element_ids as $element_id) { // Continue if element id in not found - if (!isset($link_by_element[$element_id])) continue; + if (!isset($link_by_element[$element_id])) { + continue; + } // Set the element in the current group $current_group[$element_id] = $element_id; diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 37592abb2d2..3920cd1ef54 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -184,9 +184,16 @@ if (isset($current_fiscal_period)) { 'value' => $current_fiscal_period['date_end'] ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], - $langs->trans('ValidateMovements'), $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")), - 'confirm_step_1', $form_question, '', 1, 300); + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], + $langs->trans('ValidateMovements'), + $langs->trans('DescValidateMovements', $langs->transnoentitiesnoconv("RegistrationInAccounting")), + 'confirm_step_1', + $form_question, + '', + 1, + 300 + ); } elseif ($action == 'step_2') { $form_question = array(); @@ -214,9 +221,16 @@ if (isset($current_fiscal_period)) { 'value' => 0 ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], - $langs->trans('AccountancyClosureClose'), $langs->trans('AccountancyClosureConfirmClose'), - 'confirm_step_2', $form_question, '', 1, 300); + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], + $langs->trans('AccountancyClosureClose'), + $langs->trans('AccountancyClosureConfirmClose'), + 'confirm_step_2', + $form_question, + '', + 1, + 300 + ); } elseif ($action == 'step_3') { $form_question = array(); @@ -249,9 +263,15 @@ if (isset($current_fiscal_period)) { 'label' => $langs->trans('DateEnd'), 'value' => $current_fiscal_period['date_end'] ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], - $langs->trans('AccountancyClosureAccountingReversal'), $langs->trans('AccountancyClosureConfirmAccountingReversal'), - 'confirm_step_3', $form_question, '', 1, 300 + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'], + $langs->trans('AccountancyClosureAccountingReversal'), + $langs->trans('AccountancyClosureConfirmAccountingReversal'), + 'confirm_step_3', + $form_question, + '', + 1, + 300 ); } } @@ -309,7 +329,9 @@ if (isset($current_fiscal_period)) { print ''; $nb_years = is_array($count_by_month['list']) ? count($count_by_month['list']) : 0; - if ($nb_years > 1) print '' . $langs->trans("Year") . ''; + if ($nb_years > 1) { + print '' . $langs->trans("Year") . ''; + } for ($i = 1; $i <= 12; $i++) { print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ''; } @@ -319,7 +341,9 @@ if (isset($current_fiscal_period)) { if (is_array($count_by_month['list'])) { foreach ($count_by_month['list'] as $info) { print ''; - if ($nb_years > 1) print '' . $info['year'] . ''; + if ($nb_years > 1) { + print '' . $info['year'] . ''; + } for ($i = 1; $i <= 12; $i++) { print '' . ((int) $info['count'][$i]) . ''; } diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 61c945450e9..14e69593c02 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -288,7 +288,7 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); if ($nbbindfailed) { setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } @@ -666,15 +666,21 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, - " (".$db->ifsql("fd.total_ht < 0", + $sql .= " SUM(".$db->ifsql( + "MONTH(f.datef)=".$j, + " (".$db->ifsql( + "fd.total_ht < 0", " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! - " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")", - 0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; + " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" + ).")", + 0 + ).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; } - $sql .= " SUM(".$db->ifsql("fd.total_ht < 0", + $sql .= " SUM(".$db->ifsql( + "fd.total_ht < 0", " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! - " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total"; + " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" + ).") as total"; } else { $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,"; for ($i = 1; $i <= 12; $i++) { @@ -682,15 +688,21 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa if ($j > 12) { $j -= 12; } - $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, - " (".$db->ifsql("fd.total_ht < 0", + $sql .= " SUM(".$db->ifsql( + "MONTH(f.datef)=".$j, + " (".$db->ifsql( + "fd.total_ht < 0", " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))", - " (fd.total_ht - (fd.buy_price_ht * fd.qty))").")", - 0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; + " (fd.total_ht - (fd.buy_price_ht * fd.qty))" + ).")", + 0 + ).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; } - $sql .= " SUM(".$db->ifsql("fd.total_ht < 0", + $sql .= " SUM(".$db->ifsql( + "fd.total_ht < 0", " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty)))", - " (fd.total_ht - (fd.buy_price_ht * fd.qty))").") as total"; + " (fd.total_ht - (fd.buy_price_ht * fd.qty))" + ).") as total"; } $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index ded4fc84db6..3e312a220ef 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -80,7 +80,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -126,7 +126,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -694,7 +695,7 @@ if ($result) { if ($product_static->tva_tx !== $facture_static_det->tva_tx && price2num($product_static->tva_tx) && price2num($facture_static_det->tva_tx)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export $code_vat_differ = 'warning bold'; } - print ''; + print ''; print vatrate($facture_static_det->tva_tx.($facture_static_det->vat_src_code ? ' ('.$facture_static_det->vat_src_code.')' : '')); print ''; @@ -714,7 +715,8 @@ if ($result) { print ''; // First show default account for any products $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; $ttype = 'help'; + $shelp = ''; + $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { @@ -731,7 +733,8 @@ if ($result) { if ($product_static->id > 0) { print '
'; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; $ttype = 'help'; + $shelp = ''; + $ttype = 'help'; if ($suggestedaccountingaccountfor == 'eec') { $shelp = $langs->trans("SaleEEC"); } elseif ($suggestedaccountingaccountfor == 'eecwithvat') { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index db31387b78e..0f0b5ec146c 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -166,7 +166,7 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); if ($nbbindfailed) { setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index f862cc5f226..2f9c4e70e8e 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -59,7 +59,7 @@ $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_s $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 21d58356c3e..a1d405f5725 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -73,7 +73,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -119,7 +119,8 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -482,7 +483,7 @@ if ($result) { // Fees label print ''; - print ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))); + print($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))); print ''; // Fees description -- Can be null diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index eeeb28d5179..e9cb8de0705 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -315,7 +315,9 @@ if ($result) { } // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { - if ($links[$key]['type'] == 'user' && !$is_sc) continue; + if ($links[$key]['type'] == 'user' && !$is_sc) { + continue; + } if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines @@ -1105,7 +1107,7 @@ if (empty($action) || $action == 'view') { if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { - print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + print($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); print $desc; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 214b548949b..ed03d708b79 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -216,7 +216,7 @@ if ($result) { $vatdata = $vatdata_cache[$tax_id]; } else { $vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0); - $vatdata_cache[$tax_id] = $vatdata; + $vatdata_cache[$tax_id] = $vatdata; } $compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); $compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); @@ -293,9 +293,9 @@ if ($result) { $tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] = 0; } - $rcvat = (double) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT'); - $rclocalvat1 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT'); - $rclocalvat2 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT'); + $rcvat = (float) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT'); + $rclocalvat1 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT'); + $rclocalvat2 = (float) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT'); $tabrctva[$obj->rowid][$rcd_compta_tva] += $rcvat; $tabrctva[$obj->rowid][$rcc_compta_tva] -= $rcvat; @@ -799,19 +799,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! // Third party foreach ($tabttc[$key] as $k => $mt) { //if ($mt) { - print '"'.$key.'"'.$sep; - print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.$langs->trans("Thirdparty").'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep; - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; - print '"'.$journal.'"'; - print "\n"; + print '"'.$key.'"'.$sep; + print '"'.$date.'"'.$sep; + print '"'.$val["refsologest"].'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.$langs->trans("Thirdparty").'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.$langs->trans("Thirdparty").'"'.$sep; + print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; + print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; + print '"'.$journal.'"'; + print "\n"; //} } @@ -820,19 +820,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); //if ($mt) { - print '"'.$key.'"'.$sep; - print '"'.$date.'"'.$sep; - print '"'.$val["refsologest"].'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - print '""'.$sep; - print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep; - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; - print '"'.$journal.'"'; - print "\n"; + print '"'.$key.'"'.$sep; + print '"'.$date.'"'.$sep; + print '"'.$val["refsologest"].'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '""'.$sep; + print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$val["refsuppliersologest"].' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep; + print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; + print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; + print '"'.$journal.'"'; + print "\n"; //} } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9a4e5561f46..5ca5c164007 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -219,7 +219,7 @@ if ($result) { $vatdata = $vatdata_cache[$tax_id]; } else { $vatdata = getTaxesFromId($tax_id, $mysoc, $mysoc, 0); - $vatdata_cache[$tax_id] = $vatdata; + $vatdata_cache[$tax_id] = $vatdata; } $compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva); $compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva); @@ -249,7 +249,7 @@ if ($result) { } } - $revenuestamp = (double) price2num($obj->revenuestamp, 'MT'); + $revenuestamp = (float) price2num($obj->revenuestamp, 'MT'); // Invoice lines $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); @@ -291,7 +291,7 @@ if ($result) { // Move a part of the retained warrenty into the account of warranty if (getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY') && $obj->retained_warranty > 0) { - $retained_warranty = (double) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value) + $retained_warranty = (float) price2num($total_ttc * $obj->retained_warranty / 100, 'MT'); // Calculate the amount of warrenty for this line (using the percent value) $tabwarranty[$obj->rowid][$compta_soc] += $retained_warranty; $total_ttc -= $retained_warranty; } @@ -309,7 +309,7 @@ if ($result) { if (!empty($revenuestamp)) { $sqlrevenuestamp = "SELECT accountancy_code_sell FROM ".MAIN_DB_PREFIX."c_revenuestamp"; $sqlrevenuestamp .= " WHERE fk_pays = ".((int) $mysoc->country_id); - $sqlrevenuestamp .= " AND taux = ".((double) $revenuestamp); + $sqlrevenuestamp .= " AND taux = ".((float) $revenuestamp); $sqlrevenuestamp .= " AND active = 1"; $resqlrevenuestamp = $db->query($sqlrevenuestamp); @@ -879,19 +879,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! // Third party foreach ($tabttc[$key] as $k => $mt) { //if ($mt) { - print '"'.$key.'"'.$sep; - print '"'.$date.'"'.$sep; - print '"'.$val["ref"].'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep; - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; - print '"'.$langs->trans("Thirdparty").'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep; - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; - print '"'.$journal.'"'; - print "\n"; + print '"'.$key.'"'.$sep; + print '"'.$date.'"'.$sep; + print '"'.$val["ref"].'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER')).'"'.$sep; + print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; + print '"'.$langs->trans("Thirdparty").'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.$invoicestatic->ref.' - '.$langs->trans("Thirdparty").'"'.$sep; + print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; + print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; + print '"'.$journal.'"'; + print "\n"; //} } @@ -900,19 +900,19 @@ if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); //if ($mt) { - print '"'.$key.'"'.$sep; - print '"'.$date.'"'.$sep; - print '"'.$val["ref"].'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; - print '""'.$sep; - print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep; - print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep; - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; - print '"'.$journal.'"'; - print "\n"; + print '"'.$key.'"'.$sep; + print '"'.$date.'"'.$sep; + print '"'.$val["ref"].'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 32)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; + print '""'.$sep; + print '"'.utf8_decode(dol_trunc($accountingaccount->label, 32)).'"'.$sep; + print '"'.utf8_decode(dol_trunc($companystatic->name, 16)).' - '.dol_trunc($accountingaccount->label, 32).'"'.$sep; + print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; + print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; + print '"'.$journal.'"'; + print "\n"; //} } @@ -1280,7 +1280,7 @@ if (empty($action) || $action == 'view') { //var_dump($arrayofvat[$key]); var_dump($key); var_dump($k); $tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : join(', ', $def_tva[$key][$k])); print ' - '.$langs->trans("Taxes").' '.$tmpvatrate.' %'; - print ($numtax ? ' - Localtax '.$numtax : ''); + print($numtax ? ' - Localtax '.$numtax : ''); print ""; print ''.($mt < 0 ? price(-$mt) : '').""; print ''.($mt >= 0 ? price($mt) : '').""; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index f7d1831ee87..7d496cee5a0 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -76,8 +76,12 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) } $data_type = 'view'; -if ($action == 'writebookkeeping') $data_type = 'bookkeeping'; -if ($action == 'exportcsv') $data_type = 'csv'; +if ($action == 'writebookkeeping') { + $data_type = 'bookkeeping'; +} +if ($action == 'exportcsv') { + $data_type = 'csv'; +} $journal_data = $object->getData($user, $data_type, $date_start, $date_end, $in_bookkeeping); if (!is_array($journal_data)) { setEventMessages($object->error, $object->errors, 'errors'); @@ -247,7 +251,9 @@ if ($object->nature == 4) { // Bank journal print '
' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); print ' : ' . $langs->trans("AccountancyAreaDescBank", 9, '' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . ''); } - } else dol_print_error($db); + } else { + dol_print_error($db); + } } // Button to write into Ledger @@ -288,8 +294,12 @@ print ' '; $object_label = $langs->trans("ObjectsRef"); -if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef"); -if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef"); +if ($object->nature == 2 || $object->nature == 3) { + $object_label = $langs->trans("InvoiceRef"); +} +if ($object->nature == 5) { + $object_label = $langs->trans("ExpenseReportRef"); +} // Show result array @@ -305,7 +315,9 @@ print '' . $langs->trans("Piece") . ' (' . $object_label . ')'; print '' . $langs->trans("AccountAccounting") . ''; print '' . $langs->trans("SubledgerAccount") . ''; print '' . $langs->trans("LabelOperation") . ''; -if ($object->nature == 4) print '' . $langs->trans("PaymentMode") . ''; // bank +if ($object->nature == 4) { + print '' . $langs->trans("PaymentMode") . ''; +} // bank print '' . $langs->trans("AccountingDebit") . ''; print '' . $langs->trans("AccountingCredit") . ''; print "\n"; @@ -320,7 +332,9 @@ if (is_array($journal_data) && !empty($journal_data)) { print '' . $line['account_accounting'] . ''; print '' . $line['subledger_account'] . ''; print '' . $line['label_operation'] . ''; - if ($object->nature == 4) print '' . $line['payment_mode'] . ''; + if ($object->nature == 4) { + print '' . $line['payment_mode'] . ''; + } print '' . $line['debit'] . ''; print '' . $line['credit'] . ''; print ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 5dbfa51a470..fd07ac82704 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -286,7 +286,7 @@ if ($action == 'validatehistory') { $db->rollback(); } else { $db->commit(); - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); if ($nbbindfailed) { setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); } diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 7709806fbb2..ac35e048744 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -67,7 +67,7 @@ $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4e7a4b801f6..6573f18503f 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -77,7 +77,7 @@ $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -128,7 +128,8 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -699,7 +700,7 @@ if ($result) { //if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export // $code_vat_differ = 'warning bold'; //} - print ''; + print ''; print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1); print ''; @@ -718,7 +719,8 @@ if ($result) { // Found accounts print ''; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; $ttype = 'help'; + $shelp = ''; + $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { @@ -734,7 +736,8 @@ if ($result) { if ($product_static->id > 0) { print '
'; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; $ttype = 'help'; + $shelp = ''; + $ttype = 'help'; if ($suggestedaccountingaccountfor == 'eec') { $shelp = $langs->trans("SaleEEC"); } elseif ($suggestedaccountingaccountfor == 'eecwithvat') { diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 0ec4a3afdbf..06cd83397c4 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -269,7 +269,7 @@ foreach ($dirModMember as $dirroot) { dol_syslog($e->getMessage(), LOG_ERR); continue; } - $modCodeMember = new $file; + $modCodeMember = new $file(); // Show modules according to features level if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; @@ -518,7 +518,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print ''; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 90f36033f71..ef217d65871 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -38,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->loadLangs(array('companies', 'members')); // Get Parameters -$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int'); +$id = GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('rowid', 'int'); // Pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -64,7 +64,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0aa5d7b88fa..4ecdad298ff 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -57,7 +57,7 @@ $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $rowid = GETPOST('rowid', 'int'); -$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; +$id = GETPOST('id') ? GETPOST('id', 'int') : $rowid; $typeid = GETPOST('typeid', 'int'); $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); @@ -616,7 +616,7 @@ if (empty($reshook)) { } } } - $action = ($result < 0 || !$error) ? '' : 'create'; + $action = ($result < 0 || !$error) ? '' : 'create'; if (!$error && $backtopage) { header("Location: ".$backtopage); @@ -1022,7 +1022,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans("MemberNature")."\n"; - print $form->selectarray("morphy", $morphys, (GETPOST('morphy', 'alpha') ?GETPOST('morphy', 'alpha') : $object->morphy), 1, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray("morphy", $morphys, (GETPOST('morphy', 'alpha') ? GETPOST('morphy', 'alpha') : $object->morphy), 1, 0, 0, '', 0, 0, 0, '', '', 1); print "\n"; // Company @@ -1058,7 +1058,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town @@ -1154,11 +1154,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($action == 'edit') { $res = $object->fetch($id); if ($res < 0) { - dol_print_error($db, $object->error); exit; + dol_print_error($db, $object->error); + exit; } $res = $object->fetch_optionals(); if ($res < 0) { - dol_print_error($db); exit; + dol_print_error($db); + exit; } $adht = new AdherentType($db); @@ -1307,7 +1309,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Website print ''.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).''; - print ''.img_picto('', 'globe', 'class="pictofixedwidth"').''; + print ''.img_picto('', 'globe', 'class="pictofixedwidth"').''; // Address print ''.$langs->trans("Address").''; @@ -1356,7 +1358,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!$value['active']) { break; } - print ''.$langs->trans($value['label']).''; + print ''.$langs->trans($value['label']).''; } } @@ -1435,17 +1437,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($id > 0 && $action != 'edit') { $res = $object->fetch($id); if ($res < 0) { - dol_print_error($db, $object->error); exit; + dol_print_error($db, $object->error); + exit; } $res = $object->fetch_optionals(); if ($res < 0) { - dol_print_error($db); exit; + dol_print_error($db); + exit; } $adht = new AdherentType($db); $res = $adht->fetch($object->typeid); if ($res < 0) { - dol_print_error($db); exit; + dol_print_error($db); + exit; } diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 7809e791c3f..fcfe87209c0 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -306,7 +306,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $_Avery_Labels[$codecards]['name']; } asort($arrayoflabels); -print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ? GETPOST('model') : (!getDolGlobalString('ADHERENT_CARD_TYPE') ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'.$langs->trans("Login").': '; print '
'; print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7926675123a..6a86ba3018d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -634,7 +634,7 @@ class Adherent extends CommonObject try { require_once $modfile; $modname = getDolGlobalString('MEMBER_CODEMEMBER_ADDON'); - $modCodeMember = new $modname; + $modCodeMember = new $modname(); $this->ref = $modCodeMember->getNextValue($mysoc, $this); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); @@ -728,7 +728,7 @@ class Adherent extends CommonObject $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); - $this->url = $this->url ?clean_url($this->url, 0) : ''; + $this->url = $this->url ? clean_url($this->url, 0) : ''; $this->setUpperOrLowerCase(); // Check parameters if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && !isValidEMail($this->email)) { @@ -2328,7 +2328,7 @@ class Adherent extends CommonObject $label = $langs->trans("ShowUser"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } @@ -3229,7 +3229,7 @@ class Adherent extends CommonObject return $nbko; } - /** + /** * Return clicable link of object (with eventually picto) * * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0a15cd66524..c75ec565b35 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -276,7 +276,7 @@ class AdherentType extends CommonObject return 1; } - /** + /** * Delete a language for this member type * * @param string $langtodelete Language code to delete @@ -401,7 +401,7 @@ class AdherentType extends CommonObject $sql .= "caneditamount = ".((int) $this->caneditamount).","; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',"; - $sql .= "vote = ".(integer) $this->db->escape($this->vote).","; + $sql .= "vote = ".(int) $this->db->escape($this->vote).","; $sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql .= " WHERE rowid =".((int) $this->id); @@ -469,7 +469,9 @@ class AdherentType extends CommonObject // Call trigger $result = $this->call_trigger('MEMBER_TYPE_DELETE', $user); if ($result < 0) { - $error++; $this->db->rollback(); return -2; + $error++; + $this->db->rollback(); + return -2; } // End call triggers @@ -765,7 +767,7 @@ class AdherentType extends CommonObject } } $linkstart = ''; $linkend = ''; @@ -775,7 +777,7 @@ class AdherentType extends CommonObject $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (' class="'.(($withpicto != 2) ? 'paddingright' : '').'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label); + $result .= ($maxlen ? dol_trunc($this->label, $maxlen) : $this->label); } $result .= $linkend; diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index a658e942cb9..1f02258fae9 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -123,7 +123,7 @@ if ($id > 0) { $result = $membert->fetch($object->typeid); if ($result > 0) { // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index a3f5498aa08..cfe398b920b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -47,7 +47,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $optioncss = GETPOST('optioncss', 'aZ'); $mode = GETPOST('mode', 'alpha'); @@ -91,14 +91,14 @@ if ($statut != '') { $search_status = $statut; // For backward compatibility } -$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); if ($search_status < -2) { $search_status = ''; } // Pagination parameters -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index 38f0886d2f9..aaed1e30234 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -129,7 +129,9 @@ if (empty($reshook)) { } $object->fields['fk_member']['visible'] = 0; -if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1; +if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) { + $object->fields['reason_decline_or_cancel']['visible'] = 1; +} $object->fields['note_public']['visible'] = 1; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 56789510e88..4dc2f756df1 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -32,7 +32,7 @@ $graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700); $mapratio = 0.5; $graphheight = round($graphwidth * $mapratio); -$mode = GETPOST('mode') ?GETPOST('mode') : ''; +$mode = GETPOST('mode') ? GETPOST('mode') : ''; // Security check @@ -77,7 +77,7 @@ if ($mode == 'memberbyregion') { llxHeader('', $title, '', '', 0, 0, $arrayjs); -print load_fiche_titre($title, '', $memberstatic->picto); +print load_fiche_titre($title, '', $memberstatic->picto); //dol_mkdir($dir); @@ -173,7 +173,7 @@ if ($mode) { if ($mode == 'memberbyregion') { //+ $data[] = array( 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? img_picto('', DOL_URL_ROOT.'/theme/common/flags/'.strtolower($obj->code).'.png', '', 1).' '.$langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : ''.$langs->trans("Unknown").'')), - 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label :''.$langs->trans("Unknown").'')), + '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), diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index d1b5e9c9514..850cd20b831 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -50,7 +50,7 @@ $typeid = (int) GETPOST('typeid', 'int'); $amount = price2num(GETPOST('amount', 'alpha'), 'MT'); if (!$user->hasRight('adherent', 'cotisation', 'lire')) { - accessforbidden(); + accessforbidden(); } $permissionnote = $user->hasRight('adherent', 'cotisation', 'creer'); // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index cc662e441da..aacb12729f3 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -43,7 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) -$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1); +$statut = (GETPOSTISSET("statut") ? GETPOST("statut", "alpha") : 1); $search_ref = GETPOST('search_ref', 'alpha'); $search_type = GETPOST('search_type', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index fa06b3cafd7..91f3fc328d4 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -200,7 +200,7 @@ if ($action == 'update' && $user->hasRight('adherent', 'configurer')) { $object->note_public = trim($comment); $object->note_private = ''; $object->mail_valid = trim($mail_valid); - $object->vote = (boolean) trim($vote); + $object->vote = (bool) trim($vote); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); @@ -534,7 +534,7 @@ if ($rowid > 0) { // Amount print ''.$langs->trans("Amount").''; - print ((is_null($object->amount) || $object->amount === '') ? '' : ''.price($object->amount).''); + print((is_null($object->amount) || $object->amount === '') ? '' : ''.price($object->amount).''); print ''; print ''.$form->textwithpicto($langs->trans("CanEditAmountShort"), $langs->transnoentities("CanEditAmount")).''; @@ -551,7 +551,7 @@ if ($rowid > 0) { } elseif ($object->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } - print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; + print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print ''; print ''.$langs->trans("Description").''; @@ -972,7 +972,7 @@ if ($rowid > 0) { print ''.$langs->trans("Amount").''; print ''; print ''; diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 38988d4aa34..55ee3bbd697 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -216,7 +216,7 @@ if ($action == 'edit') { $s = picto_from_langcode($key); print '
'; print '
'; - print ($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).':'; + print($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).':'; print '
'; print '
'; print ''.img_delete('', 'class="valigntextbottom"')."
"; @@ -242,7 +242,7 @@ if ($action == 'edit') { foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode($key); print '
'; - print ($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).':'; + print($s ? $s.' ' : '').''.$langs->trans('Language_'.$key).':'; print '
'; print '
'; print ''.img_delete('', 'class="valigntextbottom"').''; diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 8dac970e6fe..66a1aa7a3b1 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search // Load translation files required by the page $langs->loadLangs(array('admin', 'companies')); @@ -54,19 +54,19 @@ if ($reshook < 0) { if (($action == 'update' && !GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id', 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity); if ($action != 'updateedit' && !$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); diff --git a/htdocs/admin/accounting.php b/htdocs/admin/accounting.php index 18d383a1b3c..a891deddd8c 100644 --- a/htdocs/admin/accounting.php +++ b/htdocs/admin/accounting.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search // Load translation files required by the page $langs->loadLangs(array('admin', 'companies', 'accountancy')); diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index b7d81769364..4a47e07e245 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -91,7 +91,7 @@ if ($action == "save" && empty($cancel)) { foreach ($triggers as $trigger) { $keyparam = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $keyparam)) { - $res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ?GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ? GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index a158a97b279..1abdeab9733 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -107,7 +107,8 @@ if (preg_match('/set_(.*)/', $action, $reg)) { $disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha'); $res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity); - $i = 1; $errorsaved = 0; + $i = 1; + $errorsaved = 0; // Save agendas while ($i <= $MAXAGENDA) { @@ -204,7 +205,11 @@ print "
\n"; $selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT'); -if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; +if ($selectedvalue==1) { + $selectedvalue=0; +} else { + $selectedvalue=1; +} print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index fdf566f156b..d29ab9b0b5f 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -121,7 +121,9 @@ if ($action == 'set') { $commande->thirdparty = $specimenthirdparty; // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); @@ -251,7 +253,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print ''."\n"; print "\n"; print ""; // Color print ''; print ""; $i++; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index c0b0e100aea..9435f55868d 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -74,7 +74,9 @@ if ($action == 'updateMask') { $bom->initAsSpecimen(); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $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); @@ -354,7 +356,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print ''."\n"; print ''; print ''; print ''; print ''."\n"; // Field print ''."\n"; // Value if ($mode != 'focus' && $mode != 'mandatory') { print ''; } @@ -392,7 +402,7 @@ if (!is_array($result) && $result < 0) { // Actions print ''; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 41945822dc1..02683de3c61 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -333,13 +333,27 @@ function convertDurationtoHour($duration_value, $duration_unit) { $result = 0; - if ($duration_unit == 's') $result = $duration_value / 3600; - if ($duration_unit == 'i') $result = $duration_value / 60; - if ($duration_unit == 'h') $result = $duration_value; - if ($duration_unit == 'd') $result = $duration_value * 24; - if ($duration_unit == 'w') $result = $duration_value * 24 * 7; - if ($duration_unit == 'm') $result = $duration_value * 730.484; - if ($duration_unit == 'y') $result = $duration_value * 365 * 24; + if ($duration_unit == 's') { + $result = $duration_value / 3600; + } + if ($duration_unit == 'i') { + $result = $duration_value / 60; + } + if ($duration_unit == 'h') { + $result = $duration_value; + } + if ($duration_unit == 'd') { + $result = $duration_value * 24; + } + if ($duration_unit == 'w') { + $result = $duration_value * 24 * 7; + } + if ($duration_unit == 'm') { + $result = $duration_value * 730.484; + } + if ($duration_unit == 'y') { + $result = $duration_value * 365 * 24; + } return $result; } @@ -932,7 +946,9 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee))); $jour_1sunsept = date("d", $date_1sunsept); $mois_1sunsept = date("m", $date_1sunsept); - if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) $ferie=true; + if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) { + $ferie=true; + } // Geneva fast in Switzerland } } @@ -945,7 +961,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $jour_semaine = jddayofweek($jour_julien, 0); if ($includefriday) { //Friday (5), Saturday (6) and Sunday (0) if ($jour_semaine == 5) { - $ferie = true; + $ferie = true; } } if ($includesaturday) { //Friday (5), Saturday (6) and Sunday (0) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index cffd051882e..53d3e944e69 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -68,7 +68,7 @@ function fichinter_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; $objectres = new Dolresource($db); $linked_resources = $objectres->getElementResources('fichinter', $object->id); - $nbResource = (is_array($linked_resources) ?count($linked_resources) : 0); + $nbResource = (is_array($linked_resources) ? count($linked_resources) : 0); // if (is_array($objectres->available_resources)) // { // foreach ($objectres->available_resources as $modresources => $resources) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c7bf29fef0c..aff76b1ac9e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -70,8 +70,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl } $loaddate = ($mode == 1 || $mode == 2 || $nbsecondsold) ? true : false; - $loadsize = ($mode == 1 || $mode == 3) ?true : false; - $loadperm = ($mode == 1 || $mode == 4) ?true : false; + $loadsize = ($mode == 1 || $mode == 3) ? true : false; + $loadperm = ($mode == 1 || $mode == 4) ? true : false; // Clean parameters $path = preg_replace('/([\\/]+)$/i', '', $path); @@ -1129,7 +1129,9 @@ function dol_move_dir($srcdir, $destdir, $overwriteifexists = 1, $indexdatabase $files = dol_dir_list($newpathofdestdir); if (!empty($files) && is_array($files)) { foreach ($files as $key => $file) { - if (!file_exists($file["fullname"])) continue; + if (!file_exists($file["fullname"])) { + continue; + } $filepath = $file["path"]; $oldname = $file["name"]; @@ -1758,7 +1760,6 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') */ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null) { - global $db, $user, $conf, $langs; $res = 0; @@ -1867,7 +1868,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess // Update index table of files (llx_ecm_files) if ($donotupdatesession == 1) { $sharefile = 0; - if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && getDolGlobalString('PRODUCT_ALLOW_EXTERNAL_DOWNLOAD')) $sharefile = 1; + if ($TFile['type'][$i] == 'application/pdf' && strpos($_SERVER["REQUEST_URI"], 'product') !== false && getDolGlobalString('PRODUCT_ALLOW_EXTERNAL_DOWNLOAD')) { + $sharefile = 1; + } $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', $sharefile, $object); if ($result < 0) { if ($allowoverwrite) { @@ -1885,8 +1888,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) { // Files infected by a virus setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); - } else // Known error - { + } else { // Known error setEventMessages($langs->trans($resupload), null, 'errors'); } } @@ -2022,8 +2024,12 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo dol_syslog('Error: object ' . get_class($object) . ' has no table_element attribute.'); return -1; } - if (isset($object->src_object_description)) $ecmfile->description = $object->src_object_description; - if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords; + if (isset($object->src_object_description)) { + $ecmfile->description = $object->src_object_description; + } + if (isset($object->src_object_keywords)) { + $ecmfile->keywords = $object->src_object_keywords; + } } if (getDolGlobalString('MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE')) { @@ -2196,7 +2202,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring $rootPath = realpath($inputfile); dol_syslog("Class ZipArchive is set so we zip using ZipArchive to zip into ".$outputfile.' rootPath='.$rootPath); - $zip = new ZipArchive; + $zip = new ZipArchive(); if ($zip->open($outputfile, ZipArchive::CREATE) !== true) { $errorstring = "dol_compress_file failure - Failed to open file ".$outputfile."\n"; @@ -2341,7 +2347,7 @@ function dol_uncompress($inputfile, $outputdir) if (class_exists('ZipArchive')) { // Must install php-zip to have it dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir); - $zip = new ZipArchive; + $zip = new ZipArchive(); $res = $zip->open($inputfile); if ($res === true) { //$zip->extractTo($outputdir.'/'); @@ -2546,7 +2552,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(\.meta|_preview.*\.png)$', '^\.'), $nohook = false, $mode = '') { $tmparray = dol_dir_list($dir, 'files', 0, $regexfilter, $excludefilter, 'date', SORT_DESC, $mode, $nohook); - return isset($tmparray[0])?$tmparray[0]:null; + return isset($tmparray[0]) ? $tmparray[0] : null; } /** @@ -3228,8 +3234,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $tmpmodulepart = explode('-', $modulepart); if (!empty($tmpmodulepart[1])) { - $modulepart = $tmpmodulepart[0]; - $original_file = $tmpmodulepart[1].'/'.$original_file; + $modulepart = $tmpmodulepart[0]; + $original_file = $tmpmodulepart[1].'/'.$original_file; } // Define $accessallowed diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c71dbdfb931..583ab4e4d74 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -369,9 +369,10 @@ function isASecretKey($keyname) */ function num2Alpha($n) { - for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) + for ($r = ""; $n >= 0; $n = intval($n / 26) - 1) { $r = chr($n % 26 + 0x41) . $r; - return $r; + } + return $r; } @@ -1976,7 +1977,8 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di $out = ''; - $backtopagejsfieldsid = ''; $backtopagejsfieldslabel = ''; + $backtopagejsfieldsid = ''; + $backtopagejsfieldslabel = ''; if ($backtopagejsfields) { $tmpbacktopagejsfields = explode(':', $backtopagejsfields); if (empty($tmpbacktopagejsfields[1])) { // If the part 'keyforpopupid:' is missing, we add $name for it. @@ -2029,10 +2031,10 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di var returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text(); console.log("popup has been closed. returnedid (js var defined into parent page)="+returnedid+" returnedlabel="+returnedlabel); if (returnedid != "" && returnedid != "div for returned id") { - jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid); + jQuery("#'.(empty($backtopagejsfieldsid) ? "none" : $backtopagejsfieldsid).'").val(returnedid); } if (returnedlabel != "" && returnedlabel != "div for returned label") { - jQuery("#'.(empty($backtopagejsfieldslabel)?"none":$backtopagejsfieldslabel).'").val(returnedlabel); + jQuery("#'.(empty($backtopagejsfieldslabel) ? "none" : $backtopagejsfieldslabel).'").val(returnedlabel); } } }); @@ -2171,7 +2173,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab } } elseif (!empty($links[$i][1])) { //print "x $i $active ".$links[$i][2]." z"; - $out .= '
'; + $out .= '
'; if (!empty($links[$i][0])) { $titletoshow = preg_replace('/<.*$/', '', $links[$i][1]); $out .= ''; @@ -2676,7 +2678,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $ret .= (($ret && $town) ? $sep : '').$town; - if (!empty($object->state)) { + if (!empty($object->state)) { $ret .= ($ret ? ($town ? ", " : $sep) : '').$object->state; } if (!empty($object->zip)) { @@ -2925,7 +2927,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $newformat = str_replace( array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - $format); + $format + ); $ret = $dtts->format($newformat); $ret = str_replace( array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), @@ -2948,7 +2951,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $newformat = str_replace( array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), - $format); + $format + ); $ret = $dtts->format($newformat); $ret = str_replace( array('__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), @@ -3272,9 +3276,9 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor $linkend = ''; if ($morecss == 'float') { // deprecated - return '
'.($withpicto ?img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; + return '
'.($withpicto ? img_picto($langs->trans("Url"), 'globe').' ' : '').$link.'
'; } else { - return $linkstart.''.($withpicto ?img_picto('', 'globe').' ' : '').$link.''.$linkend; + return $linkstart.''.($withpicto ? img_picto('', 'globe').' ' : '').$link.''.$linkend; } } @@ -3484,7 +3488,9 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton if (empty($profID) || empty($profIDtype)) { return ''; } - if (empty($countrycode)) $countrycode = $mysoc->country_code; + if (empty($countrycode)) { + $countrycode = $mysoc->country_code; + } $newProfID = $profID; $id = substr($profIDtype, -1); $ret = ''; @@ -3509,8 +3515,11 @@ function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton $newProfID = substr($newProfID, 0, 4).' '.substr($newProfID, 4, 3).' '.substr($newProfID, 7, 3).' '.substr($newProfID, 10, 3); } } - if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); - else $ret = $newProfID; + if (!empty($addcpButton)) { + $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID); + } else { + $ret = $newProfID; + } return $ret; } @@ -3745,9 +3754,9 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $urlmask = $user->clicktodial_url; } - $clicktodial_poste = (!empty($user->clicktodial_poste) ?urlencode($user->clicktodial_poste) : ''); - $clicktodial_login = (!empty($user->clicktodial_login) ?urlencode($user->clicktodial_login) : ''); - $clicktodial_password = (!empty($user->clicktodial_password) ?urlencode($user->clicktodial_password) : ''); + $clicktodial_poste = (!empty($user->clicktodial_poste) ? urlencode($user->clicktodial_poste) : ''); + $clicktodial_login = (!empty($user->clicktodial_login) ? urlencode($user->clicktodial_login) : ''); + $clicktodial_password = (!empty($user->clicktodial_password) ? urlencode($user->clicktodial_password) : ''); // This line is for backward compatibility $url = sprintf($urlmask, urlencode($phone), $clicktodial_poste, $clicktodial_login, $clicktodial_password); // Thoose lines are for substitution @@ -5393,8 +5402,7 @@ function dol_print_error($db = '', $error = '', $errors = null) } if ($_SERVER['DOCUMENT_ROOT']) { // Mode web $out .= "".$langs->trans("Message").": ".dol_escape_htmltag($msg)."
\n"; - } else // Mode CLI - { + } else { // Mode CLI $out .= '> '.$langs->transnoentities("Message").":\n".$msg."\n"; } $syslog .= ", msg=".$msg; @@ -7519,7 +7527,9 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $firstline = ''; - $i = 0; $countline = 0; $lastaddediscontent = 1; + $i = 0; + $countline = 0; + $lastaddediscontent = 1; while ($countline < $nboflines && isset($a[$i])) { if (preg_match('/]*>/', $a[$i])) { if (array_key_exists($i+1, $a) && !empty($a[$i+1])) { @@ -7599,7 +7609,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' try { libxml_use_internal_errors(false); // Avoid to fill memory with xml errors - $dom = new DOMDocument; + $dom = new DOMDocument(); // Add a trick to solve pb with text without parent tag // like '

Foo

bar

' that wrongly ends up, without the trick, with '

Foo

bar

' // like 'abc' that wrongly ends up, without the trick, with '

abc

' @@ -7664,7 +7674,8 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are // using a non coventionnel way to be encoded, to not have them sanitized just after) $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { - return realCharForNumericEntities($m); }, $out); + return realCharForNumericEntities($m); + }, $out); // Now we remove all remaining HTML entities starting with a number. We don't want such entities. @@ -7994,9 +8005,9 @@ function dol_textishtml($msg, $option = 0) function dol_concatdesc($text1, $text2, $forxml = false, $invert = false) { if (!empty($invert)) { - $tmp = $text1; - $text1 = $text2; - $text2 = $tmp; + $tmp = $text1; + $text1 = $text2; + $text2 = $tmp; } $ret = ''; @@ -8409,7 +8420,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_FORMATED__'] = price($object->array_options['options_'.$key]); } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') { - $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = !empty($object->array_options['options_'.$key]) ? $object->array_options['options_'.$key] :''; + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = !empty($object->array_options['options_'.$key]) ? $object->array_options['options_'.$key] : ''; } } } @@ -8451,7 +8462,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } if ($object->id > 0) { - $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); + $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = ($paymenturl ? str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)) : ''); $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; if (getDolGlobalString('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD') && is_object($object) && $object->element == 'propal') { @@ -11381,7 +11392,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' $TCompiledAttr[] = $key.'="'.$value.'"'; } - $compiledAttributes = !empty($TCompiledAttr) ?implode(' ', $TCompiledAttr) : ''; + $compiledAttributes = !empty($TCompiledAttr) ? implode(' ', $TCompiledAttr) : ''; $tag = !empty($url) ? 'a' : 'span'; @@ -11555,9 +11566,9 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = // Here, $url is a simple link - if (!empty($params['isDropdown'])) + if (!empty($params['isDropdown'])) { $class = "dropdown-item"; - else { + } else { $class = 'butAction'; if ($actionType == 'danger' || $actionType == 'delete') { $class = 'butActionDelete'; @@ -11662,7 +11673,9 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = ); $reshook = $hookmanager->executeHooks('dolGetButtonAction', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } if (empty($reshook)) { if (dol_textishtml($text)) { // If content already HTML encoded @@ -12458,7 +12471,8 @@ function dolCheckFilters($sqlfilters, &$error = '') //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); $tmp = $sqlfilters; - $i = 0; $nb = strlen($tmp); + $i = 0; + $nb = strlen($tmp); $counter = 0; while ($i < $nb) { if ($tmp[$i] == '(') { @@ -12538,7 +12552,7 @@ function dolForgeCriteriaCallback($matches) if ($operator == 'IN') { // IN is allowed for list of ID or code only //if (!preg_match('/^\(.*\)$/', $tmpescaped)) { - $tmpescaped = '('.$db->escape($db->sanitize($tmpescaped, 1, 0)).')'; + $tmpescaped = '('.$db->escape($db->sanitize($tmpescaped, 1, 0)).')'; //} else { // $tmpescaped = $db->escape($db->sanitize($tmpescaped, 1)); //} @@ -13398,7 +13412,9 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') */ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto') { - if ($timestamp === null) $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); + if ($timestamp === null) { + $timestamp = GETPOSTDATE($prefix, $hourTime, $gm); + } $TParam = array( $prefix . 'day' => intval(dol_print_date($timestamp, '%d')), $prefix . 'month' => intval(dol_print_date($timestamp, '%m')), diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 847009dbace..f102ecdd14b 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1146,8 +1146,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if (dol_strlen($reg[$posy]) < 2) { return 'ErrorCantUseRazWithYearOnOneDigit'; } - } else // if reset is for a specific month in year, we need year - { + } else { // if reset is for a specific month in year, we need year if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { $posy = 3; $posm = 2; @@ -1162,8 +1161,8 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } } // Define length - $yearlen = $posy ?dol_strlen($reg[$posy]) : 0; - $monthlen = $posm ?dol_strlen($reg[$posm]) : 0; + $yearlen = $posy ? dol_strlen($reg[$posy]) : 0; + $monthlen = $posm ? dol_strlen($reg[$posm]) : 0; // Define pos $yearpos = (dol_strlen($reg[1]) + 1); $monthpos = ($yearpos + $yearlen); @@ -1435,8 +1434,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date) + $yearoffset, $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y", $date) + $yearoffset, $numFinal); $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1) + $yearoffset, $numFinal); - } else // we want yyyy to be current year - { + } else { // we want yyyy to be current year $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal); $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1), $numFinal); @@ -1491,13 +1489,13 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ function get_string_between($string, $start, $end) { $string = " ".$string; - $ini = strpos($string, $start); + $ini = strpos($string, $start); if ($ini == 0) { return ""; } - $ini += strlen($start); - $len = strpos($string, $end, $ini) - $ini; - return substr($string, $ini, $len); + $ini += strlen($start); + $len = strpos($string, $end, $ini) - $ini; + return substr($string, $ini, $len); } /** @@ -1707,15 +1705,14 @@ function numero_semaine($time) $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)) + (4 - date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)))) * 24 * 60 * 60; } elseif (date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine))) > 4) { // du Vendredi au Samedi $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)) + (7 - (date("w", mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine))) - 4)) * 24 * 60 * 60; - } else // Jeudi - { + } else { // Jeudi $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, date("Y", $jeudiSemaine)); } // Definition du numero de semaine: nb de jours entre "premier Jeudi de l'annee" et "Jeudi de la semaine"; $numeroSemaine = ( - ( - date("z", mktime(12, 0, 0, date("m", $jeudiSemaine), date("d", $jeudiSemaine), date("Y", $jeudiSemaine))) + ( + date("z", mktime(12, 0, 0, date("m", $jeudiSemaine), date("d", $jeudiSemaine), date("Y", $jeudiSemaine))) - date("z", mktime(12, 0, 0, date("m", $premierJeudiAnnee), date("d", $premierJeudiAnnee), date("Y", $premierJeudiAnnee))) ) / 7 @@ -2078,11 +2075,11 @@ function getSoapParams() global $conf; $params = array(); - $proxyuse = (!getDolGlobalString('MAIN_PROXY_USE') ?false:true); - $proxyhost = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_HOST); - $proxyport = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_PORT); - $proxyuser = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_USER); - $proxypass = (!getDolGlobalString('MAIN_PROXY_USE') ?false:$conf->global->MAIN_PROXY_PASS); + $proxyuse = (!getDolGlobalString('MAIN_PROXY_USE') ? false : true); + $proxyhost = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_HOST); + $proxyport = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PORT); + $proxyuser = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_USER); + $proxypass = (!getDolGlobalString('MAIN_PROXY_USE') ? false : $conf->global->MAIN_PROXY_PASS); $timeout = (!getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 10 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); // Connection timeout $response_timeout = (!getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); // Response timeout //print extension_loaded('soap'); @@ -2485,8 +2482,7 @@ function colorAgressiveness($hex, $ratio = -50, $brightness = 0) if ($color < 128) { $color -= ($color * ($ratio / 100)); } - } else // We decrease agressiveness - { + } else { // We decrease agressiveness if ($color > 128) { $color -= (($color - 128) * (abs($ratio) / 100)); } @@ -2934,7 +2930,8 @@ function removeGlobalParenthesis($string) } $nbofchars = dol_strlen($string); - $i = 0; $g = 0; + $i = 0; + $g = 0; $countparenthesis = 0; while ($i < $nbofchars) { $char = dol_substr($string, $i, 1); diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index c594b5b43b0..bd49d2fe9ce 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -212,7 +212,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = if ($iptocheck) { // Set CURLOPT_CONNECT_TO so curl will not try another resolution that may give a different result. Possible only on PHP v7+ if (defined('CURLOPT_CONNECT_TO')) { - $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port'])?'':$newUrlArray['port'], $iptocheck, empty($newUrlArray['port'])?'':$newUrlArray['port'])); + $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port']) ? '' : $newUrlArray['port'], $iptocheck, empty($newUrlArray['port']) ? '' : $newUrlArray['port'])); //var_dump($newUrlArray); //var_dump($connect_to); curl_setopt($ch, CURLOPT_CONNECT_TO, $connect_to); diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index 3a9712ba58f..0bf4e5fecc4 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -255,10 +255,10 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte // Charge un document PDF depuis un fichier. $pagecount = $pdf->setSourceFile($file); for ($i = 1; $i <= $pagecount; $i++) { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); } } diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index de14221c282..778379e84a2 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -53,7 +53,7 @@ function member_prepare_head(Adherent $object) } if ($user->hasRight('adherent', 'cotisation', 'lire')) { - $nbSubscription = is_array($object->subscriptions) ?count($object->subscriptions) : 0; + $nbSubscription = is_array($object->subscriptions) ? count($object->subscriptions) : 0; $head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id; $head[$h][1] = $langs->trans("Subscriptions"); $head[$h][2] = 'subscription'; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 321f3028e92..bd07f0d745a 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -129,7 +129,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } $texttoinsert .= ' "enabled"=>"'.($val['enabled'] !== '' ? dol_escape_php($val['enabled']) : 1).'",'; $texttoinsert .= " 'position'=>".($val['position'] !== '' ? (int) $val['position'] : 50).","; - $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 :(int) $val['notnull']).","; + $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : (int) $val['notnull']).","; $texttoinsert .= ' "visible"=>"'.($val['visible'] !== '' ? dol_escape_js($val['visible']) : -1).'",'; if (!empty($val['noteditable'])) { $texttoinsert .= ' "noteditable"=>"'.dol_escape_php($val['noteditable']).'",'; @@ -464,7 +464,6 @@ function dolGetListOfObjectClasses($destdir) */ function checkExistComment($file, $number) { - if (!file_exists($file)) { return -1; } @@ -598,8 +597,8 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; $permissions[$i][5] = "\$this->rights[\$r][5] = '".$permissions[$i][5]."';\n\t\t"; } - // for group permissions by object - $perms_grouped = array(); + // for group permissions by object + $perms_grouped = array(); foreach ($permissions as $perms) { $object = $perms[4]; if (!isset($perms_grouped[$object])) { @@ -658,7 +657,6 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $ */ function parsePropertyString($string) { - $string = str_replace("'", '', $string); // Uses a regular expression to capture keys and values @@ -707,7 +705,7 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) { // stock all properties in array - $attributesUnique = array ('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); + $attributesUnique = array('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); $start = "public \$fields=array("; $end = ");"; @@ -1136,7 +1134,8 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) dolReplaceInFile($file, array($beginMenu => $beginMenu."\n".$str_menu."\n")); return 1; - }return -1; + } + return -1; } /** @@ -1149,7 +1148,6 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) */ function updateDictionaryInFile($module, $file, $dicts) { - $isEmpty = false; $dicData = "\t\t\$this->dictionaries=array(\n"; $module = strtolower($module); @@ -1271,7 +1269,7 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul $dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : ''); // Build the dictionary string - $writeInfile = updateDictionaryInFile($modulename, $file, $dictionnaires); + $writeInfile = updateDictionaryInFile($modulename, $file, $dictionnaires); if ($writeInfile > 0) { setEventMessages($langs->trans("DictionariesCreated", ucfirst(substr($namedic, 2))), null); } diff --git a/htdocs/core/lib/parsemd.lib.php b/htdocs/core/lib/parsemd.lib.php index 4015227a104..5e72271303e 100644 --- a/htdocs/core/lib/parsemd.lib.php +++ b/htdocs/core/lib/parsemd.lib.php @@ -78,7 +78,7 @@ function dolMd2Asciidoc($content, $parser = 'dolibarr', $replaceimagepath = null } //if ($parser == 'dolibarr') //{ - $content = preg_replace('//msU', '', $content); + $content = preg_replace('//msU', '', $content); //} //else //{ diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4bf0f062f33..b8c749a3d23 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -205,7 +205,7 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') */ // For TCPDF, we specify permission we want to block - $pdfrights = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_RIGHTS') ?json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS, true) : array('modify', 'copy')); // Json format in llx_const + $pdfrights = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_RIGHTS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_RIGHTS, true) : array('modify', 'copy')); // Json format in llx_const // Password for the end user $pdfuserpass = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_USERPASS') ? $conf->global->PDF_SECURITY_ENCRYPTION_USERPASS : ''); @@ -218,7 +218,7 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') // Array of recipients containing public-key certificates ('c') and permissions ('p'). // For example: array(array('c' => 'file://../examples/data/cert/tcpdf.crt', 'p' => array('print'))) - $pubkeys = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_PUBKEYS') ?json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS, true) : null); // Json format in llx_const + $pubkeys = (getDolGlobalString('PDF_SECURITY_ENCRYPTION_PUBKEYS') ? json_decode($conf->global->PDF_SECURITY_ENCRYPTION_PUBKEYS, true) : null); // Json format in llx_const $pdf->SetProtection($pdfrights, $pdfuserpass, $pdfownerpass, $encstrength, $pubkeys); } @@ -732,9 +732,13 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $filepath = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF'); if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image - if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); } // Option for change opacity of background + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { + $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); + } // Option for change opacity of background $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); - if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha(1); } + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { + $pdf->SetAlpha(1); + } $pdf->SetPageMark(); // This option avoid to have the images missing on some pages $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } @@ -1234,7 +1238,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default @@ -1244,7 +1250,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $posy -= $freetextheight; } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $pdf->SetY(-$posy); @@ -1260,9 +1268,13 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $posy--; } - if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $mycustomfooterheight, $dims['lm'], $dims['hk'] - $posy, dol_htmlentitiesbr($mycustomfooter, 1, 'UTF-8', 0)); - if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FOOTER_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $posy -= $mycustomfooterheight - 3; } else { @@ -1278,7 +1290,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(0, 0); } // Option for disable auto pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(0, 0); + } // Option for disable auto pagebreak if ($line) { // Free text $pdf->SetXY($dims['lm'], -$posy); if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { // by default @@ -1288,7 +1302,9 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $posy -= $freetextheight; } - if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { $pdf->SetAutoPageBreak(1, 0); } // Restore pagebreak + if (getDolGlobalInt('PDF_FREETEXT_DISABLE_PAGEBREAK') === 1) { + $pdf->SetAutoPageBreak(1, 0); + } // Restore pagebreak $pdf->SetY(-$posy); @@ -1337,12 +1353,12 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } // Show page nb only on iso languages (so default Helvetica font) // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); - // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts - // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell - $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); - $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); + // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); // } // Show Draft Watermark @@ -1550,17 +1566,21 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), + $libelleproduitservice = dol_concatdesc( + dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: - $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) + ); } } else { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), + $libelleproduitservice = dol_concatdesc( + dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), (!empty($qtyText) ? - $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: - $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText : + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1]) + ); } } } @@ -2470,7 +2490,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ?'' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); } } elseif (count($objects) == 1) { @@ -2599,8 +2619,7 @@ function pdf_getSizeForImage($realpath) if ($width > $maxwidth) { // Pb with maxheight, so i use maxwidth $width = $maxwidth; $height = (int) round($maxwidth * $tmp['height'] / $tmp['width']); - } else // No pb with maxheight - { + } else { // No pb with maxheight $height = $maxheight; } } diff --git a/htdocs/core/lib/phpsessionindb.lib.php b/htdocs/core/lib/phpsessionindb.lib.php index 9dd806d86fc..7d19730674e 100644 --- a/htdocs/core/lib/phpsessionindb.lib.php +++ b/htdocs/core/lib/phpsessionindb.lib.php @@ -48,12 +48,24 @@ function dolSessionOpen($save_path, $session_name) global $dolibarr_session_db_type, $dolibarr_session_db_host; global $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, $dolibarr_session_db_port; - if (empty($dolibarr_session_db_type)) { $dolibarr_session_db_type = $dolibarr_main_db_type; } - if (empty($dolibarr_session_db_host)) { $dolibarr_session_db_host = $dolibarr_main_db_host; } - if (empty($dolibarr_session_db_user)) { $dolibarr_session_db_user = $dolibarr_main_db_user; } - if (empty($dolibarr_session_db_pass)) { $dolibarr_session_db_pass = $dolibarr_main_db_pass; } - if (empty($dolibarr_session_db_name)) { $dolibarr_session_db_name = $dolibarr_main_db_name; } - if (empty($dolibarr_session_db_port)) { $dolibarr_session_db_port = $dolibarr_main_db_port; } + if (empty($dolibarr_session_db_type)) { + $dolibarr_session_db_type = $dolibarr_main_db_type; + } + if (empty($dolibarr_session_db_host)) { + $dolibarr_session_db_host = $dolibarr_main_db_host; + } + if (empty($dolibarr_session_db_user)) { + $dolibarr_session_db_user = $dolibarr_main_db_user; + } + if (empty($dolibarr_session_db_pass)) { + $dolibarr_session_db_pass = $dolibarr_main_db_pass; + } + if (empty($dolibarr_session_db_name)) { + $dolibarr_session_db_name = $dolibarr_main_db_name; + } + if (empty($dolibarr_session_db_port)) { + $dolibarr_session_db_port = $dolibarr_main_db_port; + } //var_dump('open '.$database_name.' '.$table_name); $dbsession = getDoliDBInstance($dolibarr_session_db_type, $dolibarr_session_db_host, $dolibarr_session_db_user, $dolibarr_session_db_pass, $dolibarr_session_db_name, (int) $dolibarr_session_db_port); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 4febb1fbe21..a2e42cde0c9 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -39,11 +39,11 @@ function product_prepare_head($object) $langs->load("products"); $label = $langs->trans('Product'); - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read'); if ($object->isService()) { $label = $langs->trans('Service'); - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read'); } $h = 0; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a74df640399..ddcae0393c5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -230,7 +230,8 @@ function project_prepare_head(Project $project, $moreparam = '') $head[$h][1] = $langs->trans("EventOrganization"); // Enable caching of conf or booth count - $nbConfOrBooth = 0; $nbAttendees = 0; + $nbConfOrBooth = 0; + $nbAttendees = 0; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_conferenceorbooth_'.$project->id; $dataretrieved = dol_getcache($cachekey); @@ -823,7 +824,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Progress calculated (Note: ->duration_effective is time spent) if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) { - $s = ''; $shtml = ''; + $s = ''; + $shtml = ''; if ($lines[$i]->planned_workload || $lines[$i]->duration_effective) { if ($lines[$i]->planned_workload) { $s = round(100 * $lines[$i]->duration_effective / $lines[$i]->planned_workload, 2).' %'; @@ -2063,7 +2065,9 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $modeinput = 'hours'; for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0; + if (!isset($totalforeachday[$tmpday])) { + $totalforeachday[$tmpday] = 0; + } $cssonholiday = ''; if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) { $cssonholiday .= 'onholidayallday '; @@ -2362,7 +2366,9 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $month = $firstdaytoshowarray['mon']; foreach ($TWeek as $weekIndex => $weekNb) { $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ; - if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0; + if (!isset($totalforeachweek[$weekNb])) { + $totalforeachweek[$weekNb] = 0; + } $totalforeachweek[$weekNb] += $weekWorkLoad; $alreadyspent = ''; @@ -2738,14 +2744,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $plannedworkload = $objp->planned_workload; $total_plannedworkload += $plannedworkload; if (!in_array('plannedworkload', $hiddenfields)) { - print '
'; + print ''; } if (!in_array('declaredprogress', $hiddenfields)) { $declaredprogressworkload = $objp->declared_progess_workload; $total_declaredprogressworkload += $declaredprogressworkload; print ''; } } @@ -2787,10 +2793,10 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print ''; if (!in_array('plannedworkload', $hiddenfields)) { - print ''; + print ''; } if (!in_array('declaredprogress', $hiddenfields)) { - print ''; + print ''; } } if (!in_array('projectstatus', $hiddenfields)) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 4431234bc46..5a4e166ec99 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -319,8 +319,8 @@ function getCustomerProposalPieChart($socid = 0) //if ($totalinprocess != $total) //{ // print ''; - // print ''; - // print ''; + // print ''; + // print ''; // print ''; //} diff --git a/htdocs/core/lib/report.lib.php b/htdocs/core/lib/report.lib.php index badeb47d6f4..b92963e0f7d 100644 --- a/htdocs/core/lib/report.lib.php +++ b/htdocs/core/lib/report.lib.php @@ -58,7 +58,7 @@ function report_header($reportname, $notused, $period, $periodlink, $description print dol_get_fiche_head(); foreach ($moreparam as $key => $value) { - print ''."\n"; + print ''."\n"; } print '
"; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; require_once $dir.'/'.$file; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index dc4c7aa82a8..766b8222ed6 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -84,7 +84,9 @@ if ($action == 'set') { $commande->thirdparty = $specimenthirdparty; // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index e8f951a4734..5c84c3c8966 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -177,37 +177,37 @@ $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); // Show message $message = ''; -$urlvcal = ''; -$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlvcal = ''; +$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl1'); $message .= '
'; -$urlical = ''; -$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlical = ''; +$urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl2'); $message .= '
'; -$urlrss = ''; -$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlrss = ''; +$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl3'); diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 8446510b65b..7e29be5e759 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -88,7 +88,8 @@ if ($action == 'setbankcolorizemovement') { if ($actionsave) { $db->begin(); - $i = 1; $errorsaved = 0; + $i = 1; + $errorsaved = 0; $error = 0; // Save colors @@ -445,7 +446,7 @@ if (getDolGlobalInt('BANK_COLORIZE_MOVEMENT')) { print '
'.$langs->trans("BankColorizeMovementName".$key)."'; - print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ?GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset'); + print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ? GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset'); print '
'; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 2c79c34978d..189fb532e1f 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -348,7 +348,7 @@ foreach ($boxtoadd as $box) { $langs->load("errors"); print $langs->trans("WarningUsingThisBoxSlowDown"); } else { - print ($box->note ? $box->note : ' '); + print($box->note ? $box->note : ' '); } print ''; @@ -404,7 +404,7 @@ foreach ($boxactivated as $key => $box) { if ($box->note == '(WarningUsingThisBoxSlowDown)') { print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown"); } else { - print ($box->note ? $box->note : ' '); + print($box->note ? $box->note : ' '); } print ''; @@ -415,8 +415,8 @@ foreach ($boxactivated as $key => $box) { $hasprevious = ($key != 0); print ''.($key + 1).''; - print ($hasnext ? ''.img_down().' ' : ''); - print ($hasprevious ? ''.img_up().'' : ''); + print($hasnext ? ''.img_down().' ' : ''); + print($hasprevious ? ''.img_up().'' : ''); print ''; print ''.img_delete().''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 15ce18dcd26..01dd7dcd2db 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -162,7 +162,7 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { print '
'; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; print $module->info($langs); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index b0713455ba2..445535a55e4 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -84,7 +84,9 @@ if ($action == 'updateMask') { $commande->initAsSpecimen(); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0); @@ -437,7 +439,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print '
'; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 02f426575eb..11590149cbb 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search // Load translation files required by the page $langs->loadLangs(array('admin', 'companies', 'bills')); diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php index 41759274ce6..426b5a8eeb3 100644 --- a/htdocs/admin/company_socialnetworks.php +++ b/htdocs/admin/company_socialnetworks.php @@ -33,7 +33,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search // Load translation files required by the page $langs->loadLangs(array('admin', 'companies')); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index de5c6fb0173..f290df752bc 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -41,7 +41,7 @@ $constname = GETPOST('constname', 'alphanohtml'); $constvalue = GETPOST('constvalue', 'restricthtml'); // We should be able to send everything here $constnote = GETPOST('constnote', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index b6f4b698191..73304f1488e 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -80,7 +80,9 @@ if ($action == 'updateMask') { $contract->initAsSpecimen(); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0); @@ -386,7 +388,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print '
'; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index f3c6826309b..bf7eb7d27bf 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -46,7 +46,7 @@ $optioncss = GETPOST('optionscss', 'alphanohtml'); $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus' -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -83,7 +83,8 @@ $object = new DefaultValues($db); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -365,21 +366,30 @@ if (!is_array($result) && $result < 0) { // Page print ''; - if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) print $defaultvalue->page; - else print ''; + if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) { + print $defaultvalue->page; + } else { + print ''; + } print ''; - if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print $defaultvalue->param; - else print ''; + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { + print $defaultvalue->param; + } else { + print ''; + } print ''; - if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value); - else print ''; + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { + print dol_escape_htmltag($defaultvalue->value); + } else { + print ''; + } print ''; - if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { print ''.img_edit().''; print ''.img_delete().''; } else { diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index d5006c939cc..804797237b8 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -331,7 +331,8 @@ if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_MET if (getDolGlobalString('MAIN_METEO_LEVEL3')) { $level3 = $conf->global->MAIN_METEO_LEVEL3; } - $text = ''; $options = 'class="valignmiddle" height="60px"'; + $text = ''; + $options = 'class="valignmiddle" height="60px"'; if ($action == 'edit') { @@ -373,9 +374,7 @@ if (!getDolGlobalString('MAIN_DISABLE_METEO') || $conf->global->MAIN_DISABLE_MET print ''; print ''; - print ''; - - ?> + print ''; ?> '."\n"; $out .= ''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 9dc327edf8f..3e8604c7599 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -329,7 +329,7 @@ function getIbanHumanReadable(Account $account) { if ($account->getCountryCode() == 'FR') { require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; - $ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', empty($account->iban)?'':$account->iban); + $ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', empty($account->iban) ? '' : $account->iban); $iban = new PHP_IBAN\IBAN($ibantoprint); return $iban->HumanFormat(); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a07af1797f0..cacfa0f4495 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1686,7 +1686,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); $reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; @@ -1702,7 +1704,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); $reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; @@ -1825,7 +1829,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Fields from hook $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module); $reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook - if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (!empty($hookmanager->resPrint)) { + $sql.= $hookmanager->resPrint; + } if (is_array($actioncode)) { foreach ($actioncode as $code) { @@ -2100,7 +2106,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $out .= ''; $out .= $actionstatic->getTypePicto(); //if (empty($conf->dol_optimize_smallscreen)) { - $out .= $labeltype; + $out .= $labeltype; //} $out .= ''.($plannedworkload ?convertSecondToTime($plannedworkload) : '').''.($plannedworkload ? convertSecondToTime($plannedworkload) : '').''; //print $objp->planned_workload.'-'.$objp->declared_progess_workload."
"; - print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); + print($plannedworkload ? round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); print '
'.$total_task.''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').''.($total_plannedworkload ? convertSecondToTime($total_plannedworkload) : '').''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').''.($total_plannedworkload ? round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'."\n"; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 13e0d6d09ee..8bdaf599d78 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -114,7 +114,6 @@ function resource_prepare_head($object) */ function resource_admin_prepare_head() { - global $conf, $db, $langs, $user; $extrafields = new ExtraFields($db); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 39ab9cdeb41..1fb7dbdbdbf 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -741,7 +741,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', } } elseif ($feature == 'payment') { if (!$user->hasRight('facture', 'paiement')) { - $deleteok = 0; + $deleteok = 0; } } elseif ($feature == 'payment_sc') { if (!$user->hasRight('tax', 'charges', 'creer')) { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 8eef224ae25..3745eddf513 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -195,7 +195,7 @@ function generate_random_id($car = 16) { $string = ""; $chaine = "abcdefghijklmnopqrstuvwxyz123456789"; - mt_srand((double) microtime() * 1000000); + mt_srand((float) microtime() * 1000000); for ($i = 0; $i < $car; $i++) { $string .= $chaine[mt_rand() % strlen($chaine)]; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index f34048fed3b..d679d230566 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -152,8 +152,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset //print 'rang='.$rang.'-x='.$x." rowid=".$tab[$x]['rowid']." tab[x]['fk_leftmenu'] = ".$tab[$x]['fk_leftmenu']." leftmenu pere = ".$pere['leftmenu']."
\n"; if (empty($ulprinted) && !empty($pere['rowid'])) { if (!empty($tree_recur_alreadyadded[$tab[$x]['rowid']])) { - dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING); - continue; + dol_syslog('Error, record with id '.$tab[$x]['rowid'].' seems to be a child of record with id '.$pere['rowid'].' but it was already output. Complete field "leftmenu" and "mainmenu" on ALL records to avoid ambiguity.', LOG_WARNING); + continue; } print "\n".''; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 20e7c93f965..60b52ba3101 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -527,7 +527,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; } } else { - $html .= ''; - $html .= ''; - $html .= ''; + $html .= ''; + $html .= ''; + $html .= ''; } $html .= '
'; if ($edit) { //print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1); - print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE)?$conf->global->THEME_TOPMENU_DISABLE_IMAGE:0, 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); + print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, isset($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? $conf->global->THEME_TOPMENU_DISABLE_IMAGE : 0, 0, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth500'); } else { $listoftopmenumodes[getDolGlobalString('THEME_TOPMENU_DISABLE_IMAGE')]; //print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 904fc9808e3..5f0bfd8915d 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -557,8 +557,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri $newurl = $currenturi.'&pageref='.urlencode($containerref); } } - } else // When page called from virtual host server - { + } else { // When page called from virtual host server $newurl = '/'.$containerref.'.php'; } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 36605571053..144d46d31de 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -103,7 +103,9 @@ function dolSavePageAlias($filealias, $object, $objectpage) $filename = basename($filealias); foreach (explode(',', $object->otherlang) as $sublang) { // Avoid to erase main alias file if $sublang is empty string - if (empty(trim($sublang))) continue; + if (empty(trim($sublang))) { + continue; + } $filealiassub = $dirname.'/'.$sublang.'/'.$filename; $aliascontent = 'otherlang) as $sublang) { // Avoid to erase main alias file if $sublang is empty string - if (empty(trim($sublang))) continue; + if (empty(trim($sublang))) { + continue; + } $fileindexsub = $dirname.'/'.$sublang.'/index.php'; // Same indexcontent than previously but with ../ instead of ./ for master and tpl file include/require_once. diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index b2b2194246d..bddcce12d72 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -330,7 +330,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format); if (empty($outputfile)) { - // -1 = error + // -1 = error return -1; } From 9e1b90e4a1216f3b98ad0d3f9a963a15139ff75f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 12:07:31 +0100 Subject: [PATCH 21/28] Fix with php-cs-fixer --- htdocs/core/modules/DolibarrModules.class.php | 44 ++-- .../asset/doc/pdf_standard_asset.modules.php | 11 +- .../core/modules/asset/mod_asset_standard.php | 3 +- .../barcode/mod_barcode_product_standard.php | 4 +- .../mod_barcode_thirdparty_standard.php | 4 +- .../modules/barcode/modules_barcode.class.php | 1 - .../bom/doc/doc_generic_bom_odt.modules.php | 3 +- .../doc/doc_generic_order_odt.modules.php | 3 +- .../commande/doc/pdf_einstein.modules.php | 3 +- .../commande/doc/pdf_eratosthene.modules.php | 4 +- .../commande/doc/pdf_proforma.modules.php | 1 - .../contract/doc/pdf_strato.modules.php | 3 +- .../delivery/doc/pdf_storm.modules.php | 3 +- .../delivery/doc/pdf_typhon.modules.php | 3 +- .../doc/doc_generic_shipment_odt.modules.php | 15 +- .../expedition/doc/pdf_espadon.modules.php | 40 ++-- .../expedition/doc/pdf_merou.modules.php | 2 +- .../expedition/doc/pdf_rouget.modules.php | 11 +- .../doc/pdf_standard.modules.php | 15 +- .../modules/export/export_csviso.modules.php | 1 - .../modules/export/export_csvutf8.modules.php | 1 - .../export/export_excel2007.modules.php | 1 - .../modules/facture/doc/pdf_crabe.modules.php | 13 +- .../facture/doc/pdf_sponge.modules.php | 15 +- .../core/modules/facture/modules_facture.php | 4 +- .../fichinter/doc/pdf_soleil.modules.php | 9 +- .../modules/hrm/doc/pdf_standard.modules.php | 11 +- .../modules/hrm/mod_evaluation_standard.php | 6 +- .../modules/import/import_csv.modules.php | 21 +- .../modules/import/import_xlsx.modules.php | 10 +- .../modules/mailings/contacts1.modules.php | 2 +- .../modules/mailings/xinputfile.modules.php | 3 +- .../modules/member/doc/pdf_standard.class.php | 6 +- htdocs/core/modules/modAdherent.class.php | 1 - htdocs/core/modules/modAgenda.class.php | 5 +- htdocs/core/modules/modBanque.class.php | 1 - htdocs/core/modules/modBlockedLog.class.php | 1 - htdocs/core/modules/modBookmark.class.php | 1 - htdocs/core/modules/modClickToDial.class.php | 1 - htdocs/core/modules/modCollab.class.php | 3 +- htdocs/core/modules/modComptabilite.class.php | 1 - htdocs/core/modules/modCron.class.php | 1 - htdocs/core/modules/modDataPolicy.class.php | 4 +- htdocs/core/modules/modDav.class.php | 2 +- htdocs/core/modules/modDebugBar.class.php | 1 - htdocs/core/modules/modDeplacement.class.php | 1 - .../modules/modDocumentGeneration.class.php | 1 - htdocs/core/modules/modDon.class.php | 1 - .../core/modules/modDynamicPrices.class.php | 1 - htdocs/core/modules/modECM.class.php | 1 - .../modules/modEventOrganization.class.php | 8 +- .../core/modules/modExpenseReport.class.php | 4 +- htdocs/core/modules/modExport.class.php | 1 - htdocs/core/modules/modExternalRss.class.php | 1 - htdocs/core/modules/modExternalSite.class.php | 1 - htdocs/core/modules/modFTP.class.php | 1 - htdocs/core/modules/modFacture.class.php | 1 - htdocs/core/modules/modFicheinter.class.php | 1 - htdocs/core/modules/modGeoIPMaxmind.class.php | 1 - htdocs/core/modules/modHoliday.class.php | 4 +- htdocs/core/modules/modLabel.class.php | 1 - htdocs/core/modules/modLoan.class.php | 1 - htdocs/core/modules/modMailing.class.php | 1 - htdocs/core/modules/modMailmanSpip.class.php | 1 - htdocs/core/modules/modNotification.class.php | 1 - htdocs/core/modules/modOauth.class.php | 1 - htdocs/core/modules/modOpenSurvey.class.php | 1 - .../modPaymentByBankTransfer.class.php | 1 - .../core/modules/modReceiptPrinter.class.php | 1 - htdocs/core/modules/modResource.class.php | 1 - htdocs/core/modules/modService.class.php | 25 ++- .../core/modules/modSocialNetworks.class.php | 1 - htdocs/core/modules/modSociete.class.php | 1 - .../core/modules/modStockTransfer.class.php | 16 +- .../modules/modSupplierProposal.class.php | 2 +- htdocs/core/modules/modSyslog.class.php | 1 - htdocs/core/modules/modTax.class.php | 1 - htdocs/core/modules/modTicket.class.php | 8 +- htdocs/core/modules/modWebServices.class.php | 1 - .../modules/modWebServicesClient.class.php | 1 - htdocs/core/modules/modWebsite.class.php | 1 - htdocs/core/modules/modWorkflow.class.php | 1 - .../movement/doc/pdf_standard.modules.php | 7 +- .../modules/mrp/doc/pdf_vinci.modules.php | 14 +- .../oauth/stripelive_oauthcallback.php | 3 +- .../oauth/stripetest_oauthcallback.php | 3 +- .../modules/printing/printgcp.modules.php | 6 +- .../doc/pdf_standardlabel.class.php | 6 +- .../printsheet/doc/pdf_tcpdflabel.class.php | 6 +- .../doc/doc_generic_product_odt.modules.php | 3 +- .../product/doc/pdf_standard.modules.php | 4 +- .../modules/product/modules_product.class.php | 1 - .../product_batch/mod_lot_standard.php | 12 +- .../modules/product_batch/mod_sn_advanced.php | 2 +- .../modules/product_batch/mod_sn_standard.php | 14 +- .../doc/doc_generic_project_odt.modules.php | 3 +- .../project/doc/pdf_baleine.modules.php | 3 +- .../project/doc/pdf_beluga.modules.php | 3 +- .../project/doc/pdf_timespent.modules.php | 3 +- .../task/doc/doc_generic_task_odt.modules.php | 3 +- .../modules/project/task/mod_task_simple.php | 2 +- .../project/task/mod_task_universal.php | 2 +- .../doc/doc_generic_proposal_odt.modules.php | 3 +- .../modules/propale/doc/pdf_azur.modules.php | 15 +- .../modules/propale/doc/pdf_cyan.modules.php | 17 +- .../doc/doc_generic_reception_odt.modules.php | 3 +- .../reception/doc/pdf_squille.modules.php | 13 +- .../societe/doc/doc_generic_odt.modules.php | 3 +- .../modules/societe/modules_societe.class.php | 2 - .../doc/doc_generic_stock_odt.modules.php | 3 +- .../stock/doc/pdf_standard.modules.php | 3 +- .../stocktransfer/doc/pdf_eagle.modules.php | 199 +++++++++++++----- .../doc/pdf_eagle_proforma.modules.php | 175 ++++++++++----- .../mod_stocktransfer_standard.php | 22 +- ...c_generic_supplier_invoice_odt.modules.php | 3 +- .../doc/pdf_canelle.modules.php | 7 +- ...doc_generic_supplier_order_odt.modules.php | 3 +- .../supplier_order/doc/pdf_cornas.modules.php | 11 +- .../doc/pdf_muscadet.modules.php | 7 +- .../doc/pdf_standard.modules.php | 3 +- ..._generic_supplier_proposal_odt.modules.php | 3 +- .../doc/pdf_aurore.modules.php | 3 +- .../doc/pdf_zenith.modules.php | 11 +- .../core/modules/syslog/mod_syslog_file.php | 4 +- .../doc/doc_generic_ticket_odt.modules.php | 3 +- .../user/doc/doc_generic_user_odt.modules.php | 3 +- .../doc/doc_generic_usergroup_odt.modules.php | 3 +- 127 files changed, 578 insertions(+), 439 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index a59fd8faab6..2104cd7d5d4 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -504,10 +504,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $result = $this->db->query($sql, $ignoreerror); if (!$result) { if (!$ignoreerror) { - $this->error = $this->db->lasterror(); - $err++; + $this->error = $this->db->lasterror(); + $err++; } else { - dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING); + dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING); } } } @@ -1234,7 +1234,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // Run data_xxx.sql files (Must be done after llx_mytable.key.sql) $files = array(); while (($file = readdir($handle)) !== false) { - $files[] = $file; + $files[] = $file; } sort($files); foreach ($files as $file) { @@ -1259,7 +1259,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // Run update_xxx.sql files $files = array(); while (($file = readdir($handle)) !== false) { - $files[] = $file; + $files[] = $file; } sort($files); foreach ($files as $file) { @@ -1551,7 +1551,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } $sql .= " entity, test)"; $sql .= " VALUES ("; - $sql .= "'".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."', "; + $sql .= "'".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."', "; $sql .= "'".$this->db->idate($now)."', "; $sql .= ($datestart ? "'".$this->db->idate($datestart)."'" : "'".$this->db->idate($now)."'").", "; $sql .= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", "; @@ -1619,10 +1619,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (is_array($this->cronjobs)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; - $sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'"; + $sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."'"; $sql .= " AND entity = ".$conf->entity; $sql .= " AND test = '1'"; // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed. - // For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module. + // For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module. dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1713,7 +1713,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $resql = $this->db->query($sql); if (!$resql) { - dol_syslog($this->db->lasterror(), LOG_ERR); + dol_syslog($this->db->lasterror(), LOG_ERR); if ($this->db->lasterrno() != 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror(); @@ -1901,10 +1901,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$this->db->escape($r_modul)."','".$this->db->escape($r_type)."',".$r_def.",'".$this->db->escape($r_perms)."')"; } } else { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; - $sql .= " (id, entity, libelle, module, type, bydefault)"; - $sql .= " VALUES "; - $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$this->db->escape($r_modul)."','".$this->db->escape($r_type)."',".$r_def.")"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; + $sql .= " (id, entity, libelle, module, type, bydefault)"; + $sql .= " VALUES "; + $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$this->db->escape($r_modul)."','".$this->db->escape($r_type)."',".$r_def.")"; } $resqlinsert = $this->db->query($sql, 1); @@ -1946,7 +1946,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } else { dol_syslog(get_class($this)."::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR); } - $i++; + $i++; } } else { dol_print_error($this->db); @@ -1984,7 +1984,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err = 0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; - $sql .= " WHERE module = '".$this->db->escape(empty($this->rights_class) ?strtolower($this->name) : $this->rights_class)."'"; + $sql .= " WHERE module = '".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."'"; $sql .= " AND entity = ".$conf->entity; dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); if (!$this->db->query($sql)) { @@ -2111,7 +2111,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err = 0; //$module=strtolower($this->name); TODO When right_class will be same than module name - $module = empty($this->rights_class) ?strtolower($this->name) : $this->rights_class; + $module = empty($this->rights_class) ? strtolower($this->name) : $this->rights_class; $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql .= " WHERE module = '".$this->db->escape($module)."'"; @@ -2173,9 +2173,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // Create dir if it does not exists if (!empty($fulldir) && !file_exists($fulldir)) { if (dol_mkdir($fulldir, DOL_DATA_ROOT) < 0) { - $this->error = $langs->trans("ErrorCanNotCreateDir", $fulldir); - dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR); - $err++; + $this->error = $langs->trans("ErrorCanNotCreateDir", $fulldir); + dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR); + $err++; } } @@ -2329,10 +2329,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $resql = $this->db->query($sql, 1); if (!$resql) { if ($this->db->lasterrno() != 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $error++; - $this->error = $this->db->lasterror(); + $error++; + $this->error = $this->db->lasterror(); } else { - dol_syslog(get_class($this)."::insert_module_parts for ".$this->const_name."_".strtoupper($key)." Record already exists.", LOG_WARNING); + dol_syslog(get_class($this)."::insert_module_parts for ".$this->const_name."_".strtoupper($key)." Record already exists.", LOG_WARNING); } } } diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index b61f4bea544..4bde00a44fe 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -445,8 +445,7 @@ class pdf_standard_asset extends ModelePDFAsset } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); $posyafter = $pdf->GetY(); $height_note = $posyafter - $tab_top; @@ -566,8 +565,7 @@ class pdf_standard_asset extends ModelePDFAsset $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } } @@ -580,7 +578,8 @@ class pdf_standard_asset extends ModelePDFAsset // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -890,7 +889,7 @@ class pdf_standard_asset extends ModelePDFAsset // Show Draft Watermark if ($object->statut == $object::STATUS_DRAFT && (getDolGlobalString('FACTURE_DRAFT_WATERMARK'))) { - pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); } $pdf->SetTextColor(0, 0, 60); diff --git a/htdocs/core/modules/asset/mod_asset_standard.php b/htdocs/core/modules/asset/mod_asset_standard.php index 5269dd2c24c..7fa0e4a6491 100644 --- a/htdocs/core/modules/asset/mod_asset_standard.php +++ b/htdocs/core/modules/asset/mod_asset_standard.php @@ -102,7 +102,8 @@ class mod_asset_standard extends ModeleNumRefAsset if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 3771a1c5381..cf8e067b8d4 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -215,8 +215,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13 $ean = substr($numFinal, 0, 12); //take first 12 digits $eansum = barcode_gen_ean_sum($ean); - $ean .= $eansum; //substitute the las character by the key - $numFinal = $ean; + $ean .= $eansum; //substitute the las character by the key + $numFinal = $ean; } break; // Other barcode cases with key could be written here diff --git a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php index d7b0d66d08b..7c7921cf461 100644 --- a/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php @@ -216,8 +216,8 @@ class mod_barcode_thirdparty_standard extends ModeleNumRefBarCode if (strlen($numFinal)==13) {// be sure that the mask length is correct for EAN13 $ean = substr($numFinal, 0, 12); //take first 12 digits $eansum = barcode_gen_ean_sum($ean); - $ean .= $eansum; //substitute the las character by the key - $numFinal = $ean; + $ean .= $eansum; //substitute the las character by the key + $numFinal = $ean; } break; // Other barcode cases with key could be written here diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index fed68f2552f..d8dce3c216e 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -53,7 +53,6 @@ abstract class ModeleBarCode */ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator { - /** * @var int Code facultatif */ diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 55c14a76a0c..3e417bafdb3 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -387,8 +387,7 @@ class doc_generic_bom_odt extends ModelePDFBom } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 09a587fa7a2..1b9c6e8cf85 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -398,8 +398,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c00d2dbe01f..c75e9bd773c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -430,8 +430,7 @@ class pdf_einstein extends ModelePDFCommandes $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 259644adb0a..afd7e7f8701 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1404,7 +1404,9 @@ class pdf_eratosthene extends ModelePDFCommandes global $conf, $langs, $hookmanager, $mysoc; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 954252f8013..7c3587e18e3 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -40,7 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_proforma extends pdf_eratosthene { - /** * Constructor * diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index ef36cb8b45a..386ae285b97 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -386,8 +386,7 @@ class pdf_strato extends ModelePDFContract $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 3589baa5deb..f56d1cacbde 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -441,8 +441,7 @@ class pdf_storm extends ModelePDFDeliveryOrder $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index d9dbcc62d81..d2a0eabdedf 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -366,8 +366,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 99dd53d2d0e..b95dec9069f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -378,8 +378,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { @@ -398,8 +397,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { @@ -420,8 +418,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { @@ -439,8 +436,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { @@ -465,8 +461,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 34f521955a2..dfbbea1039b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -288,7 +288,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetTextColor(0, 0, 0); $tab_top = 90; - $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift: 10); + $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; @@ -389,8 +389,12 @@ class pdf_espadon extends ModelePdfExpedition while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } // $this->_pagefoot($pdf,$object,$outputlangs,1); $pdf->setTopMargin($tab_top_newpage); // The only function to edit the bottom margin of current page to set it. @@ -453,12 +457,15 @@ class pdf_espadon extends ModelePdfExpedition // apply note frame to last page $pdf->setPage($pageposafternote); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); $posyafter = $pdf->GetY(); if (empty($height_trackingnumber)) { @@ -476,8 +483,12 @@ class pdf_espadon extends ModelePdfExpedition $pagenb++; $pageposafternote++; $pdf->setPage($pageposafternote); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $posyafter = $tab_top_newpage; } @@ -586,8 +597,7 @@ class pdf_espadon extends ModelePdfExpedition $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -1012,10 +1022,10 @@ class pdf_espadon extends ModelePdfExpedition // Date planned delivery if (!empty($object->date_delivery)) { - $posy += 4; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && !empty($object->thirdparty->code_client)) { diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index d8d156ce4d0..eab2e6cc05e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -485,7 +485,7 @@ class pdf_merou extends ModelePdfExpedition pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); - //Affiche le filigrane brouillon - Print Draft Watermark + //Affiche le filigrane brouillon - Print Draft Watermark if ($object->statut == 0 && (getDolGlobalString('SENDING_DRAFT_WATERMARK'))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SENDING_DRAFT_WATERMARK); } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index f6e5da7c046..6fad9c974d8 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -482,8 +482,7 @@ class pdf_rouget extends ModelePdfExpedition $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -933,10 +932,10 @@ class pdf_rouget extends ModelePdfExpedition // Date planned delivery if (!empty($object->date_delivery)) { - $posy += 4; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && !empty($object->thirdparty->code_client)) { diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index c2b860ec43e..82d81cdb4b7 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -44,9 +44,9 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; */ class pdf_standard extends ModeleExpenseReport { - /** - * @var DoliDb Database handler - */ + /** + * @var DoliDb Database handler + */ public $db; /** @@ -357,7 +357,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->useTemplate($tplidx); } if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs); } $pdf->setPage($pageposafter + 1); $showpricebeforepagebreak = 1; @@ -399,8 +399,7 @@ class pdf_standard extends ModeleExpenseReport $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $i++; @@ -709,13 +708,13 @@ class pdf_standard extends ModeleExpenseReport $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("DateStart")." : ".($object->date_debut > 0 ?dol_print_date($object->date_debut, "day", false, $outputlangs) : ''), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("DateStart")." : ".($object->date_debut > 0 ? dol_print_date($object->date_debut, "day", false, $outputlangs) : ''), '', 'R'); // Date end period $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("DateEnd")." : ".($object->date_fin > 0 ?dol_print_date($object->date_fin, "day", false, $outputlangs) : ''), '', 'R'); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $posx, 3, $outputlangs->transnoentities("DateEnd")." : ".($object->date_fin > 0 ? dol_print_date($object->date_fin, "day", false, $outputlangs) : ''), '', 'R'); // Status Expense Report $posy += 6; diff --git a/htdocs/core/modules/export/export_csviso.modules.php b/htdocs/core/modules/export/export_csviso.modules.php index 26ccaf859e6..7cc351c063a 100644 --- a/htdocs/core/modules/export/export_csviso.modules.php +++ b/htdocs/core/modules/export/export_csviso.modules.php @@ -31,7 +31,6 @@ set_time_limit(0); */ class ExportCsvIso extends ExportCsv { - /** * Constructor * diff --git a/htdocs/core/modules/export/export_csvutf8.modules.php b/htdocs/core/modules/export/export_csvutf8.modules.php index f044b4b7ecd..3e56e1956ba 100644 --- a/htdocs/core/modules/export/export_csvutf8.modules.php +++ b/htdocs/core/modules/export/export_csvutf8.modules.php @@ -31,7 +31,6 @@ set_time_limit(0); */ class ExportCsvUtf8 extends ExportCsv { - /** * Constructor * diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 3c0db565e91..8540334123e 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -461,7 +461,6 @@ class ExportExcel2007 extends ModeleExports */ public function column2Letter($c) { - $c = intval($c); if ($c <= 0) { return ''; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index db40f506a4a..33ff6018c38 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -45,9 +45,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_crabe extends ModelePDFFactures { - /** - * @var DoliDb Database handler - */ + /** + * @var DoliDb Database handler + */ public $db; /** @@ -635,8 +635,7 @@ class pdf_crabe extends ModelePDFFactures $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -1796,7 +1795,9 @@ class pdf_crabe extends ModelePDFFactures global $conf, $langs; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "companies")); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 167a9632c03..d17daeb7f27 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -755,8 +755,7 @@ class pdf_sponge extends ModelePDFFactures $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -902,8 +901,8 @@ class pdf_sponge extends ModelePDFFactures if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); - $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; - $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; + $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : ''; + $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : ''; } // retrieve global local tax @@ -1353,7 +1352,7 @@ class pdf_sponge extends ModelePDFFactures } } - // Show payment mode CHQ + // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { // If payment mode unregulated or payment mode forced to CHQ if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) { @@ -1391,7 +1390,7 @@ class pdf_sponge extends ModelePDFFactures } } - // If payment mode not forced or forced to VIR, show payment with BAN + // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); @@ -2042,7 +2041,9 @@ class pdf_sponge extends ModelePDFFactures global $conf, $langs; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "propal", "companies")); diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index d57d604f11c..c4dd83ddb7e 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -196,7 +196,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator * @param Translate $langs Translation object * @return int Height in mm of the bottom-page QR invoice. Can be zero if not on right page; not enabled */ - protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs) : int + protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs): int { if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') { // Keep it, to reset it after QRinvoice getter @@ -224,7 +224,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator * @param Translate $langs Translation object * @return bool True for for success */ - public function addBottomQRInvoice(TCPDF $pdf, Facture $object, Translate $langs) : bool + public function addBottomQRInvoice(TCPDF $pdf, Facture $object, Translate $langs): bool { if (!($qrBill = $this->getSwissQrBill($object, $langs))) { return false; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index c9a1943e652..ccb3009340a 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -39,9 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; */ class pdf_soleil extends ModelePDFFicheinter { - /** - * @var DoliDb Database handler - */ + /** + * @var DoliDb Database handler + */ public $db; /** @@ -338,8 +338,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->setPage($pageposafter + 1); } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } diff --git a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php index 2d4fa51b9d6..10c4bdb1ee4 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard.modules.php @@ -39,9 +39,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class pdf_standard extends ModelePDFEvaluation { - /** - * @var DoliDb Database handler - */ + /** + * @var DoliDb Database handler + */ public $db; /** @@ -306,7 +306,7 @@ class pdf_standard extends ModelePDFEvaluation $pdf->useTemplate($tplidx); } if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs); } $pdf->setPage($pageposafter + 1); $showmorebeforepagebreak = 1; @@ -347,8 +347,7 @@ class pdf_standard extends ModelePDFEvaluation $showmorebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $i++; diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php index 17fab7a3bc0..ced3fe35e23 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_standard.php +++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php @@ -84,7 +84,8 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,8 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 59588eeedec..19433eee66e 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -92,7 +92,7 @@ class ImportCsv extends ModeleImports parent::__construct(); $this->db = $db; - $this->separator = (GETPOST('separator') ?GETPOST('separator') : (!getDolGlobalString('IMPORT_CSV_SEPARATOR_TO_USE') ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)); + $this->separator = (GETPOST('separator') ? GETPOST('separator') : (!getDolGlobalString('IMPORT_CSV_SEPARATOR_TO_USE') ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)); $this->enclosure = '"'; $this->escape = '"'; @@ -259,8 +259,7 @@ class ImportCsv extends ModeleImports $newarrayres[$key]['val'] = utf8_encode($val); $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null } - } else // Autodetect format (UTF8 or ISO) - { + } else { // Autodetect format (UTF8 or ISO) if (utf8_check($val)) { $newarrayres[$key]['val'] = $val; $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null @@ -610,7 +609,7 @@ class ImportCsv extends ModeleImports if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { require_once DOL_DOCUMENT_ROOT.$pathModForNumber; - $modForNumber = new $classModForNumber; + $modForNumber = new $classModForNumber(); $tmpobject = null; // Set the object with the date property when we can @@ -649,8 +648,8 @@ class ImportCsv extends ModeleImports } else { $this->errors[$error]['type'] = 'CLASSERROR'; $this->errors[$error]['lib'] = implode( - "\n", - array_merge([$classinstance->error], $classinstance->errors) + "\n", + array_merge([$classinstance->error], $classinstance->errors) ); $errorforthistable++; $error++; @@ -675,7 +674,7 @@ class ImportCsv extends ModeleImports if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field = $reg[1]; $table = $reg[2]; - $filter = !empty($reg[3]) ?substr($reg[3], 1) : ''; + $filter = !empty($reg[3]) ? substr($reg[3], 1) : ''; $cachekey = $field.'@'.$table; if (!empty($filter)) { @@ -824,8 +823,8 @@ class ImportCsv extends ModeleImports } else { $this->errors[$error]['type'] = 'CLASSERROR'; $this->errors[$error]['lib'] = implode( - "\n", - array_merge([$classinstance->error], $classinstance->errors) + "\n", + array_merge([$classinstance->error], $classinstance->errors) ); $errorforthistable++; $error++; @@ -896,7 +895,9 @@ class ImportCsv extends ModeleImports if ($num_rows == 1) { $res = $this->db->fetch_object($resql); $lastinsertid = $res->rowid; - if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists + if ($is_table_category_link) { + $lastinsertid = 'linktable'; + } // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists $last_insert_id_array[$tablename] = $lastinsertid; } elseif ($num_rows > 1) { $this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters)); diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 71aec0b4711..e67c37992ab 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -652,7 +652,7 @@ class ImportXlsx extends ModeleImports if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { require_once DOL_DOCUMENT_ROOT.$pathModForNumber; - $modForNumber = new $classModForNumber; + $modForNumber = new $classModForNumber(); $tmpobject = null; // Set the object with the date property when we can @@ -693,7 +693,7 @@ class ImportXlsx extends ModeleImports $this->errors[$error]['lib'] = implode( "\n", array_merge([$classinstance->error], $classinstance->errors) - ); + ); $errorforthistable++; $error++; } @@ -866,7 +866,7 @@ class ImportXlsx extends ModeleImports $this->errors[$error]['lib'] = implode( "\n", array_merge([$classinstance->error], $classinstance->errors) - ); + ); $errorforthistable++; $error++; } @@ -937,7 +937,9 @@ class ImportXlsx extends ModeleImports if ($num_rows == 1) { $res = $this->db->fetch_object($resql); $lastinsertid = $res->rowid; - if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists + if ($is_table_category_link) { + $lastinsertid = 'linktable'; + } // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists $last_insert_id_array[$tablename] = $lastinsertid; } elseif ($num_rows > 1) { $this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters)); diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 1e2af0fcc2f..958a6e10eda 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -480,6 +480,6 @@ class mailing_contacts1 extends MailingTargets return -1; } - return parent::addTargetsToDatabase($mailing_id, $cibles); + return parent::addTargetsToDatabase($mailing_id, $cibles); } } diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index d698a646371..765a2d300f7 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -207,8 +207,7 @@ class mailing_xinputfile extends MailingTargets $this->error = '
'.$langs->trans("ErrorFileNotUploaded").'
'; } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) { // Files infected by a virus $this->error = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; - } else // Known error - { + } else { // Known error $this->error = '
'.$langs->trans($resupload).'
'; } } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 86e2ef11c58..f2c023564c1 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -213,15 +213,13 @@ class pdf_standard extends CommonStickerGenerator } $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); - } else // text on halft left and text on half right - { + } else { // text on halft left and text on half right $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } - } else // Only a right part - { + } else { // Only a right part // Output right area if ($textright == '__LOGO__' && $logo) { $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 8c5fa732574..e19b6e244a6 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modAdherent extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index ae0d74813a8..b74db69921b 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -37,7 +37,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modAgenda extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * @@ -459,7 +458,9 @@ class modAgenda extends DolibarrModules 'p.ref' => 'project', ); - $keyforselect = 'actioncomm'; $keyforelement = 'action'; $keyforaliasextra = 'extra'; + $keyforselect = 'actioncomm'; + $keyforelement = 'action'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 78f0385fcdc..3a55acc8124 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modBanque extends DolibarrModules { - /** * Constructor. * diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 09b8d1a3fba..efc5cb7b10f 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -207,7 +207,6 @@ class modBlockedLog extends DolibarrModules */ public function remove($options = '') { - global $conf, $user; $sql = array(); diff --git a/htdocs/core/modules/modBookmark.class.php b/htdocs/core/modules/modBookmark.class.php index 7b8d623bc6d..80e7675fd97 100644 --- a/htdocs/core/modules/modBookmark.class.php +++ b/htdocs/core/modules/modBookmark.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modBookmark extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modClickToDial.class.php b/htdocs/core/modules/modClickToDial.class.php index 18f1e6befeb..f0e60adff21 100644 --- a/htdocs/core/modules/modClickToDial.class.php +++ b/htdocs/core/modules/modClickToDial.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modClickToDial extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index 2a1fb5f50fb..f4edbee6c3f 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -30,7 +30,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modCollab extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * @@ -74,7 +73,7 @@ class modCollab extends DolibarrModules // Constants //----------- - $this->const = array(); + $this->const = array(); // New pages on tabs // ----------------- diff --git a/htdocs/core/modules/modComptabilite.class.php b/htdocs/core/modules/modComptabilite.class.php index 6c485f912f9..393c526b1ae 100644 --- a/htdocs/core/modules/modComptabilite.class.php +++ b/htdocs/core/modules/modComptabilite.class.php @@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modComptabilite extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 1d635d4062e..c11dd5ce047 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modCron extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 1c3fe017395..97fc2642874 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -34,8 +34,8 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** * Description and activation class for module datapolicy */ -class modDataPolicy extends DolibarrModules { - +class modDataPolicy extends DolibarrModules +{ // @codingStandardsIgnoreEnd /** * Constructor. Define names, constants, directories, boxes, permissions diff --git a/htdocs/core/modules/modDav.class.php b/htdocs/core/modules/modDav.class.php index 356f043cea0..3f0faf48949 100644 --- a/htdocs/core/modules/modDav.class.php +++ b/htdocs/core/modules/modDav.class.php @@ -159,7 +159,7 @@ class modDav extends DolibarrModules // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week //$this->cronjobs = array( - //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/dav/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) + //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/dav/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) //); // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php index ed76bb32672..590c29e03ad 100644 --- a/htdocs/core/modules/modDebugBar.class.php +++ b/htdocs/core/modules/modDebugBar.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modDebugBar extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php index e11d2beb2aa..c3e8fd96f52 100644 --- a/htdocs/core/modules/modDeplacement.class.php +++ b/htdocs/core/modules/modDeplacement.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modDeplacement extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDocumentGeneration.class.php b/htdocs/core/modules/modDocumentGeneration.class.php index 466523e7f81..e72731c9ff6 100644 --- a/htdocs/core/modules/modDocumentGeneration.class.php +++ b/htdocs/core/modules/modDocumentGeneration.class.php @@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modDocumentGeneration extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 3af26350325..30497f7c698 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modDon extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php index bfaf11dbf4c..a6575ee9dd4 100644 --- a/htdocs/core/modules/modDynamicPrices.class.php +++ b/htdocs/core/modules/modDynamicPrices.class.php @@ -30,7 +30,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modDynamicPrices extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 80cd431dac5..7aefd2d0028 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modECM extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index ae1b98e63f7..5bcf2f77bac 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -317,7 +317,9 @@ class modEventOrganization extends DolibarrModules $this->export_label[$r]='ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]=$this->picto; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'ConferenceOrBoothAttendee'; $keyforclassfile='/eventorganization/class/conferenceorboothattendee.class.php'; $keyforelement='conferenceorboothattendee'; + $keyforclass = 'ConferenceOrBoothAttendee'; + $keyforclassfile='/eventorganization/class/conferenceorboothattendee.class.php'; + $keyforelement='conferenceorboothattendee'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $this->export_entities_array[$r]['t.fk_invoice'] = 'invoice'; unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after @@ -335,7 +337,9 @@ class modEventOrganization extends DolibarrModules $this->export_TypeFields_array[$r]['t.fk_soc'] = 'Numeric'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); - $keyforselect='conferenceorboothattendee'; $keyforaliasextra='extra'; $keyforelement='conferenceorboothattendee'; + $keyforselect='conferenceorboothattendee'; + $keyforaliasextra='extra'; + $keyforelement='conferenceorboothattendee'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) //$this->export_special_array[$r] = array('t.field'=>'...'); diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 98c94b96751..d5ec3e34032 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -222,7 +222,9 @@ class modExpenseReport extends DolibarrModules $keyforelement = 'expensereport'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extrau'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extrau'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index 7f36c78273b..d413a817a1e 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modExport extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php index e60c79e2deb..eba11ac1089 100644 --- a/htdocs/core/modules/modExternalRss.class.php +++ b/htdocs/core/modules/modExternalRss.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modExternalRss extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modExternalSite.class.php b/htdocs/core/modules/modExternalSite.class.php index 713c73475ed..5919c1d9162 100644 --- a/htdocs/core/modules/modExternalSite.class.php +++ b/htdocs/core/modules/modExternalSite.class.php @@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modExternalSite extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modFTP.class.php b/htdocs/core/modules/modFTP.class.php index 2a59f1b4f8d..679858692f5 100644 --- a/htdocs/core/modules/modFTP.class.php +++ b/htdocs/core/modules/modFTP.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modFTP extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 0439155203e..c27d72f7f67 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modFacture extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 1e3bb99c070..8c0b9bb3b5c 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modFicheinter extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modGeoIPMaxmind.class.php b/htdocs/core/modules/modGeoIPMaxmind.class.php index 092315f65f2..60975130fd4 100644 --- a/htdocs/core/modules/modGeoIPMaxmind.class.php +++ b/htdocs/core/modules/modGeoIPMaxmind.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modGeoIPMaxmind extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 35a6c51f688..6aadda390dd 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -247,7 +247,9 @@ class modHoliday extends DolibarrModules $keyforelement = 'holiday'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extrau'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extrau'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php index 693f0764e08..69678a85c29 100644 --- a/htdocs/core/modules/modLabel.class.php +++ b/htdocs/core/modules/modLabel.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modLabel extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index f01391e16af..2ea18f3b5bb 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modLoan extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index bb0a409ae36..f4b883763e4 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -33,7 +33,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modMailing extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php index 86061608d33..156ac3c451f 100644 --- a/htdocs/core/modules/modMailmanSpip.class.php +++ b/htdocs/core/modules/modMailmanSpip.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modMailmanSpip extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index 0e59169bda3..f2f0bcfc077 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modNotification extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 783f6300774..0a6e8d0b23e 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modOauth extends DolibarrModules { - /** * Constructor * diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 26a49337888..6030f23cbd4 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; */ class modOpenSurvey extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modPaymentByBankTransfer.class.php b/htdocs/core/modules/modPaymentByBankTransfer.class.php index 27c43a9b3da..1118b81f193 100644 --- a/htdocs/core/modules/modPaymentByBankTransfer.class.php +++ b/htdocs/core/modules/modPaymentByBankTransfer.class.php @@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modPaymentByBankTransfer extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index b857300431e..4e544f0cf79 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -34,7 +34,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modReceiptPrinter extends DolibarrModules { - /** * Constructor * diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 143d1fd2161..acca9803b2d 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; */ class modResource extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 31b66cac7c9..7062dac67eb 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modService extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * @@ -750,11 +749,11 @@ class modService extends DolibarrModules )); } - $this->import_convertvalue_array[$r] = array( + $this->import_convertvalue_array[$r] = array( 'sp.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty'), 'sp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') ); - $this->import_examplevalues_array[$r] = array( + $this->import_examplevalues_array[$r] = array( 'sp.fk_product' => "ref:PRODUCT_REF or id:123456", 'sp.fk_soc' => "My Supplier", 'sp.ref_fourn' => "XYZ-F123456", @@ -767,16 +766,16 @@ class modService extends DolibarrModules 'sp.delivery_time_days' => '5', 'sp.supplier_reputation' => 'FAVORITE / NOTTHGOOD / DONOTORDER' ); - if (is_object($mysoc) && $usenpr) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); - } - if (is_object($mysoc) && $mysoc->useLocalTax(1)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); - } - if (is_object($mysoc) && $mysoc->useLocalTax(2)) { - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); - } - $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( + if (is_object($mysoc) && $usenpr) { + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.recuperableonly'=>'')); + } + if (is_object($mysoc) && $mysoc->useLocalTax(1)) { + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type')); + } + if (is_object($mysoc) && $mysoc->useLocalTax(2)) { + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array('sp.localtax2_tx'=>'LT2', 'sp.localtax2_type'=>'LT2Type')); + } + $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( 'sp.price' => "50.00", 'sp.unitprice' => '10', // TODO Make this field not required and calculate it from price and qty diff --git a/htdocs/core/modules/modSocialNetworks.class.php b/htdocs/core/modules/modSocialNetworks.class.php index a38be8b2479..4f007a0d9e3 100644 --- a/htdocs/core/modules/modSocialNetworks.class.php +++ b/htdocs/core/modules/modSocialNetworks.class.php @@ -30,7 +30,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modSocialNetworks extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 47f39274a65..e799d5a2f11 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modSociete extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index 74f324ecace..652ba0480c9 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -426,7 +426,9 @@ class modStockTransfer extends DolibarrModules global $conf, $langs; $result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer'); - if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + if ($result < 0) { + return -1; + } // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') // Permissions $this->remove($options); @@ -437,17 +439,23 @@ class modStockTransfer extends DolibarrModules $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"'); $res = $this->db->fetch_object($resql); $nextid=$this->getNextId(); - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)'); + if (empty($res)) { + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)'); + } $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"'); $res = $this->db->fetch_object($resql); $nextid=$this->getNextId(); - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)'); + if (empty($res)) { + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)'); + } $resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"'); $res = $this->db->fetch_object($resql); $nextid=$this->getNextId(); - if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)'); + if (empty($res)) { + $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)'); + } return $this->_init($sql, $options); } diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index 674ba46601a..ae1e47c0d8e 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -61,7 +61,7 @@ class modSupplierProposal extends DolibarrModules // Data directories to create when module is enabled. $this->dirs = array(); - // Config pages. Put here list of php page names stored in admin directory used to setup module. + // Config pages. Put here list of php page names stored in admin directory used to setup module. $this->config_page_url = array("supplier_proposal.php"); // Dependencies diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 8a2cbf68bab..5b6d90f096b 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modSyslog extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modTax.class.php b/htdocs/core/modules/modTax.class.php index 9f753934f16..a5b318d1a2d 100644 --- a/htdocs/core/modules/modTax.class.php +++ b/htdocs/core/modules/modTax.class.php @@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modTax extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index de56f544a30..7061a3a9a57 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -337,9 +337,13 @@ class modTicket extends DolibarrModules $this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r] = array(array("ticket", "export")); $this->export_icon[$r]='ticket'; - $keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket'; + $keyforclass = 'Ticket'; + $keyforclassfile='/ticket/class/ticket.class.php'; + $keyforelement='ticket'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket'; + $keyforselect='ticket'; + $keyforaliasextra='extra'; + $keyforelement='ticket'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t'; diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php index 2e03c6759ee..df7018949f0 100644 --- a/htdocs/core/modules/modWebServices.class.php +++ b/htdocs/core/modules/modWebServices.class.php @@ -29,7 +29,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modWebServices extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modWebServicesClient.class.php b/htdocs/core/modules/modWebServicesClient.class.php index 8acd5647c76..bdd2f222cf6 100644 --- a/htdocs/core/modules/modWebServicesClient.class.php +++ b/htdocs/core/modules/modWebServicesClient.class.php @@ -29,7 +29,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modWebServicesClient extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index ea10ad5baf8..6a21435b489 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -30,7 +30,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modWebsite extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index 819df467fa3..bd37c5cceeb 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -31,7 +31,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modWorkflow extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index d3e4007f92a..1d69657c239 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -161,7 +161,7 @@ class pdf_standard extends ModelePDFMovement $product_id = GETPOST("product_id"); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); - $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist'; + $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'movementlist'; $idproduct = GETPOST('idproduct', 'int'); $year = GETPOST("year"); @@ -177,7 +177,7 @@ class pdf_standard extends ModelePDFMovement $search_qty = trim(GETPOST("search_qty")); $search_type_mouvement = GETPOST('search_type_mouvement', 'int'); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -512,8 +512,7 @@ class pdf_standard extends ModelePDFMovement $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index a3041a17177..88264d0f417 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -496,8 +496,7 @@ class pdf_vinci extends ModelePDFMo $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -548,8 +547,7 @@ class pdf_vinci extends ModelePDFMo $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = max($posYAfterDescription, $pdf->GetY()); @@ -829,7 +827,7 @@ class pdf_vinci extends ModelePDFMo } else { //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - //Local tax 1 + //Local tax 1 foreach ($this->localtax1 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -859,7 +857,7 @@ class pdf_vinci extends ModelePDFMo //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - //Local tax 2 + //Local tax 2 foreach ($this->localtax2 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -1027,7 +1025,9 @@ class pdf_vinci extends ModelePDFMo global $langs, $conf, $mysoc; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings")); diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index d7987b1dbec..17e99333509 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -150,8 +150,7 @@ if (GETPOST('code')) { // We are coming from oauth provider page } catch (Exception $e) { print $e->getMessage(); } -} else // If entry on page with no parameter, we arrive here -{ +} else { // If entry on page with no parameter, we arrive here $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; $_SESSION['oauthstateanticsrf'] = $state; diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index 39ff602db7d..f73eca899e6 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -150,8 +150,7 @@ if (GETPOST('code')) { // We are coming from oauth provider page } catch (Exception $e) { print $e->getMessage(); } -} else // If entry on page with no parameter, we arrive here -{ +} else { // If entry on page with no parameter, we arrive here $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; $_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider; $_SESSION['oauthstateanticsrf'] = $state; diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 76230dbadad..ab55169d1b8 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -530,9 +530,9 @@ class printing_printgcp extends PrintingDriver $html .= '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; $html .= '
'; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 7f1669b5b47..b4b60ec63b2 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -175,15 +175,13 @@ class pdf_standardlabel extends CommonStickerGenerator } $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); - } else // text on halft left and text on half right - { + } else { // text on halft left and text on half right $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } - } else // Only a right part - { + } else { // Only a right part // Output right area if ($textright == '%LOGO%' && $logo) { $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index d8566550e16..786f64302d3 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -203,15 +203,13 @@ class pdf_tcpdflabel extends CommonStickerGenerator $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($widthtouse - $logoWidth - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } - } else // text on halft left and text on half right - { + } else { // text on halft left and text on half right $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } - } else // Only a right part - { + } else { // Only a right part // Output right area if ($textright == '%LOGO%' && $logo) { $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, 0, $logoHeight); diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index b2bb0a58ea0..26cd78956e1 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -392,8 +392,7 @@ class doc_generic_product_odt extends ModelePDFProduct } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 1c4b4195afb..6bebea8d1e3 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -710,7 +710,9 @@ class pdf_standard extends ModelePDFProduct global $conf, $langs, $hookmanager; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders")); diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index e2f7872e9a6..84806ab2d36 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -60,7 +60,6 @@ abstract class ModelePDFProduct extends CommonDocGenerator */ abstract class ModeleProductCode extends CommonNumRefGenerator { - /** * @var int Automatic numbering */ diff --git a/htdocs/core/modules/product_batch/mod_lot_standard.php b/htdocs/core/modules/product_batch/mod_lot_standard.php index 843aa1dd78b..f6b674cf3f6 100644 --- a/htdocs/core/modules/product_batch/mod_lot_standard.php +++ b/htdocs/core/modules/product_batch/mod_lot_standard.php @@ -84,7 +84,8 @@ class mod_lot_standard extends ModeleNumRefBatch { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(batch FROM ".$posindice.") AS SIGNED)) as max"; @@ -129,7 +130,7 @@ class mod_lot_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $max = intval($obj->max); @@ -145,8 +146,11 @@ class mod_lot_standard extends ModeleNumRefBatch $date = dol_now(); $yymm = strftime("%y%m", $date); - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%04s", $max + 1); + if ($max >= (pow(10, 4) - 1)) { + $num = $max + 1; + } else { // If counter > 9999, we do not format on 4 chars, we take number as it is + $num = sprintf("%04s", $max + 1); + } dol_syslog("mod_lot_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index aa01fb692f2..41200b6fced 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -155,7 +155,7 @@ class mod_sn_advanced extends ModeleNumRefBatch } } - if (!$mask) { + if (!$mask) { $this->error = 'NotConfigured'; return 0; } diff --git a/htdocs/core/modules/product_batch/mod_sn_standard.php b/htdocs/core/modules/product_batch/mod_sn_standard.php index e1fdb0febb8..42d55ff92b7 100644 --- a/htdocs/core/modules/product_batch/mod_sn_standard.php +++ b/htdocs/core/modules/product_batch/mod_sn_standard.php @@ -84,7 +84,8 @@ class mod_sn_standard extends ModeleNumRefBatch { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(batch FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,7 @@ class mod_sn_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $max = intval($obj->max); @@ -129,7 +130,7 @@ class mod_sn_standard extends ModeleNumRefBatch $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) { + if ($resql) { $obj = $db->fetch_object($resql); if ($obj) { $max = intval($obj->max); @@ -145,8 +146,11 @@ class mod_sn_standard extends ModeleNumRefBatch $date = dol_now(); $yymm = strftime("%y%m", $date); - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%04s", $max + 1); + if ($max >= (pow(10, 4) - 1)) { + $num = $max + 1; + } else { // If counter > 9999, we do not format on 4 chars, we take number as it is + $num = sprintf("%04s", $max + 1); + } dol_syslog("mod_sn_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 0c25e9cde15..ec63bd80adb 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -661,8 +661,7 @@ class doc_generic_project_odt extends ModelePDFProjects } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index bc4ef3fb9d6..025f53f2ac7 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -369,8 +369,7 @@ class pdf_baleine extends ModelePDFProjects } } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index addb41c99ef..e582aec1a5b 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -580,8 +580,7 @@ class pdf_beluga extends ModelePDFProjects } } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index fa2206fc563..80759f92e81 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -368,8 +368,7 @@ class pdf_timespent extends ModelePDFProjects } } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b3a2d27f015..d542d255b4a 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -586,8 +586,7 @@ class doc_generic_task_odt extends ModelePDFTask } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 94bb215be1e..cc08c0ad20e 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -149,7 +149,7 @@ class mod_task_simple extends ModeleNumRefTask return -1; } - $date = empty($object->date_c) ?dol_now() : $object->date_c; + $date = empty($object->date_c) ? dol_now() : $object->date_c; //$yymm = strftime("%y%m",time()); $yymm = strftime("%y%m", $date); diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index add0de5d9e4..91ecf105346 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -136,7 +136,7 @@ class mod_task_universal extends ModeleNumRefTask return 0; } - $date = empty($object->date_c) ?dol_now() : $object->date_c; + $date = empty($object->date_c) ? dol_now() : $object->date_c; $numFinal = get_next_value($db, $mask, 'projet_task', 'ref', '', (is_object($objsoc) ? $objsoc->code_client : ''), $date); return $numFinal; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 3f72e7c332d..0afb2ed4d90 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -437,8 +437,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 35467a510a5..11860db0339 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -424,8 +424,12 @@ class pdf_azur extends ModelePDFPropales $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); - if ($tmpuser->email) $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; - if ($tmpuser->office_phone) $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; + if ($tmpuser->email) { + $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; + } + if ($tmpuser->office_phone) { + $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; + } $notetoshow = dol_concatdesc($notetoshow, $creator_info); } @@ -539,8 +543,7 @@ class pdf_azur extends ModelePDFPropales $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -1449,7 +1452,9 @@ class pdf_azur extends ModelePDFPropales global $conf, $langs; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills")); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 995183fb403..8668b79a293 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -153,7 +153,7 @@ class pdf_cyan extends ModelePDFPropales */ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - // phpcs:enable + // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')); @@ -397,8 +397,12 @@ class pdf_cyan extends ModelePDFPropales $tmpuser->fetch($object->user_author_id); $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); - if ($tmpuser->email) $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; - if ($tmpuser->office_phone) $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; + if ($tmpuser->email) { + $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; + } + if ($tmpuser->office_phone) { + $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; + } $notetoshow = dol_concatdesc($notetoshow, $creator_info); } @@ -621,8 +625,7 @@ class pdf_cyan extends ModelePDFPropales $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -1503,7 +1506,9 @@ class pdf_cyan extends ModelePDFPropales global $conf, $langs; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "propal", "companies", "bills")); diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 77867e3b6fe..571af59c06f 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -389,8 +389,7 @@ class doc_generic_reception_odt extends ModelePdfReception } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index d6ee56df513..e7e91dbfd89 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -474,8 +474,7 @@ class pdf_squille extends ModelePdfReception $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -933,10 +932,10 @@ class pdf_squille extends ModelePdfReception // Date planned delivery if (!empty($object->date_delivery)) { - $posy += 4; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } if (!empty($object->thirdparty->code_fournisseur)) { @@ -1044,7 +1043,7 @@ class pdf_squille extends ModelePdfReception $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); - // Show recipient name + // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); $pdf->MultiCell($widthrecbox - 2, 4, $carac_client_name, 0, 'L'); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 53ef85f0c7f..c2642f9bef4 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -369,8 +369,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 718a0acef51..da73a332a8a 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -59,7 +59,6 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator */ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator { - /** * @var int Automatic numbering */ @@ -211,7 +210,6 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator */ abstract class ModeleAccountancyCode extends CommonNumRefGenerator { - /** * @var string */ diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index e53790b5582..c583488eb2e 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -396,8 +396,7 @@ class doc_generic_stock_odt extends ModelePDFStock } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 9236e18641a..a2db0a7881b 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -329,8 +329,7 @@ class pdf_standard extends ModelePDFStock $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 1d14b772a49..7f42f2e83c2 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -105,7 +105,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined + if (!$this->emetteur->country_code) { + $this->emetteur->country_code = substr($langs->defaultlang, -2); + } // By default if not defined // Define position of columns $this->posxdesc = $this->marge_gauche + 1; @@ -124,7 +126,9 @@ class pdf_eagle extends ModelePDFStockTransfer $this->posxtotalht = $this->page_largeur - $this->marge_droite - 20; }*/ - if (getDolGlobalString('STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME')) $this->posxweightvol = $this->posxqty; + if (getDolGlobalString('STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME')) { + $this->posxweightvol = $this->posxqty; + } $this->posxpicture = $this->posxweightvol - (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images //var_dump($this->posxpicture, $this->posxweightvol);exit; @@ -165,9 +169,13 @@ class pdf_eagle extends ModelePDFStockTransfer $this->atLeastOneBatch = $this->atLeastOneBatch($object); - if (!is_object($outputlangs)) $outputlangs = $langs; + if (!is_object($outputlangs)) { + $outputlangs = $langs; + } // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (getDolGlobalString('MAIN_USE_FPDF')) $outputlangs->charset_output = 'ISO-8859-1'; + if (getDolGlobalString('MAIN_USE_FPDF')) { + $outputlangs->charset_output = 'ISO-8859-1'; + } // Load traductions files required by page $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); @@ -180,7 +188,9 @@ class pdf_eagle extends ModelePDFStockTransfer $objphoto = new Product($this->db); for ($i = 0; $i < $nblines; $i++) { - if (empty($object->lines[$i]->fk_product)) continue; + if (empty($object->lines[$i]->fk_product)) { + continue; + } $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); @@ -210,16 +220,22 @@ class pdf_eagle extends ModelePDFStockTransfer break; } - if ($realpath) $realpatharray[$i] = $realpath; + if ($realpath) { + $realpatharray[$i] = $realpath; + } } } - if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol; + if (count($realpatharray) == 0) { + $this->posxpicture = $this->posxweightvol; + } if (!empty($this->atLeastOneBatch)) { $this->posxpicture = $this->posxlot; - if (getDolGlobalString('MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE')) $this->posxpicture -= (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images + if (getDolGlobalString('MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE')) { + $this->posxpicture -= (!getDolGlobalString('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH') ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); + } // width of images } if ($conf->stocktransfer->dir_output) { @@ -259,7 +275,9 @@ class pdf_eagle extends ModelePDFStockTransfer $heightforinfotot = 8; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) - if (getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') > 0) $heightforfooter += 6; + if (getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') > 0) { + $heightforfooter += 6; + } $pdf->SetAutoPageBreak(1, 0); if (class_exists('TCPDF')) { @@ -277,7 +295,9 @@ class pdf_eagle extends ModelePDFStockTransfer $pagenb = 0; $pdf->SetDrawColor(128, 128, 128); - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); + if (method_exists($pdf, 'AliasNbPages')) { + $pdf->AliasNbPages(); + } $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Shipment")); @@ -292,7 +312,9 @@ class pdf_eagle extends ModelePDFStockTransfer // New page $pdf->AddPage(); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); @@ -344,7 +366,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Get code using getLabelFromKey $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); $label = ''; - if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."
"; + if ($object->tracking_url != $object->tracking_number) { + $label .= $outputlangs->trans("LinkToTrackYourPackage")."
"; + } $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); //var_dump($object->tracking_url != $object->tracking_number);exit; if ($object->tracking_url != $object->tracking_number) { @@ -391,7 +415,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Define size of image if we need it $imglinesize = array(); - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); + if (!empty($realpatharray[$i])) { + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); + } $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. @@ -404,16 +430,22 @@ class pdf_eagle extends ModelePDFStockTransfer // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) + if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; - else $showpricebeforepagebreak = 0; + } else { + $showpricebeforepagebreak = 0; + } } if (isset($imglinesize['width']) && isset($imglinesize['height'])) { @@ -460,20 +492,25 @@ class pdf_eagle extends ModelePDFStockTransfer if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $pdf->setPage($pageposafter + 1); } } else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) + if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; - else $showpricebeforepagebreak = 0; + } else { + $showpricebeforepagebreak = 0; + } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -487,12 +524,14 @@ class pdf_eagle extends ModelePDFStockTransfer // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -527,8 +566,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Warehouse source $wh_source = new Entrepot($db); - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; - else { + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) { + $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; + } else { $wh_source->fetch($object->lines[$i]->fk_warehouse_source); $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source; } @@ -537,8 +577,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Warehouse destination $wh_destination = new Entrepot($db); - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; - else { + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) { + $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; + } else { $wh_destination->fetch($object->lines[$i]->fk_warehouse_destination); $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination; } @@ -554,7 +595,9 @@ class pdf_eagle extends ModelePDFStockTransfer } $nexY += 3; - if ($weighttxt && $voltxt) $nexY += 2; + if ($weighttxt && $voltxt) { + $nexY += 2; + } // Add line if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) { @@ -577,7 +620,9 @@ class pdf_eagle extends ModelePDFStockTransfer $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } } if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { @@ -588,9 +633,13 @@ class pdf_eagle extends ModelePDFStockTransfer $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } $pagenb++; - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } } } @@ -608,7 +657,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); + if (method_exists($pdf, 'AliasNbPages')) { + $pdf->AliasNbPages(); + } $pdf->Close(); @@ -665,13 +716,17 @@ class pdf_eagle extends ModelePDFStockTransfer $pdf->SetFont('', 'B', $default_font_size - 1); // Tableau total - $col1x = $this->posxqty - 50; $col2x = $this->posxqty; + $col1x = $this->posxqty - 50; + $col2x = $this->posxqty; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; }*/ - if (!getDolGlobalString('STOCKTRANSFER_PDF_HIDE_ORDERED')) $largcol2 = ($this->posxwarehousesource - $this->posxqty); - else $largcol2 = ($this->posxwarehousedestination - $this->posxqty); + if (!getDolGlobalString('STOCKTRANSFER_PDF_HIDE_ORDERED')) { + $largcol2 = ($this->posxwarehousesource - $this->posxqty); + } else { + $largcol2 = ($this->posxwarehousedestination - $this->posxqty); + } $useborder = 0; $index = 0; @@ -684,9 +739,10 @@ class pdf_eagle extends ModelePDFStockTransfer $totalWeight = $tmparray['weight']; $totalVolume = $tmparray['volume']; $totalQty = 0; - if (!empty($object->lines)) - foreach ($object->lines as $line) { - $totalQty+=$line->qty; + if (!empty($object->lines)) { + foreach ($object->lines as $line) { + $totalQty+=$line->qty; + } } // Set trueVolume and volume_units not currently stored into database if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { @@ -694,10 +750,18 @@ class pdf_eagle extends ModelePDFStockTransfer $object->volume_units = $object->size_units * 3; } - if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); - if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); - if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); - if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); + if ($totalWeight != '') { + $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); + } + if ($totalVolume != '') { + $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); + } + if ($object->trueWeight) { + $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); + } + if ($object->trueVolume) { + $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); + } $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); @@ -730,7 +794,9 @@ class pdf_eagle extends ModelePDFStockTransfer $index++; } - if (!$totalWeighttoshow && !$totalVolumetoshow) $index++; + if (!$totalWeighttoshow && !$totalVolumetoshow) { + $index++; + } } $pdf->SetTextColor(0, 0, 0); @@ -758,7 +824,9 @@ class pdf_eagle extends ModelePDFStockTransfer // Force to disable hidetop and hidebottom $hidebottom = 0; - if ($hidetop) $hidetop = -1; + if ($hidetop) { + $hidetop = -1; + } $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -839,7 +907,6 @@ class pdf_eagle extends ModelePDFStockTransfer  */ public function atLeastOneBatch($object) { - global $conf; $atLeastOneBatch = false; @@ -1002,7 +1069,9 @@ class pdf_eagle extends ModelePDFStockTransfer $pdf->SetFont('', '', $default_font_size - 2); $text = $linkedobject->ref; - if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')'; + if ($linkedobject->ref_client) { + $text .= ' ('.$linkedobject->ref_client.')'; + } $Yoff = $Yoff + 8; $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); @@ -1027,18 +1096,28 @@ class pdf_eagle extends ModelePDFStockTransfer $result = $object->fetch_contact($arrayidcontact[0]); } - if ($usecontact) $thirdparty = $object->contact; - else $thirdparty = $this->emetteur; + if ($usecontact) { + $thirdparty = $object->contact; + } else { + $thirdparty = $this->emetteur; + } - if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + if (!empty($thirdparty)) { + $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } - if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); - else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + if ($usecontact) { + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); + } else { + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + } // Show sender $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->marge_gauche; - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx = $this->page_largeur - $this->marge_droite - 80; + if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { + $posx = $this->page_largeur - $this->marge_droite - 80; + } $hautcadre = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 38 : 40; $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82; @@ -1082,16 +1161,22 @@ class pdf_eagle extends ModelePDFStockTransfer $thirdparty = $object->thirdparty; } - if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + if (!empty($thirdparty)) { + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); // Show recipient $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; - if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + if ($this->page_largeur < 210) { + $widthrecbox = 84; + } // To work with US executive format $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx = $this->marge_gauche; + if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { + $posx = $this->marge_gauche; + } // Show recipient frame $pdf->SetTextColor(0, 0, 0); diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index cb0428262f5..06e68169278 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -115,7 +115,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Get source company $this->emetteur = $mysoc; - if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined + if (empty($this->emetteur->country_code)) { + $this->emetteur->country_code = substr($langs->defaultlang, -2); + } // By default, if was not defined // Define position of columns $this->posxdesc = $this->marge_gauche + 1; @@ -147,9 +149,13 @@ class pdf_eagle_proforma extends ModelePDFCommandes // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; - if (!is_object($outputlangs)) $outputlangs = $langs; + if (!is_object($outputlangs)) { + $outputlangs = $langs; + } // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO - if (getDolGlobalString('MAIN_USE_FPDF')) $outputlangs->charset_output = 'ISO-8859-1'; + if (getDolGlobalString('MAIN_USE_FPDF')) { + $outputlangs->charset_output = 'ISO-8859-1'; + } // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries")); @@ -175,7 +181,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes $objphoto = new Product($this->db); for ($i = 0; $i < $nblines; $i++) { - if (empty($object->lines[$i]->fk_product)) continue; + if (empty($object->lines[$i]->fk_product)) { + continue; + } $objphoto->fetch($object->lines[$i]->fk_product); //var_dump($objphoto->ref);exit; @@ -210,7 +218,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes } } - if ($realpath && $arephoto) $realpatharray[$i] = $realpath; + if ($realpath && $arephoto) { + $realpatharray[$i] = $realpath; + } } } @@ -295,7 +305,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes // New page $pdf->AddPage(); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } $pagenb++; $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetFont('', '', $default_font_size - 1); @@ -334,7 +346,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes $salereparray = $object->thirdparty->getSalesRepresentatives($user); $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) { + $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + } } } @@ -371,8 +385,12 @@ class pdf_eagle_proforma extends ModelePDFCommandes while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } // $this->_pagefoot($pdf,$object,$outputlangs,1); $pdf->setTopMargin($tab_top_newpage); // The only function to edit the bottom margin of current page to set it. @@ -425,12 +443,15 @@ class pdf_eagle_proforma extends ModelePDFCommandes // apply note frame to last page $pdf->setPage($pageposafternote); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); $posyafter = $pdf->GetY(); $height_note = $posyafter - $tab_top; @@ -443,8 +464,12 @@ class pdf_eagle_proforma extends ModelePDFCommandes $pagenb++; $pageposafternote++; $pdf->setPage($pageposafternote); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } $posyafter = $tab_top_newpage; } @@ -477,7 +502,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Define size of image if we need it $imglinesize = array(); - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); + if (!empty($realpatharray[$i])) { + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); + } $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. @@ -491,15 +518,19 @@ class pdf_eagle_proforma extends ModelePDFCommandes // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page $pdf->AddPage('', '', true); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } $pdf->setPage($pageposbefore + 1); $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) + if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; - else $showpricebeforepagebreak = 0; + } else { + $showpricebeforepagebreak = 0; + } } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) { @@ -534,19 +565,22 @@ class pdf_eagle_proforma extends ModelePDFCommandes if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposafter + 1); } } else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) + if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; - else $showpricebeforepagebreak = 0; + } else { + $showpricebeforepagebreak = 0; + } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } } @@ -564,7 +598,8 @@ class pdf_eagle_proforma extends ModelePDFCommandes // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -637,8 +672,11 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Collection of totals by value of vat in $this->tva["rate"] = total_tva - if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; - else $tvaligne = $object->lines[$i]->total_tva; + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { + $tvaligne = $object->lines[$i]->multicurrency_total_tva; + } else { + $tvaligne = $object->lines[$i]->total_tva; + } $localtax1ligne = $object->lines[$i]->total_localtax1; $localtax2ligne = $object->lines[$i]->total_localtax2; @@ -678,8 +716,12 @@ class pdf_eagle_proforma extends ModelePDFCommandes } } - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; - if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) { + $vatrate .= '*'; + } + if (!isset($this->tva[$vatrate])) { + $this->tva[$vatrate] = 0; + } $this->tva[$vatrate] += $tvaligne; // Add line @@ -704,7 +746,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } } if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == $pageposafter) { @@ -715,16 +759,22 @@ class pdf_eagle_proforma extends ModelePDFCommandes $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page $pdf->AddPage(); - if (!empty($tplidx)) $pdf->useTemplate($tplidx); + if (!empty($tplidx)) { + $pdf->useTemplate($tplidx); + } $pagenb++; - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } } } // Show square - if ($pagenb == $pageposbeforeprintlines) + if ($pagenb == $pageposbeforeprintlines) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); - else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); + } else { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); + } $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos @@ -736,7 +786,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Pied de page $this->_pagefoot($pdf, $object, $outputlangs); - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); + if (method_exists($pdf, 'AliasNbPages')) { + $pdf->AliasNbPages(); + } $pdf->Close(); @@ -922,7 +974,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) { $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); - if (!empty($object->fk_bank)) $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank + if (!empty($object->fk_bank)) { + $bankid = $object->fk_bank; + } // For backward compatibility when object->fk_account is forced with object->fk_bank $account = new Account($this->db); $account->fetch($bankid); @@ -960,7 +1014,8 @@ class pdf_eagle_proforma extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } @@ -1008,7 +1063,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes //$depositsamount=$object->getSumDepositsUsed(); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); - if (!empty($object->paye)) $resteapayer = 0; + if (!empty($object->paye)) { + $resteapayer = 0; + } if ($deja_regle > 0) { // Already paid + Deposits @@ -1056,7 +1113,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Force to disable hidetop and hidebottom $hidebottom = 0; - if ($hidetop) $hidetop = -1; + if ($hidetop) { + $hidetop = -1; + } $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1133,7 +1192,9 @@ class pdf_eagle_proforma extends ModelePDFCommandes if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; } else { @@ -1274,18 +1335,28 @@ class pdf_eagle_proforma extends ModelePDFCommandes $result = $object->fetch_contact($arrayidcontact[0]); } - if ($usecontact) $thirdparty = $object->contact; - else $thirdparty = $this->emetteur; + if ($usecontact) { + $thirdparty = $object->contact; + } else { + $thirdparty = $this->emetteur; + } - if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + if (!empty($thirdparty)) { + $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } - if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); - else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + if ($usecontact) { + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); + } else { + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); + } // Show sender $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->marge_gauche; - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx = $this->page_largeur - $this->marge_droite - 80; + if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { + $posx = $this->page_largeur - $this->marge_droite - 80; + } $hautcadre = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 38 : 40; $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82; @@ -1329,16 +1400,22 @@ class pdf_eagle_proforma extends ModelePDFCommandes $thirdparty = $object->thirdparty; } - if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + if (!empty($thirdparty)) { + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + } $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); // Show recipient $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100; - if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format + if ($this->page_largeur < 210) { + $widthrecbox = 84; + } // To work with US executive format $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42; $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; - if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx = $this->marge_gauche; + if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) { + $posx = $this->marge_gauche; + } // Show recipient frame $pdf->SetTextColor(0, 0, 0); diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php index 301bee244c0..192260118aa 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php @@ -85,7 +85,8 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,10 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer $resql = $db->query($sql); if ($resql) { $row = $db->fetch_row($resql); - if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; } + if ($row) { + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; + } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { $langs->load("errors"); @@ -135,8 +139,11 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - if ($obj) $max = intval($obj->max); - else $max = 0; + if ($obj) { + $max = intval($obj->max); + } else { + $max = 0; + } } else { dol_syslog("mod_stocktransfer_standard::getNextValue", LOG_DEBUG); return -1; @@ -146,8 +153,11 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer $date = $object->date_creation; $yymm = strftime("%y%m", $date); - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%04s", $max + 1); + if ($max >= (pow(10, 4) - 1)) { + $num = $max + 1; + } else { // If counter > 9999, we do not format on 4 chars, we take number as it is + $num = sprintf("%04s", $max + 1); + } dol_syslog("mod_stocktransfer_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 4ad2cf40f8b..4a5bbd80543 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -393,8 +393,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 2680a0e37ae..8c1cb380e87 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -406,8 +406,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -1070,8 +1069,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } else {*/ - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); //} $pdf->SetFont('', 'B', $default_font_size + 3); diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index b0b3f51657c..91e99e2f96d 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -388,8 +388,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index c73bacf5c0c..1ac5971a3e4 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -559,8 +559,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -998,7 +997,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } else { //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - //Local tax 1 + //Local tax 1 foreach ($this->localtax1 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -1028,7 +1027,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - //Local tax 2 + //Local tax 2 foreach ($this->localtax2 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -1176,7 +1175,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders global $langs, $conf, $mysoc; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings")); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 67b704da4c9..1fab71588e0 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -466,8 +466,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } @@ -877,7 +876,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } else { //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - //Local tax 1 + //Local tax 1 foreach ($this->localtax1 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -907,7 +906,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - //Local tax 2 + //Local tax 2 foreach ($this->localtax2 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index d75212a691d..9f4e77a2b97 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -337,8 +337,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 07b1ebf009d..021d0018fdb 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -416,8 +416,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 920d3dd0e49..84b08cc5066 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -462,8 +462,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 06c99477bd4..7c33a7454b4 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -559,8 +559,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $showpricebeforepagebreak = 0; } } - } else // No pagebreak - { + } else { // No pagebreak $pdf->commitTransaction(); } $posYAfterDescription = $pdf->GetY(); @@ -998,7 +997,7 @@ class pdf_zenith extends ModelePDFSupplierProposal } else { //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - //Local tax 1 + //Local tax 1 foreach ($this->localtax1 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -1028,7 +1027,7 @@ class pdf_zenith extends ModelePDFSupplierProposal //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - //Local tax 2 + //Local tax 2 foreach ($this->localtax2 as $localtax_type => $localtax_rate) { if (in_array((string) $localtax_type, array('2', '4', '6'))) { continue; @@ -1176,7 +1175,9 @@ class pdf_zenith extends ModelePDFSupplierProposal global $langs, $conf, $mysoc; $ltrdirection = 'L'; - if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } // Load translation files required by the page $outputlangs->loadLangs(array("main", "supplier_proposal", "companies", "bills", "sendings")); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 4fd85003bb5..4acb3ec6a7e 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -156,7 +156,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface if (!defined('SYSLOG_FILE_NO_ERROR') || !constant('SYSLOG_FILE_NO_ERROR')) { // Do not break dolibarr usage if log fails //throw new Exception('Failed to open log file '.basename($logfile)); - print 'Failed to open log file '.($dolibarr_main_prod ?basename($logfile) : $logfile); + print 'Failed to open log file '.($dolibarr_main_prod ? basename($logfile) : $logfile); } } else { $logLevels = array( @@ -177,7 +177,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface $this->lastTime = $now; } - $message = dol_print_date(dol_now('gmt'), 'standard', 'gmt').$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident > 0 ?str_pad('', $this->ident, ' ') : '').$content['message']; + $message = dol_print_date(dol_now('gmt'), 'standard', 'gmt').$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident > 0 ? str_pad('', $this->ident, ' ') : '').$content['message']; fwrite($filefd, $message."\n"); fclose($filefd); dolChmod($logfile); diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 7dcdb4cfebf..5f45b253c2e 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -346,8 +346,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 91b3cfee059..fa746b86c61 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -377,8 +377,7 @@ class doc_generic_user_odt extends ModelePDFUser } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 7663cc1bc60..07d83808621 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -414,8 +414,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { From d0b6b9fe65fb0e4e0dadda9ad7a07af977e546cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Dec 2023 12:07:53 +0100 Subject: [PATCH 22/28] Fix with php-cs-fixer --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- htdocs/core/actions_dellink.inc.php | 4 +- htdocs/core/actions_extrafields.inc.php | 2 +- htdocs/core/actions_fetchobject.inc.php | 4 +- htdocs/core/actions_linkedfiles.inc.php | 3 +- htdocs/core/actions_massactions.inc.php | 6 +- htdocs/core/customreports.php | 2 +- htdocs/core/datepicker.php | 22 +- htdocs/core/get_menudiv.php | 3 +- htdocs/core/menus/standard/auguria.lib.php | 8 +- htdocs/core/menus/standard/eldy.lib.php | 771 +++++++++--------- htdocs/core/menus/standard/eldy_menu.php | 3 +- htdocs/core/menus/standard/empty.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 16 +- .../core/tpl/admin_extrafields_edit.tpl.php | 14 +- .../core/tpl/admin_extrafields_view.tpl.php | 2 +- htdocs/core/tpl/ajaxrow.tpl.php | 2 +- htdocs/core/tpl/card_presend.tpl.php | 14 +- htdocs/core/tpl/commonfields_edit.tpl.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 18 +- .../tpl/extrafields_list_array_fields.tpl.php | 1 + .../tpl/extrafields_list_print_fields.tpl.php | 2 +- htdocs/core/tpl/filemanager.tpl.php | 10 +- htdocs/core/tpl/list_print_subtotal.tpl.php | 13 +- htdocs/core/tpl/list_print_total.tpl.php | 13 +- htdocs/core/tpl/login.tpl.php | 19 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 82 +- htdocs/core/tpl/objectline_edit.tpl.php | 28 +- htdocs/core/tpl/objectline_view.tpl.php | 44 +- htdocs/core/tpl/passwordforgotten.tpl.php | 11 +- htdocs/core/tpl/passwordreset.tpl.php | 11 +- .../core/triggers/dolibarrtriggers.class.php | 1 - ...e_20_modWorkflow_WorkflowManager.class.php | 4 +- ..._modBlockedlog_ActionsBlockedLog.class.php | 10 +- ...ntOrganization_EventOrganization.class.php | 2 +- ...terface_50_modTicket_TicketEmail.class.php | 2 +- 37 files changed, 576 insertions(+), 579 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index ba62254a595..8adc3d1f886 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -111,7 +111,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } } else { if ($key == 'lang') { - $value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : ""; + $value = GETPOST($key, 'aZ09') ? GETPOST($key, 'aZ09') : ""; } else { $value = GETPOST($key, 'alphanohtml'); } diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 9add235168e..3ba1df0b0e8 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -51,7 +51,9 @@ if ($action == 'addlinkbyref' && !empty($permissiondellink) && !$cancellink && $ $object->fetch($id); $object->fetch_thirdparty(); $result = $object->add_object_linked($addlink, $objecttmp->id); - if (isset($_POST['reftolinkto'])) unset($_POST['reftolinkto']); + if (isset($_POST['reftolinkto'])) { + unset($_POST['reftolinkto']); + } } elseif ($ret < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 3746b84b1c1..65f722ff0bb 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -378,7 +378,7 @@ if ($action == 'update') { $pos, $params, (GETPOST('alwayseditable', 'alpha') ? 1 : 0), - (GETPOST('perms', 'alpha') ?GETPOST('perms', 'alpha') : ''), + (GETPOST('perms', 'alpha') ? GETPOST('perms', 'alpha') : ''), $visibility, GETPOST('help', 'alpha'), GETPOST('default_value', 'alpha'), diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index 73d37e2ece5..6accca5710b 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -31,9 +31,9 @@ if (($id > 0 || (!empty($ref) && !in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0)) { if (($id > 0 && is_numeric($id)) || !empty($ref)) { // To discard case when id is list of ids like '1,2,3...' if ($object->element == 'usergroup') { - $ret = $object->fetch($id, (empty($ref)? '' : $ref), true); // to load $object->members + $ret = $object->fetch($id, (empty($ref) ? '' : $ref), true); // to load $object->members } else { - $ret = $object->fetch($id, (empty($ref)? '' : $ref)); + $ret = $object->fetch($id, (empty($ref) ? '' : $ref)); } if ($ret > 0) { $object->fetch_thirdparty(); diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 8e2e48eef8e..28d5d33800c 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -123,8 +123,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto if (GETPOST('section', 'alpha')) { // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; - } else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. - { + } else { // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. $urlfile = basename($urlfile); $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; if (!empty($upload_dirold)) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 41a34f292dc..6e375c363bd 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -946,7 +946,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { $resql = $db->query($sql); if ($resql) { $toselectnew = []; - while ( !empty($arr = $db->fetch_row($resql))) { + while (!empty($arr = $db->fetch_row($resql))) { $toselectnew[] = $arr[0]; } $toselect = (empty($toselectnew)) ? $toselect : $toselectnew; @@ -1221,7 +1221,7 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd $to_affecttag_type_array=array(); $categ_type_array=$categ->getMapList(); foreach ($categ_type_array as $categdef) { - if (in_array($categdef['code'], $affecttag_type_array)) { + if (in_array($categdef['code'], $affecttag_type_array)) { $to_affecttag_type_array[] = $categdef['code']; } } @@ -1744,7 +1744,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . ".php")) { require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . '.php'; - $modTask = new $obj; + $modTask = new $obj(); $defaultref = $modTask->getNextValue(0, $clone_task); } diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index f04dd7a991e..ff288424d37 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -29,7 +29,7 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) { require '../main.inc.php'; // Get parameters - $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... + $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph'; diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index f0528c37b7f..99779e9ec5e 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -172,15 +172,13 @@ function displayBox($selectedDate, $month, $year) } else { $selDate = 0; $xyz = 0; - } - ?> + } ?> + echo $langs->trans("Month".$selectMonth).", ".$selectYear; ?> + } ?>','','defaultlang ?>')">< @@ -294,8 +292,7 @@ function displayBox($selectedDate, $month, $year) echo ""; } echo "\n"; - } - ?> + } ?> + } ?>
trans("Month".$selectMonth).", ".$selectYear; - ?> @@ -194,11 +192,11 @@ function displayBox($selectedDate, $month, $year) echo "12"; } else { echo $month - 1; - }?>','','','','defaultlang ?>')">< ','','defaultlang ?>')"> ','','','','defaultlang ?>')">> 
socid)) { // If internal user or not defined $conf->standard_menu = (!getDolGlobalString('MAIN_MENU_STANDARD_FORCED') ? (!getDolGlobalString('MAIN_MENU_STANDARD') ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED); -} else // If external user -{ +} else { // If external user $conf->standard_menu = (!getDolGlobalString('MAIN_MENUFRONT_STANDARD_FORCED') ? (!getDolGlobalString('MAIN_MENUFRONT_STANDARD') ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED); } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 02d51f2a04e..644243da48c 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -149,9 +149,9 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); /*} elseif (!empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; @@ -170,7 +170,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (empty($noout)) { foreach ($menu->liste as $menuval) { print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); - print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget), $menuval); + print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ? DOL_URL_ROOT : '').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget), $menuval); print_end_menu_entry_auguria($menuval['enabled']); } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 073dd23f934..7899d12259b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -96,7 +96,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Members $tmpentry = array( 'enabled' => isModEnabled('adherent'), - 'perms' => $user->hasRight('adherent', 'lire'), + 'perms' => $user->hasRight('adherent', 'lire'), 'module' => 'adherent' ); $menu_arr[] = array( @@ -120,12 +120,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Third parties $tmpentry = array( - 'enabled'=> ((isModEnabled('societe') && + 'enabled'=> ( + ( + isModEnabled('societe') && (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') || !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) - ) + ) || (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) - ), - 'perms'=> ($user->hasRight('societe', 'lire') || $user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), + ), + 'perms'=> ($user->hasRight('societe', 'lire') || $user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), 'module'=>'societe|fournisseur' ); $menu_arr[] = array( @@ -150,7 +152,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Products-Services $tmpentry = array( 'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')), - 'perms'=> ($user->hasRight('product', 'read') || $user->hasRight('service', 'read') || $user->hasRight('expedition', 'lire')), + 'perms'=> ($user->hasRight('product', 'read') || $user->hasRight('service', 'read') || $user->hasRight('expedition', 'lire')), 'module'=>'product|service' ); $menu_arr[] = array( @@ -177,7 +179,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // MRP - GPAO $tmpentry = array( 'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')), - 'perms'=>($user->hasRight('bom', 'read') || $user->hasRight('mrp', 'read')), + 'perms'=>($user->hasRight('bom', 'read') || $user->hasRight('mrp', 'read')), 'module'=>'bom|mrp' ); $menu_arr[] = array( @@ -202,7 +204,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Projects $tmpentry = array( 'enabled'=> (isModEnabled('projet') ? 1 : 0), - 'perms'=> ($user->hasRight('projet', 'lire') ? 1 : 0), + 'perms'=> ($user->hasRight('projet', 'lire') ? 1 : 0), 'module'=>'projet' ); @@ -239,33 +241,35 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Commercial (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter) $tmpentry = array( - 'enabled'=>(isModEnabled('propal') + 'enabled'=>( + isModEnabled('propal') || isModEnabled('commande') || isModEnabled('fournisseur') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('contrat') || isModEnabled('ficheinter') - ) ? 1 : 0, - 'perms'=>($user->hasRight('propal', 'read') - || $user->hasRight('commande', 'lire') - || $user->hasRight('supplier_proposal', 'lire') - || $user->hasRight('fournisseur', 'lire') - || $user->hasRight('fournisseur', 'commande', 'lire') - || $user->hasRight('supplier_order', 'lire') - || $user->hasRight('contrat', 'lire') - || $user->hasRight('ficheinter', 'lire') - ), + ) ? 1 : 0, + 'perms'=>( + $user->hasRight('propal', 'read') + || $user->hasRight('commande', 'lire') + || $user->hasRight('supplier_proposal', 'lire') + || $user->hasRight('fournisseur', 'lire') + || $user->hasRight('fournisseur', 'commande', 'lire') + || $user->hasRight('supplier_order', 'lire') + || $user->hasRight('contrat', 'lire') + || $user->hasRight('ficheinter', 'lire') + ), 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); - $onlysupplierorder = $user->hasRight('fournisseur', 'commande', 'lire') && - !$user->hasRight('propal', 'lire') && - !$user->hasRight('commande', 'lire') && - !$user->hasRight('supplier_order', 'lire') && - !$user->hasRight('supplier_proposal', 'lire') && - !$user->hasRight('contrat', 'lire') && - !$user->hasRight('ficheinter', 'lire'); + $onlysupplierorder = $user->hasRight('fournisseur', 'commande', 'lire') && + !$user->hasRight('propal', 'lire') && + !$user->hasRight('commande', 'lire') && + !$user->hasRight('supplier_order', 'lire') && + !$user->hasRight('supplier_proposal', 'lire') && + !$user->hasRight('contrat', 'lire') && + !$user->hasRight('ficheinter', 'lire'); $menu_arr[] = array( 'name' => 'Commercial', @@ -288,17 +292,18 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Billing - Financial $tmpentry = array( - 'enabled'=>(isModEnabled('facture') || + 'enabled'=>( + isModEnabled('facture') || isModEnabled('don') || isModEnabled('tax') || isModEnabled('salaries') || isModEnabled('supplier_invoice') || isModEnabled('loan') || isModEnabled('margins') - ) ? 1 : 0, - 'perms'=>($user->hasRight('facture', 'lire') || $user->hasRight('don', 'contact', 'lire') - || $user->hasRight('tax', 'charges', 'lire') || $user->hasRight('salaries', 'read') - || $user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('loan', 'read') || $user->hasRight('margins', 'liretous')), + ) ? 1 : 0, + 'perms'=>($user->hasRight('facture', 'lire') || $user->hasRight('don', 'contact', 'lire') + || $user->hasRight('tax', 'charges', 'lire') || $user->hasRight('salaries', 'read') + || $user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('loan', 'read') || $user->hasRight('margins', 'liretous')), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( @@ -323,7 +328,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Bank $tmpentry = array( 'enabled'=>(isModEnabled('banque') || isModEnabled('prelevement')), - 'perms'=>($user->hasRight('banque', 'lire') || $user->hasRight('prelevement', 'lire') || $user->hasRight('paymentbybanktransfer', 'read')), + 'perms'=>($user->hasRight('banque', 'lire') || $user->hasRight('prelevement', 'lire') || $user->hasRight('paymentbybanktransfer', 'read')), 'module'=>'banque|prelevement|paymentbybanktransfer' ); $menu_arr[] = array( @@ -348,7 +353,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Accounting $tmpentry = array( 'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')), - 'perms'=>($user->hasRight('compta', 'resultat', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire') || $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('asset', 'read') || $user->hasRight('intracommreport', 'read')), + 'perms'=>($user->hasRight('compta', 'resultat', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire') || $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('asset', 'read') || $user->hasRight('intracommreport', 'read')), 'module'=>'comptabilite|accounting|asset|intracommreport' ); $menu_arr[] = array( @@ -373,7 +378,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // HRM $tmpentry = array( 'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')), - 'perms'=>($user->hasRight('user', 'user', 'lire') || $user->hasRight('holiday', 'read') || $user->hasRight('deplacement', 'lire') || $user->hasRight('expensereport', 'lire') || $user->hasRight('recruitment', 'recruitmentjobposition', 'read')), + 'perms'=>($user->hasRight('user', 'user', 'lire') || $user->hasRight('holiday', 'read') || $user->hasRight('deplacement', 'lire') || $user->hasRight('expensereport', 'lire') || $user->hasRight('recruitment', 'recruitmentjobposition', 'read')), 'module'=>'hrm|holiday|deplacement|expensereport|recruitment' ); @@ -399,7 +404,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Tickets and Knowledge base $tmpentry = array( 'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')), - 'perms'=>($user->hasRight('ticket', 'read') || $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')), + 'perms'=>($user->hasRight('ticket', 'read') || $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')), 'module'=>'ticket|knowledgemanagement' ); $link = ''; @@ -538,7 +543,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $idsel, $classname, $newTabMenu[$i]['prefix'] - ); + ); } // Sort on position @@ -558,9 +563,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); /*} elseif (!empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; @@ -579,7 +584,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (empty($noout)) { foreach ($menu->liste as $menuval) { print_start_menu_entry($menuval['idsel'], $menuval['classname'], $menuval['enabled']); - print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url'] != '#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget), $menuval); + print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url'] != '#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT : '').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget), $menuval); print_end_menu_entry($menuval['enabled']); } } @@ -1115,9 +1120,15 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = if ($usemenuhider || empty($leftmenu) || $leftmenu == "setup") { $nbmodulesnotautoenabled = count($conf->modules); - if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--; - if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--; - if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--; + if (in_array('fckeditor', $conf->modules)) { + $nbmodulesnotautoenabled--; + } + if (in_array('export', $conf->modules)) { + $nbmodulesnotautoenabled--; + } + if (in_array('import', $conf->modules)) { + $nbmodulesnotautoenabled--; + } // Load translation files required by the page $langs->loadLangs(array("admin", "help")); @@ -1196,17 +1207,17 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); if ($user->hasRight('user', 'user', 'read')) { if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { - $newmenu->add("", $langs->trans("Users"), 1, $user->hasRight('user', 'user', 'lire') || $user->admin); + $newmenu->add("", $langs->trans("Users"), 1, $user->hasRight('user', 'user', 'lire') || $user->admin); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->hasRight("user", "user", "write") || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')), '', 'home'); - $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); - $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); + $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); + $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } - $newmenu->add("", $langs->trans("Groups"), 1, ($user->hasRight('user', 'user', 'lire') || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))); + $newmenu->add("", $langs->trans("Groups"), 1, ($user->hasRight('user', 'user', 'lire') || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))); $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight("user", "group_advance", "create") : $user->hasRight("user", "user", "create")) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('user', 'group_advance', 'read') : $user->hasRight('user', 'user', 'lire')) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('user', 'group_advance', 'read') : $user->hasRight('user', 'user', 'lire')) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))); } } } @@ -1230,9 +1241,9 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le // Societes if (isModEnabled('societe')) { $langs->load("companies"); - $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->hasRight('societe', 'lire'), '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->hasRight('societe', 'lire'), '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); - if ($user->hasRight('societe', 'creer')) { + if ($user->hasRight('societe', 'creer')) { $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); if (!$conf->use_javascript_ajax) { $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); @@ -1245,7 +1256,7 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le // Prospects if (isModEnabled('societe') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'prospects'); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->hasRight('societe', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->hasRight('societe', 'lire')); @@ -1253,22 +1264,22 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->hasRight('societe', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->hasRight('societe', 'lire')); */ - $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->hasRight('societe', 'creer')); + $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->hasRight('societe', 'creer')); } // Customers/Prospects if (isModEnabled('societe') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'customers'); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'customers'); - $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->hasRight('societe', 'creer')); + $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->hasRight('societe', 'creer')); } // Suppliers if (isModEnabled('societe') && (isModEnabled('supplier_order') || isModEnabled('supplier_invoice') || isModEnabled('supplier_proposal'))) { $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), '', $mainmenu, 'suppliers'); - $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->hasRight('societe', 'creer') && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire'))); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->hasRight('societe', 'creer') && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire'))); } // Categories @@ -1283,36 +1294,36 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le if (getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { $menutoshow = $langs->trans("ProspectsCategoriesShort"); } - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } // Categories suppliers if (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->hasRight('categorie', 'lire')); + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->hasRight('categorie', 'lire')); } } // Contacts - $newmenu->add("/societe/index.php?leftmenu=thirdparties", (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->hasRight('societe', 'contact', 'lire'), '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->hasRight('societe', 'contact', 'lire'), '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->hasRight('societe', 'contact', 'creer')); - $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->hasRight('societe', 'contact', 'creer')); + $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->hasRight('societe', 'contact', 'lire')); if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->hasRight('societe', 'contact', 'lire')); } if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); } if (isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('fournisseur', 'lire')); } - $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire')); // Categories if (isModEnabled('categorie')) { $langs->load("categories"); // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } } } @@ -1337,108 +1348,108 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left // Customer proposal if (isModEnabled('propal')) { $langs->load("propal"); - $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->hasRight('propal', 'read'), '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propal', 'write')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->hasRight('propal', 'read'), '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propal', 'write')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propal', 'read')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propal', 'read')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propal', 'read')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propal', 'read')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propal', 'read')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propal', 'read')); //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->hasRight('propal', 'read')); } - $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propal', 'read')); } // Customers orders if (isModEnabled('commande')) { $langs->load("orders"); - $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->hasRight('commande', 'creer')); - $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->hasRight('commande', 'creer')); + $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->hasRight('commande', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->hasRight('commande', 'lire')); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->hasRight('commande', 'lire')); if (isModEnabled('expedition')) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->hasRight('commande', 'lire')); } - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->hasRight('commande', 'lire')); //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->hasRight('commande', 'lire')); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire')); } if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($user->socid)) { - $newmenu->add("/commande/list_det.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list_det.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire')); } if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) { $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->hasRight('commande', 'commande', 'export')); } else { - $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->hasRight('commande', 'lire')); } } // Supplier proposal if (isModEnabled('supplier_proposal')) { $langs->load("supplier_proposal"); - $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->hasRight('supplier_proposal', 'lire'), '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->hasRight('supplier_proposal', 'creer')); - $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->hasRight('supplier_proposal', 'lire')); - $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('supplier_proposal', 'lire')); + $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->hasRight('supplier_proposal', 'lire'), '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->hasRight('supplier_proposal', 'creer')); + $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->hasRight('supplier_proposal', 'lire')); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('supplier_proposal', 'lire')); } // Suppliers orders if (isModEnabled('supplier_order')) { $langs->load("orders"); - $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->hasRight('fournisseur', 'commande', 'lire'), '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->hasRight('fournisseur', 'commande', 'creer')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->hasRight('fournisseur', 'commande', 'lire'), '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->hasRight('fournisseur', 'commande', 'creer')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); if (!getDolGlobalString('SUPPLIER_ORDER_HIDE_VALIDATED')) { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); } - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); } // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) { $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'commande', 'export')); } else { - $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); } } // Contrat if (isModEnabled('contrat')) { $langs->load("contracts"); - $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->hasRight('contrat', 'lire'), '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->hasRight('contrat', 'creer')); - $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire')); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->hasRight('contrat', 'lire'), '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->hasRight('contrat', 'creer')); + $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire')); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire')); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire')); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire')); } } // Interventions if (isModEnabled('ficheinter')) { $langs->load("interventions"); - $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->hasRight('ficheinter', 'lire'), '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->hasRight('ficheinter', 'creer'), '', '', '', 201); - $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 202); + $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->hasRight('ficheinter', 'lire'), '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->hasRight('ficheinter', 'creer'), '', '', '', 201); + $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 202); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 203); + $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 203); } - $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->hasRight('ficheinter', 'lire')); + $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->hasRight('ficheinter', 'lire')); } } } @@ -1463,59 +1474,59 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Customers invoices if (isModEnabled('facture')) { $langs->load("bills"); - $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->hasRight('facture', 'creer')); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_list'); + $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->hasRight('facture', 'creer')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_list'); if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('facture', 'lire')); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('facture', 'lire')); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('facture', 'lire')); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->hasRight('facture', 'lire')); } - $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->hasRight('facture', 'creer'), '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. + $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->hasRight('facture', 'creer'), '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. - $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment'); + $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment'); if (getDolGlobalString('BILL_ADD_PAYMENT_VALIDATION')) { - $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customer_bills_tovalid'); + $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customer_bills_tovalid'); } if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { - $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment_report'); + $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment_report'); } - $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_stats'); + $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_stats'); } // Suppliers invoices if (isModEnabled('societe') && isModEnabled('supplier_invoice')) { $langs->load("bills"); - $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')), '', $mainmenu, 'suppliers_bills_create'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_list'); + $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')), '', $mainmenu, 'suppliers_bills_create'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_list'); if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_draft'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_notpaid'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_paid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_draft'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_notpaid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_paid'); } - $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'supplierinvoicestemplate_list'); + $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'supplierinvoicestemplate_list'); - $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment'); + $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment'); if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment_report'); + $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment_report'); } - $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_stats'); + $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_stats'); } // Orders if (isModEnabled('commande')) { $langs->load("orders"); if (isModEnabled('facture')) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); } //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire')); } @@ -1524,7 +1535,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen if (isModEnabled('supplier_invoice')) { if (getDolGlobalString('SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE')) { $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire')); } } @@ -1533,58 +1544,58 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Donations if (isModEnabled('don')) { $langs->load("donations"); - $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->hasRight('don', 'lire'), '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->hasRight('don', 'lire'), '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { - $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->hasRight('don', 'creer')); - $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->hasRight('don', 'lire')); + $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->hasRight('don', 'creer')); + $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->hasRight('don', 'lire')); } // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->hasRight('don', 'lire')); } // Taxes and social contributions if (isModEnabled('tax')) { - $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { - $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->hasRight('tax', 'charges', 'creer')); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); } // VAT if (!getDolGlobalString('TAX_DISABLE_VAT_MENUS')) { global $mysoc; - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax_vat'); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax_vat'); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { - $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } //Local Taxes 1 if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } } //Local Taxes 2 if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } } } @@ -1593,21 +1604,21 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Salaries if (isModEnabled('salaries')) { $langs->load("salaries"); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->hasRight('salaries', 'read'), '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->hasRight('salaries', 'read'), '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { - $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->hasRight('salaries', 'write')); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->hasRight('salaries', 'read')); - $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->hasRight('salaries', 'read')); - $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->hasRight('salaries', 'read')); + $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->hasRight('salaries', 'write')); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->hasRight('salaries', 'read')); + $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->hasRight('salaries', 'read')); + $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->hasRight('salaries', 'read')); } } // Loan if (isModEnabled('loan')) { $langs->load("loan"); - $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->hasRight('loan', 'read'), '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->hasRight('loan', 'read'), '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { - $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->hasRight('loan', 'write')); + $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->hasRight('loan', 'write')); //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->hasRight('loan', 'read')); } } @@ -1615,10 +1626,10 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Various payment if (isModEnabled('banque') && !getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT')) { $langs->load("banks"); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { - $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->hasRight('banque', 'modifier')); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->hasRight('banque', 'lire')); + $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->hasRight('banque', 'modifier')); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->hasRight('banque', 'lire')); } } } @@ -1648,67 +1659,67 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); // Configuration - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { global $mysoc; - $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_general', 10); + $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_general', 10); // Fiscal year - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'fiscalyear', 20); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'fiscalyear', 20); - $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_journal', 30); - $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chartmodel', 40); - $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 60); + $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_journal', 30); + $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chartmodel', 40); + $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 60); if (isModEnabled('banque')) { - $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_bank', 70); + $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_bank', 70); } if (isModEnabled('facture') || isModEnabled('supplier_invoice')) { - $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 80); + $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 80); } if (isModEnabled('tax')) { - $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 90); + $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 90); } if (isModEnabled('expensereport')) { - $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 100); + $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 100); } - $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110); - $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); - $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); - $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_export', 130); + $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110); + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); + $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); + $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_export', 130); } // Transfer in accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); // Binding // $newmenu->add("", $langs->trans("Binding"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch'); if (isModEnabled('facture') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_SALES')) { - $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_customer'); + $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_customer'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { - $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); - $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } if (isModEnabled('supplier_invoice') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) { - $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_supplier'); + $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_supplier'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { - $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); - $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } if (isModEnabled('expensereport') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) { - $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_expensereport'); + $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_expensereport'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { - $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); - $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } // Journals - if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy_journal'); + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy_journal'); // Multi journal $sql = "SELECT rowid, code, label, nature"; @@ -1735,7 +1746,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($objp->nature == 3 && isModEnabled('supplier_invoice') && !getDolGlobalString('ACCOUNTING_DISABLE_BINDING_ON_PURCHASES')) { - $nature = "purchases"; + $nature = "purchases"; } if ($objp->nature == 4 && isModEnabled('banque')) { $nature = "bank"; @@ -1753,7 +1764,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $nature = "hasnew"; } - // To enable when page exists + // To enable when page exists if (!getDolGlobalString('ACCOUNTANCY_SHOW_DEVELOP_JOURNAL')) { if ($nature == 'hasnew' || $nature == 'inventory') { $nature = ''; @@ -1769,15 +1780,15 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } $key = $langs->trans("AccountingJournalType".$objp->nature); // $objp->nature is 1, 2, 3 ... - $transferlabel = (($objp->nature && $key != "AccountingJournalType".$objp->nature) ? $key.($journallabelwithoutspan != $key ? ' '.$journallabel : ''): $journallabel); + $transferlabel = (($objp->nature && $key != "AccountingJournalType".$objp->nature) ? $key.($journallabelwithoutspan != $key ? ' '.$journallabel : '') : $journallabel); - $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); } $i++; } } else { // Should not happend. Entries are added - $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); } } else { dol_print_error($db); @@ -1787,48 +1798,48 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef // Files if (!getDolGlobalString('ACCOUNTANCY_HIDE_EXPORT_FILES_MENU')) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); } // Accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); // General Ledger - $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); + $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Journals - $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); + $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Account Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Export accountancy - $newmenu->add("/accountancy/bookkeeping/export.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("MenuExportAccountancy"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); + $newmenu->add("/accountancy/bookkeeping/export.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("MenuExportAccountancy"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Closure - $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'closure'); + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'closure'); // Reports - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'ca'); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'ca'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED } if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } @@ -1836,34 +1847,34 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef //if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->hasRight('accounting', 'comptarapport', 'lire')); //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->hasRight('accounting', 'comptarapport', 'lire')); } } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. } if ($modecompta && isModEnabled('supplier_invoice')) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } $modecompta = 'RECETTES-DEPENSES'; - if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. } if ($modecompta && ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || isModEnabled('supplier_invoice'))) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } } @@ -1872,15 +1883,15 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if (isModEnabled('comptabilite')) { // Files if (!getDolGlobalString('ACCOUNTANCY_HIDE_EXPORT_FILES_MENU')) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); } // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByPredefinedAccountGroups"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByPredefinedAccountGroups"), 2, $user->hasRight('compta', 'resultat', 'lire')); /* On verra ca avec module compabilite expert $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->hasRight('compta', 'resultat', 'lire')); $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->hasRight('compta', 'resultat', 'lire')); @@ -1895,22 +1906,22 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef */ $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->hasRight('compta', 'resultat', 'lire')); $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); //Achats $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); /* $modecompta = 'RECETTES-DEPENSES'; @@ -1920,31 +1931,31 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef */ // Journals - $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 50); - $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 51); + $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 50); + $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 51); } //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->hasRight('compta', 'resultat', 'lire')||$user->hasRight('accounting', 'comptarapport', 'lire')); } // Intracomm report if (isModEnabled('intracommreport')) { - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { // DEB / DES - $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->hasRight('intracommreport', 'write'), '', $mainmenu, 'intracommreport', 1); - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->hasRight('intracommreport', 'write'), '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 1); } } // Assets if (isModEnabled('asset')) { - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->hasRight('asset', 'read'), '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->hasRight('asset', 'write')); - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->hasRight('asset', 'read')); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')), '', $mainmenu, 'asset_model'); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->hasRight('asset', 'read'), '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->hasRight('asset', 'write')); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->hasRight('asset', 'read')); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')), '', $mainmenu, 'asset_model'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { - $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read'))); + $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read'))); } } } @@ -1970,56 +1981,56 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Bank-Cash account if (isModEnabled('banque')) { - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->hasRight('banque', 'configurer')); - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank'); - $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->hasRight('banque', 'lire')); - $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->hasRight('banque', 'lire')); + $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->hasRight('banque', 'configurer')); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank'); + $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->hasRight('banque', 'lire')); + $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->hasRight('banque', 'lire')); - $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->hasRight('banque', 'transfer')); + $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->hasRight('banque', 'transfer')); } if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->hasRight('categorie', 'creer'), '', $mainmenu, 'tags'); - $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->hasRight('banque', 'configurer'), '', $mainmenu, 'tags'); + $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->hasRight('categorie', 'creer'), '', $mainmenu, 'tags'); + $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->hasRight('banque', 'configurer'), '', $mainmenu, 'tags'); } // Direct debit order if (isModEnabled('prelevement')) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->hasRight('prelevement', 'bons', 'lire'), '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->hasRight('prelevement', 'bons', 'lire'), '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { - $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->hasRight('prelevement', 'bons', 'creer')); + $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->hasRight('prelevement', 'bons', 'creer')); - $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->hasRight('prelevement', 'bons', 'lire')); - $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->hasRight('prelevement', 'bons', 'lire')); - $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('prelevement', 'bons', 'lire')); - $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('prelevement', 'bons', 'lire')); } } // Bank transfer order if (isModEnabled('paymentbybanktransfer')) { - $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->hasRight('paymentbybanktransfer', 'read'), '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->hasRight('paymentbybanktransfer', 'read'), '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { - $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->hasRight('paymentbybanktransfer', 'create')); + $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->hasRight('paymentbybanktransfer', 'create')); - $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->hasRight('paymentbybanktransfer', 'read')); - $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->hasRight('paymentbybanktransfer', 'read')); - $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('paymentbybanktransfer', 'read')); - $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('paymentbybanktransfer', 'read')); } } // Management of checks if (!getDolGlobalString('BANK_DISABLE_CHECK_DEPOSIT') && isModEnabled('banque') && (isModEnabled('facture') || getDolGlobalString('MAIN_MENU_CHEQUE_DEPOSIT_ON'))) { - $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->hasRight('banque', 'cheque'), '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->hasRight('banque', 'cheque'), '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if (preg_match('/checks/', $leftmenu)) { - $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->hasRight('banque', 'cheque')); - $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'cheque')); + $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->hasRight('banque', 'cheque')); + $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'cheque')); } } @@ -2050,51 +2061,51 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme if ($mainmenu == 'products') { // Products if (isModEnabled('product')) { - $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer')); - $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read')); + $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer')); + $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read')); if (isModEnabled('stock')) { - $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); + $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); } if (isModEnabled('productbatch')) { $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); - $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); + $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); + $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); } if (isModEnabled('variants')) { - $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('product', 'read')); + $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('product', 'read')); } if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('product', 'read')); + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('product', 'read')); } // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->hasRight('categorie', 'lire')); } } // Services if (isModEnabled('service')) { - $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer')); - $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read')); + $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer')); + $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read')); if (isModEnabled('Stock') && getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { - $newmenu->add("/product/reassort.php?type=1", $langs->trans("MenuStocks"), 1, $user->hasRight('service', 'read') && $user->hasRight('stock', 'lire')); + $newmenu->add("/product/reassort.php?type=1", $langs->trans("MenuStocks"), 1, $user->hasRight('service', 'read') && $user->hasRight('stock', 'lire')); } if (isModEnabled('variants')) { - $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('service', 'read')); + $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('service', 'read')); } if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'read')); + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'read')); } // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->hasRight('categorie', 'lire')); } } @@ -2104,41 +2115,41 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $langs->load("stocks"); $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"')); $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer')); - $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); + $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire')); $newmenu->add("/product/stock/massstockmove.php?init=1", $langs->trans("MassStockTransferShort"), 1, $user->hasRight('stock', 'mouvement', 'creer')); if (isModEnabled('supplier_order')) { - $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire')); + $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire')); } $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire')); // Categories for warehouses if (isModEnabled('categorie')) { - $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } } if (isModEnabled('stocktransfer')) { - $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->hasRight('stocktransfer', 'stocktransfer', 'read'), '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"')); - $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'write')); - $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'read')); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->hasRight('stocktransfer', 'stocktransfer', 'read'), '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"')); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'write')); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'read')); } // Inventory if (isModEnabled('stock')) { $langs->load("stocks"); if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'creer')); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'creer')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); } } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'inventory_advance', 'read'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'inventory_advance', 'read'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'inventory_advance', 'write')); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'inventory_advance', 'read')); + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'inventory_advance', 'write')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'inventory_advance', 'read')); } } } @@ -2146,33 +2157,33 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme // Shipments if (isModEnabled('expedition')) { $langs->load("sendings"); - $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->hasRight('expedition', 'lire'), '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->hasRight('expedition', 'creer')); - $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->hasRight('expedition', 'lire'), '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->hasRight('expedition', 'creer')); + $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->hasRight('expedition', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->hasRight('expedition', 'lire')); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->hasRight('expedition', 'lire')); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->hasRight('expedition', 'lire')); } - $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->hasRight('expedition', 'lire')); } // Receptions if (isModEnabled('reception')) { $langs->load("receptions"); - $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->hasRight('reception', 'lire'), '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->hasRight('reception', 'creer')); - $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->hasRight('reception', 'lire')); + $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->hasRight('reception', 'lire'), '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->hasRight('reception', 'creer')); + $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->hasRight('reception', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->hasRight('reception', 'lire')); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->hasRight('reception', 'lire')); } if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->hasRight('reception', 'lire')); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->hasRight('reception', 'lire')); } if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->hasRight('reception', 'lire')); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->hasRight('reception', 'lire')); } - $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->hasRight('reception', 'lire')); + $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->hasRight('reception', 'lire')); } } } @@ -2196,17 +2207,17 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = if (isModEnabled('bom') || isModEnabled('mrp')) { $langs->load("mrp"); - $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->hasRight('bom', 'write'), '', $mainmenu, 'bom'); - $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom'); + $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->hasRight('bom', 'write'), '', $mainmenu, 'bom'); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom'); } if (isModEnabled('mrp')) { $langs->load("mrp"); - $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->hasRight('mrp', 'read'), '', $mainmenu, 'mrp', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->hasRight('mrp', 'write'), '', $mainmenu, ''); - $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->hasRight('mrp', 'read'), '', $mainmenu, ''); + $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->hasRight('mrp', 'read'), '', $mainmenu, 'mrp', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->hasRight('mrp', 'write'), '', $mainmenu, ''); + $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->hasRight('mrp', 'read'), '', $mainmenu, ''); } } } @@ -2233,7 +2244,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $tmpentry = array( 'enabled'=>isModEnabled('projet'), - 'perms'=>$user->hasRight('projet', 'lire'), + 'perms'=>$user->hasRight('projet', 'lire'), 'module'=>'projet' ); $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -2251,8 +2262,8 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme } // Project assigned to user - $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->hasRight('projet', 'creer')); + $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->hasRight('projet', 'creer')); if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); @@ -2264,23 +2275,23 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } - $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); + $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { // Project assigned to user - $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->hasRight('projet', 'creer')); - $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); - $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); + $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->hasRight('projet', 'creer')); + $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); + $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("TimeEntry"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("TimeEntry"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); } } } @@ -2338,47 +2349,47 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Load translation files required by the page $langs->loadLangs(array("holiday", "trips")); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->hasRight('holiday', 'write'), '', $mainmenu); - $newmenu->add("/holiday/card_group.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("NewHolidayForGroup"), 1, ($user->hasRight('holiday', 'writeall') && $user->hasRight('holiday', 'readall')), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->hasRight('holiday', 'write'), '', $mainmenu); + $newmenu->add("/holiday/card_group.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("NewHolidayForGroup"), 1, ($user->hasRight('holiday', 'writeall') && $user->hasRight('holiday', 'readall')), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu); if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm", $langs->trans("MenuConfCP"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->hasRight('holiday', 'readall'), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuLogCP"), 1, $user->hasRight('holiday', 'define_holiday'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm", $langs->trans("MenuConfCP"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->hasRight('holiday', 'readall'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuLogCP"), 1, $user->hasRight('holiday', 'define_holiday'), '', $mainmenu, 'holiday_sm'); } // Trips and expenses (old module) if (isModEnabled('deplacement')) { $langs->load("trips"); - $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('deplacement', 'lire'), '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('deplacement', 'creer')); - $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('deplacement', 'lire')); - $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('deplacement', 'lire')); + $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('deplacement', 'lire'), '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('deplacement', 'creer')); + $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('deplacement', 'lire')); + $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('deplacement', 'lire')); } // Expense report if (isModEnabled('expensereport')) { $langs->loadLangs(array("trips", "bills")); - $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('expensereport', 'lire'), '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('expensereport', 'creer')); - $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('expensereport', 'lire'), '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('expensereport', 'creer')); + $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('expensereport', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { - $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->hasRight('expensereport', 'lire')); - $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->hasRight('expensereport', 'lire')); - $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->hasRight('expensereport', 'lire')); - $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->hasRight('expensereport', 'lire')); - $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->hasRight('expensereport', 'lire')); - $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->hasRight('expensereport', 'lire')); } - $newmenu->add("/expensereport/payment/list.php?leftmenu=expensereport_payments&mainmenu=hrm", $langs->trans("Payments"), 1, ($user->hasRight('expensereport', 'lire')) && isModEnabled('banque')); - $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/payment/list.php?leftmenu=expensereport_payments&mainmenu=hrm", $langs->trans("Payments"), 1, ($user->hasRight('expensereport', 'lire')) && isModEnabled('banque')); + $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('expensereport', 'lire')); } if (isModEnabled('projet')) { @@ -2387,7 +2398,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $search_project_user = GETPOST('search_project_user', 'int'); - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("TimeEntry"), 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("TimeEntry"), 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); } } } @@ -2415,22 +2426,22 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu } if (isModEnabled('mailing')) { - $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->hasRight('mailing', 'creer')); - $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->hasRight('mailing', 'lire')); + $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->hasRight('mailing', 'creer')); + $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->hasRight('mailing', 'lire')); } if (isModEnabled('export')) { $langs->load("exports"); - $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->hasRight('export', 'lire'), '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->hasRight('export', 'creer')); + $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->hasRight('export', 'lire'), '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->hasRight('export', 'creer')); //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->hasRight('export', 'lire')); } if (isModEnabled('import')) { $langs->load("exports"); - $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->hasRight('import', 'run'), '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->hasRight('import', 'run')); + $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->hasRight('import', 'run'), '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->hasRight('import', 'run')); } } } @@ -2468,7 +2479,7 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->hasRight('adherent', 'export')); if (getDolGlobalString('MEMBER_LINK_TO_HTPASSWDFILE') && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { - $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->hasRight('adherent', 'export')); + $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->hasRight('adherent', 'export')); } if (isModEnabled('categorie')) { diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 5d2f5a2659d..bba4ff62515 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -304,8 +304,7 @@ class MenuManager //print ' data-ajax="false"'; print '>'; $lastlevel2[$val2['level']] = 'enabled'; - } else // Not allowed but visible (greyed) - { + } else { // Not allowed but visible (greyed) print ''; $lastlevel2[$val2['level']] = 'greyed'; } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index a3cd71ade2f..6896aac7e6b 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -127,7 +127,7 @@ class MenuManager print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']); } if (empty($noout)) { - print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $this->atarget)); + print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ? DOL_URL_ROOT : '').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $this->atarget)); } if (empty($noout)) { print_end_menu_entry_empty($menuval['enabled']); diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 1cb766a17d7..bb9c33d83ae 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -167,7 +167,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha')); ?> -trans("Size"); ?> +trans("Size"); ?> @@ -199,16 +199,16 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha')); textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?> - + -trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> +trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> -trans("Unique"); ?>> +trans("Unique"); ?>> -trans("Mandatory"); ?>> +trans("Mandatory"); ?>> -textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>> +textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>> textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression")); ?> @@ -216,7 +216,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha')); textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?> -trans("Totalizable"); ?>> +trans("Totalizable"); ?>> textwithpicto($langs->trans("CssOnEdit"), $langs->trans("HelpCssOnEditDesc")); ?> @@ -227,7 +227,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha')); textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?> - trans("AllEntities"); ?>> + trans("AllEntities"); ?>> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index a192f266224..bb8c4fb9c3a 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -142,7 +142,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con - + @@ -273,24 +273,24 @@ if (in_array($type, array_keys($typewecanchangeinto))) { trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> -trans("Unique"); ?>> +trans("Unique"); ?>> -trans("Mandatory"); ?>> +trans("Mandatory"); ?>> -textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>> +textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>> textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression")); ?> - + textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?> -textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?>> +textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?>> textwithpicto($langs->trans("CssOnEdit"), $langs->trans("HelpCssOnEditDesc")); ?> @@ -306,7 +306,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) { - trans("AllEntities"); ?>> + trans("AllEntities"); ?>> diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 29f0934b8a2..7c1f4a94a15 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -43,7 +43,7 @@ if ($action == 'delete') { '.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '': $textobject).'
'."\n"; +$title = ''.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '' : $textobject).'
'."\n"; //if ($action != 'create' && $action != 'edit') { $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', (($action != 'create' && $action != 'edit') ? 1 : 1)); diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 7364020af73..d907eeddd81 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -38,7 +38,7 @@ if (empty($object) || !is_object($object)) { $id = $object->id; $fk_element = empty($object->fk_element) ? $fk_element : $object->fk_element; $table_element_line = (empty($table_element_line) ? $object->table_element_line : $table_element_line); -$nboflines = (isset($object->lines) ?count($object->lines) : (isset($tasksarray) ?count($tasksarray) : (empty($nboflines) ? 0 : $nboflines))); +$nboflines = (isset($object->lines) ? count($object->lines) : (isset($tasksarray) ? count($tasksarray) : (empty($nboflines) ? 0 : $nboflines))); $forcereloadpage = !getDolGlobalString('MAIN_FORCE_RELOAD_PAGE') ? 0 : 1; $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); $filepath = (empty($filepath) ? '' : $filepath); diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 3d35585c528..79c143849a6 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -42,7 +42,9 @@ if ($action == 'presend') { $titreform = 'SendMail'; $object->fetch_projet(); - if (!isset($file)) $file = null; + if (!isset($file)) { + $file = null; + } $ref = dol_sanitizeFileName($object->ref); if (!in_array($object->element, array('user', 'member'))) { //$fileparams['fullname'] can be filled from the card @@ -59,7 +61,7 @@ if ($action == 'presend') { } } - $file = isset($fileparams['fullname'])?$fileparams['fullname']:null; + $file = isset($fileparams['fullname']) ? $fileparams['fullname'] : null; } // Define output language @@ -113,7 +115,7 @@ if ($action == 'presend') { $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); } - $file = isset($fileparams['fullname'])?$fileparams['fullname']:null; + $file = isset($fileparams['fullname']) ? $fileparams['fullname'] : null; } } @@ -129,7 +131,7 @@ if ($action == 'presend') { $formmail = new FormMail($db); $formmail->param['langsmodels'] = (empty($newlang) ? $langs->defaultlang : $newlang); - $formmail->fromtype = (GETPOST('fromtype') ?GETPOST('fromtype') : (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE') ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); if ($formmail->fromtype === 'user') { $formmail->fromid = $user->id; @@ -159,7 +161,7 @@ if ($action == 'presend') { $formmail->fromname = (getDolGlobalString('ORDER_SUPPLIER_EMAIL_SENDER_NAME') ? $conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME : ''); $formmail->fromtype = 'special'; } - if ($object->element === 'recruitmentcandidature' ) { + if ($object->element === 'recruitmentcandidature') { $formmail->frommail = (getDolGlobalString('RECRUITMENT_EMAIL_SENDER') ? $conf->global->RECRUITMENT_EMAIL_SENDER : $recruitermail); $formmail->fromname = (getDolGlobalString('RECRUITMENT_EMAIL_SENDER_NAME') ? $conf->global->RECRUITMENT_EMAIL_SENDER_NAME : (!empty($recruitername) ? $recruitername : '')); $formmail->fromtype = 'special'; @@ -272,7 +274,7 @@ if ($action == 'presend') { $substitutionarray['__CHECK_READ__'] = ""; if (is_object($object) && is_object($object->thirdparty)) { $checkRead= 'thirdparty->tag) ? urlencode($object->thirdparty->tag) : ""); $checkRead.='&securitykey='.(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') ? urlencode(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')) : ""); $checkRead.='" width="1" height="1" style="width:1px;height:1px" border="0"/>'; $substitutionarray['__CHECK_READ__'] = $checkRead; diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 1643ea77e98..65459e121f6 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -69,7 +69,7 @@ foreach ($object->fields as $key => $val) { } if (in_array($val['type'], array('int', 'integer'))) { - $value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key; + $value = GETPOSTISSET($key) ? GETPOST($key, 'int') : $object->$key; } elseif ($val['type'] == 'double') { $value = GETPOSTISSET($key) ? price2num(GETPOST($key, 'alphanohtml')) : $object->$key; } elseif (preg_match('/^text/', $val['type'])) { diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 2c5236a18a1..957da647102 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -89,9 +89,7 @@ if ($permission) { print '
'."\n"; print '
'."\n"; - print '
'."\n"; - - ?> + print '
'."\n"; ?>
trans("ThirdParty"); ?>
trans("Users"), 'user', 'class="optiongrey paddingright"').$langs->trans("Users").' | '.img_picto($langs->trans("Contacts"), 'contact', 'class="optiongrey paddingright"').$langs->trans("Contacts"); ?>
@@ -122,8 +120,7 @@ if ($permission) { if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { $tmpobject = $objectsrc; } - $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); - ?>
+ $formcompany->selectTypeContact($tmpobject, '', 'type', 'internal', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); ?>
 
">
@@ -146,9 +143,8 @@ if ($permission) {
socid) ? 0 : $object->socid); - $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); // This also print the select component - ?> + $selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany", 'int') : (empty($object->socid) ? 0 : $object->socid); + $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); // This also print the select component?>
socid) && $object->socid > 1 && $user->hasRight('societe', 'creer')) { $newcardbutton .= ''; } - print $newcardbutton; - ?> + print $newcardbutton; ?>
element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { $tmpobject = $objectsrc; } - $formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'typecontact', 'external', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); - ?> + $formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'typecontact', 'external', 'position', 0, 'minwidth125imp widthcentpercentminusx maxwidth400'); ?>
 
diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index f691c55bd0c..46ad5391035 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,4 +1,5 @@ attributes[$extrafield print ''; print $valuetoshow; print ''; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index e697e5a5d0c..d4ca2e6ac21 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -161,7 +161,7 @@ if ((!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_ECM_DISABLE '."\n"; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -206,8 +206,12 @@ if ($action == 'confirmconvertimgwebp') { $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); } $param = ''; - if (!empty($sortfield)) $param .= '&sortfield='.urlencode($sortfield); - if (!empty($sortorder)) $param .= '&sortorder='.urlencode($sortorder); + if (!empty($sortfield)) { + $param .= '&sortfield='.urlencode($sortfield); + } + if (!empty($sortorder)) { + $param .= '&sortorder='.urlencode($sortorder); + } print $form->formconfirm($_SERVER["PHP_SELF"].($param ? '?'.$param : ''), empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp', basename($file)), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } diff --git a/htdocs/core/tpl/list_print_subtotal.tpl.php b/htdocs/core/tpl/list_print_subtotal.tpl.php index 099cbe850b3..f5ba4eee3f2 100644 --- a/htdocs/core/tpl/list_print_subtotal.tpl.php +++ b/htdocs/core/tpl/list_print_subtotal.tpl.php @@ -1,4 +1,5 @@ $valtotalizable) { @@ -14,22 +15,22 @@ if (isset($totalarray['pos'])) { $j++; if (!empty($totalarray['pos'][$j])) { switch ($totalarray['pos'][$j]) { - case 'duration'; + case 'duration': print ''; - print (!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? convertSecondToTime($subtotalarray['val'][$totalarray['pos'][$j]], 'allhourmin') : 0); + print(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? convertSecondToTime($subtotalarray['val'][$totalarray['pos'][$j]], 'allhourmin') : 0); print ''; break; - case 'string'; + case 'string': print ''; - print (!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : ''); + print(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : ''); print ''; break; - case 'stock'; + case 'stock': print ''; print price2num(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : 0, 'MS'); print ''; break; - default; + default: print ''; print price(!empty($subtotalarray['val'][$totalarray['pos'][$j]]) ? $subtotalarray['val'][$totalarray['pos'][$j]] : 0); print ''; diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 71645cc0ac3..ab583ebd4ec 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -1,4 +1,5 @@ $valtotalizable) { @@ -14,22 +15,22 @@ if (isset($totalarray['pos'])) { $i++; if (!empty($totalarray['pos'][$i])) { switch ($totalarray['pos'][$i]) { - case 'duration'; + case 'duration': print ''; - print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); + print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); print ''; break; - case 'string'; + case 'string': print ''; - print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); + print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); print ''; break; - case 'stock'; + case 'stock': print ''; print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS'); print ''; break; - default; + default: print ''; print price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0); print ''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 838fe0fc1c0..819afa9e43a 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -114,8 +114,7 @@ $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize print "\n"; if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) { - // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random' - ?> + // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'?> browser->layout) && $conf->browser->layout == 'phone') ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);'; - // old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));'; - $backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle); - print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : ''; + $backstyle = 'background: linear-gradient('.((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);'; + // old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));'; + $backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle); + print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : ''; } ?>>