diff --git a/.travis.yml b/.travis.yml index af37fe08a8d..dfeb209bfc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,6 +50,9 @@ jobs: - if: type = push AND branch = develop php: nightly env: DB=mysql + - if: type = push AND branch = 13.0 + php: nightly + env: DB=mysql notifications: email: @@ -400,7 +403,7 @@ script: php step5.php 12.0.0 13.0.0 > $TRAVIS_BUILD_DIR/upgrade12001300-3.log # Enable modules not enabled into original dump - php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log + php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT > $TRAVIS_BUILD_DIR/enablemodule.log echo $? cd - diff --git a/COPYRIGHT b/COPYRIGHT index 10b06b86811..4f4bc3dff6d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -29,7 +29,7 @@ PHPoAuthLib 0.8.2 MIT License Yes PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PSR/Logs 1.0 Library for logs (used by DebugBar) PSR/simple-cache ? Library for cache (used by PHPSpreadSheet) -Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) +Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer) Sabre 3.2.2 BSD Yes DAV support Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP Stripe 6.43.1 MIT licence Yes Library for Stripe module diff --git a/SECURITY.md b/SECURITY.md index bcc1bd7d9e0..6dc6e0f33b5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -60,18 +60,19 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). * The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly. -* CSRF attacks are accepted for all when using a POST URL, but when using GET URL, they are validated only for creating or updating data resctricted to the admin user. +* CSRF attacks are accepted when using a POST URL, but when using GET URL, they are validated only for creating, updating or deleting data resctricted from pages restricted to admin users. * Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user. Scope is the web application (back office) and the APIs. ## Qualifying vulnerabilities for Bug bounty programs + * Remote code execution (RCE) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Code injections (HTML, JS, SQL, PHP, ...) * Cross-Site Scripting (XSS) -* Cross-Site Requests Forgery (CSRF) with real security impact +* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users) * Open redirect * Broken authentication & session management * Insecure direct object references @@ -83,6 +84,7 @@ Scope is the web application (back office) and the APIs. ## Non-qualifying vulnerabilities for Bug bounty programs, but qualified for reporting + * "Self" XSS * SSL/TLS best practices * Denial of Service attacks diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index f3c86419f8e..4541868a04f 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -292,6 +292,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public +%_datadir/dolibarr/htdocs/recruitment %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/salaries diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 3c2b8adeb5b..d618b5729d5 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -209,6 +209,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public +%_datadir/dolibarr/htdocs/recruitment %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/salaries diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 71db3f43445..230a8946e99 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -220,6 +220,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public +%_datadir/dolibarr/htdocs/recruitment %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/salaries diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 98a6d2176aa..5648381ff49 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -229,11 +229,21 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor public static function getShortName($className) { // @CHANGE LDR - if (! is_string($className)) return; + if (!is_string($className)) return; //var_dump($className); - - +* Add line into Data/Text.php to complete function + + public static function endsWith($haystack, $needle) + { + $length = strlen($needle); + if ($length == 0) { + return true; + } + // @CHANGE LDR + if (!is_string($haystack)) return false; + + PARSEDOWN --------- diff --git a/dev/tools/test/namespacemig/aaa.class.php b/dev/tools/test/namespacemig/aaa.class.php index d7578b78e40..84d936479f2 100644 --- a/dev/tools/test/namespacemig/aaa.class.php +++ b/dev/tools/test/namespacemig/aaa.class.php @@ -15,6 +15,9 @@ function faaa() return 'faaa'; } +/** + * Class Aaa + */ class Aaa { const AAA='aaa'; diff --git a/dev/tools/test/namespacemig/bbb.class.php b/dev/tools/test/namespacemig/bbb.class.php index f68b3b2f36c..ea3c1b18d61 100644 --- a/dev/tools/test/namespacemig/bbb.class.php +++ b/dev/tools/test/namespacemig/bbb.class.php @@ -12,6 +12,9 @@ function fbbb() return 'fbbb'; } +/** + * Class Bbb + */ class Bbb { const BBB='bbb'; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index c9aaa856d22..9c9df8e25b5 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -146,12 +146,7 @@ $arrayfields = array( 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; /* diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index adfaaf4f816..5b037e70a73 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -135,12 +135,13 @@ if ($action == 'deletefilter') { $emailcollectorfilter = new EmailCollectorFilter($db); $emailcollectorfilter->fetch(GETPOST('filterid', 'int')); - $result = $emailcollectorfilter->delete($user); - if ($result > 0) - { - $object->fetchFilters(); - } else { - setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); + if ($emailcollectorfilter->id > 0) { + $result = $emailcollectorfilter->delete($user); + if ($result > 0) { + $object->fetchFilters(); + } else { + setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); + } } } @@ -153,13 +154,25 @@ if (GETPOST('addoperation', 'alpha')) $emailcollectoroperation->status = 1; $emailcollectoroperation->position = 50; - $result = $emailcollectoroperation->create($user); + if ($emailcollectoroperation->type == '-1') { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Operation")), null, 'errors'); + } + if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty')) + && empty($emailcollectoroperation->actionparam)) { + $error++; + setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors'); + } - if ($result > 0) - { - $object->fetchActions(); - } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + if (!$error) { + $result = $emailcollectoroperation->create($user); + + if ($result > 0) { + $object->fetchActions(); + } else { + $error++; + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } } } @@ -170,25 +183,35 @@ if ($action == 'updateoperation') $emailcollectoroperation->actionparam = GETPOST('operationparam2', 'restricthtml'); - $result = $emailcollectoroperation->update($user); + if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty')) + && empty($emailcollectoroperation->actionparam)) { + $error++; + setEventMessages($langs->trans("ErrorAParameterIsRequiredForThisOperation"), null, 'errors'); + } - if ($result > 0) - { - $object->fetchActions(); - } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + if (!$error) { + $result = $emailcollectoroperation->update($user); + + if ($result > 0) + { + $object->fetchActions(); + } else { + $error++; + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } } } if ($action == 'deleteoperation') { $emailcollectoroperation = new EmailCollectorAction($db); $emailcollectoroperation->fetch(GETPOST('operationid', 'int')); - $result = $emailcollectoroperation->delete($user); - if ($result > 0) - { - $object->fetchActions(); - } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + if ($emailcollectoroperation->id > 0) { + $result = $emailcollectoroperation->delete($user); + if ($result > 0) { + $object->fetchActions(); + } else { + setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + } } } @@ -458,7 +481,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ''; print ''; - print ''; + print ''; print ''; // Add filter print ''; @@ -491,7 +514,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1), 'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1) ); - print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 0, '', 2); + print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 1, '', 2); print "\n"; print ''; print ''; } - - print ''; print ''; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 5c8031f2702..6c2e12ba500 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -93,7 +93,18 @@ class PaymentVarious extends CommonObject public $fk_project; /** - * @var int ID + * @var int Bank account ID + */ + public $fk_account; + + /** + * @var int Bank account ID + * @deprecated See fk_account + */ + public $accountid; + + /** + * @var int ID record into llx_bank */ public $fk_bank; @@ -102,11 +113,6 @@ class PaymentVarious extends CommonObject */ public $categorie_transaction; - /** - * @var int Account ID - */ - public $accountid; - /** * @var int ID */ @@ -397,6 +403,10 @@ class PaymentVarious extends CommonObject $this->fk_bank = (int) $this->fk_bank; $this->fk_user_author = (int) $this->fk_user_author; $this->fk_user_modif = (int) $this->fk_user_modif; + $this->fk_account = (int) $this->fk_account; + if (empty($this->fk_account) && isset($this->accountid)) { // For compatibility + $this->fk_account = $this->accountid; + } // Check parameters if (!$this->label) @@ -409,9 +419,9 @@ class PaymentVarious extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")); return -5; } - if (!empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0)) + if (!empty($conf->banque->enabled) && (empty($this->fk_account) || $this->fk_account <= 0)) { - $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Account")); + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount")); return -6; } if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) @@ -454,7 +464,7 @@ class PaymentVarious extends CommonObject $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 0); $sql .= ", ".$user->id; $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ", NULL"; + $sql .= ", NULL"; // Filled later $sql .= ", ".$conf->entity; $sql .= ")"; @@ -473,7 +483,7 @@ class PaymentVarious extends CommonObject require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $acc = new Account($this->db); - $result = $acc->fetch($this->accountid); + $result = $acc->fetch($this->fk_account); if ($result <= 0) dol_print_error($this->db); // Insert payment into llx_bank @@ -495,7 +505,7 @@ class PaymentVarious extends CommonObject $this->datev ); - // Update fk_bank into llx_paiement. + // Update fk_bank into llx_payment_various // So we know the payment which has generate the banking ecriture if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 87c8380ebda..f3efea15235 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -106,14 +106,8 @@ $arrayfields = array( 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1010), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index db539e060d2..dfdad0b589b 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -491,7 +491,7 @@ if ($id) ); $formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1); - $formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1)); + $formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300); } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 48da6483152..9c936c1d943 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -466,14 +466,18 @@ if ($result) // Project if ($arrayfields['project']['checked']) { - $proj->fetch($obj->fk_project); - print ''; + print ''; if (!$i) $totalarray['nbfield']++; } // Bank account if ($arrayfields['bank']['checked']) { - print '\n"; +$total_ht_outcome = $total_ttc_outcome = $total_ht_income = $total_ttc_income = 0; + if ($modecompta == 'BOOKKEEPING') { @@ -438,16 +440,97 @@ if ($modecompta == 'BOOKKEEPING') if ($total_ttc == 0) { print ''; - print ''; + print ''; print ''; } + $total_ht_income += $total_ht; + $total_ttc_income += $total_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; print ''; print ''; + /* + * Donations + */ + + if (!empty($conf->don->enabled)) + { + print ''; + + if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') + { + if ($modecompta == 'CREANCES-DETTES') + { + $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql .= " WHERE p.entity IN (".getEntity('donation').")"; + $sql .= " AND fk_statut in (1,2)"; + } else { + $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; + $sql .= " WHERE p.entity IN (".getEntity('donation').")"; + $sql .= " AND fk_statut >= 2"; + } + if (!empty($date_start) && !empty($date_end)) + $sql .= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; + } + $sql .= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql .= $db->order($newsortfield, $sortorder); + + dol_syslog("get dunning"); + $result = $db->query($sql); + $subtotal_ht = 0; + $subtotal_ttc = 0; + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht += $obj->amount; + $total_ttc += $obj->amount; + $subtotal_ht += $obj->amount; + $subtotal_ttc += $obj->amount; + + print ''; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; + print ''; + $i++; + } + } else { + print ''; + print ''; + print ''; + } + } else { + dol_print_error($db); + } + + $total_ht_income += $subtotal_ht; + $total_ttc_income += $subtotal_ttc; + print ''; + if ($modecompta == 'CREANCES-DETTES') + print ''; + print ''; + print ''; + } /* * Suppliers invoices @@ -515,7 +598,7 @@ if ($modecompta == 'BOOKKEEPING') } } else { print ''; - print ''; + print ''; print ''; } @@ -523,6 +606,9 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + + $total_ht_outcome += $subtotal_ht; + $total_ttc_outcome += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; @@ -530,7 +616,6 @@ if ($modecompta == 'BOOKKEEPING') print ''; - /* * Charges sociales non deductibles */ @@ -592,12 +677,15 @@ if ($modecompta == 'BOOKKEEPING') } } else { print ''; - print ''; + print ''; print ''; } } else { dol_print_error($db); } + + $total_ht_outcome += $subtotal_ht; + $total_ttc_outcome += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; @@ -667,36 +755,21 @@ if ($modecompta == 'BOOKKEEPING') } } else { print ''; - print ''; + print ''; print ''; } } else { dol_print_error($db); } + + $total_ht_outcome += $subtotal_ht; + $total_ttc_outcome += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; print ''; print ''; - if ($mysoc->tva_assuj == 'franchise') // Non assujetti - { - // Total - print ''; - print ''; - print ''; - - print ''; - if ($modecompta == 'CREANCES-DETTES') - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - } - /* * Salaries @@ -759,12 +832,15 @@ if ($modecompta == 'BOOKKEEPING') } } else { print ''; - print ''; + print ''; print ''; } } else { dol_print_error($db); } + + $total_ht_outcome += $subtotal_ht; + $total_ttc_outcome += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; @@ -841,98 +917,26 @@ if ($modecompta == 'BOOKKEEPING') } } else { print ''; - print ''; + print ''; print ''; } } else { dol_print_error($db); } + + $total_ht_outcome += $subtotal_ht; + $total_ttc_outcome += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; print ''; print ''; } - /* - * Donations - */ - - if (!empty($conf->don->enabled)) - { - print ''; - - if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') - { - if ($modecompta == 'CREANCES-DETTES') - { - $sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; - $sql .= " WHERE p.entity IN (".getEntity('donation').")"; - $sql .= " AND fk_statut in (1,2)"; - } else { - $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; - $sql .= " WHERE p.entity IN (".getEntity('donation').")"; - $sql .= " AND fk_statut >= 2"; - } - if (!empty($date_start) && !empty($date_end)) - $sql .= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; - } - $sql .= " GROUP BY p.societe, p.firstname, p.lastname, dm"; - $newsortfield = $sortfield; - if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm'; - if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; - if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; - $sql .= $db->order($newsortfield, $sortorder); - - dol_syslog("get dunning"); - $result = $db->query($sql); - $subtotal_ht = 0; - $subtotal_ttc = 0; - if ($result) - { - $num = $db->num_rows($result); - $i = 0; - if ($num) - { - while ($i < $num) - { - $obj = $db->fetch_object($result); - - $total_ht += $obj->amount; - $total_ttc += $obj->amount; - $subtotal_ht += $obj->amount; - $subtotal_ttc += $obj->amount; - - print ''; - - print "\n"; - - if ($modecompta == 'CREANCES-DETTES') print ''; - print ''; - print ''; - $i++; - } - } else { - print ''; - print ''; - print ''; - } - } else { - dol_print_error($db); - } - print ''; - if ($modecompta == 'CREANCES-DETTES') - print ''; - print ''; - print ''; - } /* * Various Payments */ + //$conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY = 1; if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->banque->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { @@ -953,12 +957,14 @@ if ($modecompta == 'BOOKKEEPING') $result = $db->query($sql); if ($result) { - // Debit + // Debit (payment of suppliers for example) $obj = $db->fetch_object($result); if (isset($obj->amount)) { $subtotal_ht += -$obj->amount; $subtotal_ttc += -$obj->amount; + $total_ht_outcome += $obj->amount; + $total_ttc_outcome += $obj->amount; } print ''; print "\n"; @@ -966,12 +972,14 @@ if ($modecompta == 'BOOKKEEPING') print '\n"; print "\n"; - // Credit + // Credit (payment received from customer for example) $obj = $db->fetch_object($result); if (isset($obj->amount)) { $subtotal_ht += $obj->amount; $subtotal_ttc += $obj->amount; + $total_ht_income += $obj->amount; + $total_ttc_income += $obj->amount; } print ''; print "\n"; @@ -1030,6 +1038,8 @@ if ($modecompta == 'BOOKKEEPING') } $total_ht += $subtotal_ht; $total_ttc += $subtotal_ttc; + $total_ht_income += $subtotal_ht; + $total_ttc_income += $subtotal_ttc; print ''; if ($modecompta == 'CREANCES-DETTES') print ''; @@ -1050,7 +1060,7 @@ if ($modecompta == 'BOOKKEEPING') { if ($modecompta == 'CREANCES-DETTES') { - // TVA a payer + // VAT to pay $amount = 0; $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -1091,13 +1101,15 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_outcome -= 0; + $total_ttc_outcome -= $amount; print ''; print "\n"; print ''."\n"; print '\n"; print "\n"; - // TVA a recuperer + // VAT to retreive $amount = 0; $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -1139,6 +1151,9 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_income += 0; + $total_ttc_income += $amount; + print ''; print '\n"; print ''."\n"; @@ -1182,10 +1197,12 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_outcome -= 0; + $total_ttc_outcome -= $amount; print ''; print "\n"; if ($modecompta == 'CREANCES-DETTES') - print '\n"; + print ''."\n"; print '\n"; print "\n"; @@ -1226,16 +1243,18 @@ if ($modecompta == 'BOOKKEEPING') } else { dol_print_error($db); } + $total_ht_income += 0; + $total_ttc_income += $amount; print ''; print "\n"; if ($modecompta == 'CREANCES-DETTES') - print '\n"; + print ''."\n"; print '\n"; print "\n"; } } - if ($mysoc->tva_assuj != 'franchise') // Assujetti + if ($mysoc->tva_assuj != '0') // Assujetti { print ''; if ($modecompta == 'CREANCES-DETTES') @@ -1250,25 +1269,31 @@ $object = array(&$total_ht, &$total_ttc); $parameters["mode"] = $modecompta; $parameters["date_start"] = $date_start; $parameters["date_end"] = $date_end; -$parameters["bc"] = $bc; // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); $reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; -if ($mysoc->tva_assuj != 'franchise') // Assujetti -{ - // Total - print ''; - print ''; - print ''; +// Total +print ''; +print ''; +print ''; - print ''; - if ($modecompta == 'CREANCES-DETTES') - print ''; - print ''; - print ''; -} +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''; +print ''; +print ''; +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''; +print ''; +print ''; +print ''; +if ($modecompta == 'CREANCES-DETTES') + print ''; +print ''; +print ''; print "
'.$langs->trans("Filters").''.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'
'; - print ''; - print ' '; - print ''; print ' '; print ''.$proj->getNomUrl(1).''; + if ($obj->fk_project > 0) { + $proj->fetch($obj->fk_project); + print $proj->getNomUrl(1); + } + print ''; + print ''; if ($obj->bid > 0) { $accountstatic->id = $obj->bid; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index fdc3e57bdba..c6431143a98 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -120,14 +120,8 @@ foreach ($object->fields as $key => $val) if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); } // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ec55810e2da..ac1270ed550 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3136,8 +3136,8 @@ class Facture extends CommonInvoice $this->line->tva_tx = $txtva; $this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0); $this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0); - $this->line->localtax1_type = isset($localtaxes_type[0]) ? $localtaxes_type[0] : ''; - $this->line->localtax2_type = isset($localtaxes_type[2]) ? $localtaxes_type[2] : ''; + $this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative $this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative @@ -3375,8 +3375,8 @@ class Facture extends CommonInvoice $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index c0abc5a6028..6beb5caa1e2 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -135,14 +135,8 @@ $arrayfields = array( 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 7e852846d5c..d50813cbea4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -213,7 +213,7 @@ if ($object->id > 0) $head = facture_prepare_head($object); } - print dol_get_fiche_head($head, 'standingorders', $title, -1, 'bill'); + print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill')); // Invoice content if ($type == 'bank-transfer') { diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 8a1655cdefb..3072dcdee2b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -229,6 +229,8 @@ if ($modecompta == 'BOOKKEEPING') print "
 '.$langs->trans("None").''.$langs->trans("None").'
'.price($total_ht).''.price($total_ttc).'
'.$langs->trans("Donations").'
 ".$langs->trans("Donation")." name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."'.price($obj->amount).''.price($obj->amount).'
 '.$langs->trans("None").'
'.price($subtotal_ht).''.price($subtotal_ttc).'
 '.$langs->trans("None").''.$langs->trans("None").'
'.price(-$subtotal_ht).'
 '.$langs->trans("None").''.$langs->trans("None").'
'.price(-$subtotal_ht).'
 '.$langs->trans("None").''.$langs->trans("None").'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
 
'.$langs->trans("Profit").''.price($total_ht).''.price($total_ttc).'
 
 '.$langs->trans("None").''.$langs->trans("None").'
'.price(-$subtotal_ht).'
 '.$langs->trans("None").''.$langs->trans("None").'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
'.$langs->trans("Donations").'
 ".$langs->trans("Donation")." name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."'.price($obj->amount).''.price($obj->amount).'
 '.$langs->trans("None").'
'.price($subtotal_ht).''.price($subtotal_ttc).'
 ".$langs->trans("Debit")."'.price(-$obj->amount)."
 ".$langs->trans("Credit")."
'.price($subtotal_ht).'
 ".$langs->trans("VATToPay")." '.price($amount)."
 '.$langs->trans("VATToCollect")." 
 ".$langs->trans("VATPaid")."'.price($amount)."'.price($amount)."
 ".$langs->trans("VATCollected")."'.price($amount)."'.price($amount)."
 
 
'.$langs->trans("Profit").''.price(price2num($total_ht, 'MT')).''.price(price2num($total_ttc, 'MT')).'
'.$langs->trans("Outcome").''.price(price2num(-$total_ht_outcome, 'MT')).''.price(price2num(-$total_ttc_outcome, 'MT')).'
'.$langs->trans("Income").''.price(price2num($total_ht_income, 'MT')).''.price(price2num($total_ttc_income, 'MT')).'
'.$langs->trans("Profit").''.price(price2num($total_ht, 'MT')).''.price(price2num($total_ttc, 'MT')).'
"; print '
'; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ca8ccb9bd7d..72a8ec2974d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -131,14 +131,8 @@ $arrayfields = array( 'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -620,14 +614,14 @@ while ($i < min($num, $limit)) $socstatic->logo = $obj->logo; $socstatic->country_id = $obj->country_id; $socstatic->country_code = ''; - $socstatic->country_label = '';*/ + $socstatic->country = '';*/ if ($obj->country_id > 0) { if (!isset($cacheCountryIDCode[$obj->country_id]['code'])) { $tmparray = getCountry($obj->country_id, 'all'); $cacheCountryIDCode[$obj->country_id] = array('code'=> empty($tmparray['code']) ? '' : $tmparray['code'], 'label' => empty($tmparray['label']) ? '' : $tmparray['label']); } $socstatic->country_code = $cacheCountryIDCode[$obj->country_id]['code']; - $socstatic->country_label = $cacheCountryIDCode[$obj->country_id]['label']; + $socstatic->country = $cacheCountryIDCode[$obj->country_id]['label']; } @@ -701,7 +695,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; - print $socstatic->country_label; + print $socstatic->country; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 67b605d657f..4de651a24f9 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -130,14 +130,8 @@ $arrayfields = array( 'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index 6ffce6d781b..5b6130d8eb2 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -61,9 +61,9 @@ class box_funnel_of_prospection extends ModeleBoxes $this->db = $db; - $this->enabled = ($conf->global->MAIN_FEATURES_LEVEL >= 1); // Not enabled by default, still need some work + $this->enabled = ($conf->global->MAIN_FEATURES_LEVEL >= 1 ? 1 : 0); // Not enabled by default, still need some work - $this->hidden = !($user->rights->projet->lire); + $this->hidden = empty($user->rights->projet->lire); } /** diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php index 01dd86a999d..2ac81c80d16 100644 --- a/htdocs/core/boxes/box_scheduled_jobs.php +++ b/htdocs/core/boxes/box_scheduled_jobs.php @@ -165,7 +165,7 @@ class box_scheduled_jobs extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="center"', - 'textnoformat' => ($nbjobsinerror ? ''.$nbjobsinerror.img_error() : '
0
') + 'textnoformat' => ($nbjobsinerror ? '
'.$nbjobsinerror.'
' : '
0
') ); } else { $this->info_box_contents[0][0] = array( diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 1e32a28f25c..9faf45932e2 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -56,7 +56,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box /** * @var boolean Condition to have widget visible (in most cases, permissions) */ - public $hidden = 0; + public $hidden = false; /** * @var int Box definition database ID diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bfdea016ea6..47c025b0c0a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -355,7 +355,7 @@ abstract class CommonObject public $last_main_doc; /** - * @var int Bank account ID + * @var int Bank account ID sometimes, ID of record into llx_bank sometimes * @deprecated * @see $fk_account */ diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 09f2b0a44ae..a1800e03980 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -52,9 +52,11 @@ class Conf public $disable_compute; //! Used to store current currency (ISO code like 'USD', 'EUR', ...) public $currency; + //! Used to store current css (from theme) public $theme; // Contains current theme ("eldy", "auguria", ...) public $css; // Contains full path of css page ("/theme/eldy/style.css.php", ...) + //! Used to store current menu handler public $standard_menu; // List of activated modules @@ -98,6 +100,8 @@ class Conf public $dol_no_mouse_hover; // Set if we force param dol_no_mouse_hover into login url or if browser is smartphone public $dol_use_jmobile; // Set if we force param dol_use_jmobile into login url + public $liste_limit; + /** * Constructor diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4495c5ae50d..5fcc7b00c91 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -891,7 +891,6 @@ class DolGraph $color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]); $color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]); $this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }' . "\n"; - //$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this $this->stringtoshow .= '});' . "\n"; $this->stringtoshow .= '}' . "\n"; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d041aba45f4..2daf4c835e9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -991,32 +991,23 @@ class ExtraFields else return ''; } - if (empty($morecss)) - { - if ($type == 'date') - { + if (empty($morecss)) { + if ($type == 'date') { $morecss = 'minwidth100imp'; - } elseif ($type == 'datetime' || $type == 'link') - { + } elseif ($type == 'datetime' || $type == 'link') { $morecss = 'minwidth200imp'; - } elseif (in_array($type, array('int', 'integer', 'double', 'price'))) - { + } elseif (in_array($type, array('int', 'integer', 'double', 'price'))) { $morecss = 'maxwidth75'; - } elseif ($type == 'password') - { + } elseif ($type == 'password') { $morecss = 'maxwidth100'; - } elseif ($type == 'url') - { + } elseif ($type == 'url') { $morecss = 'minwidth400'; - } elseif ($type == 'boolean') - { + } elseif ($type == 'boolean') { $morecss = ''; } else { - if (round($size) < 12) - { + if (empty($size) || round($size) < 12) { $morecss = 'minwidth100'; - } elseif (round($size) <= 48) - { + } elseif (round($size) <= 48) { $morecss = 'minwidth200'; } else { $morecss = 'minwidth400'; @@ -1024,8 +1015,7 @@ class ExtraFields } } - if (in_array($type, array('date', 'datetime'))) - { + if (in_array($type, array('date', 'datetime'))) { $tmp = explode(',', $size); $newsize = $tmp[0]; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 14bbf007542..492a4899376 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3939,13 +3939,16 @@ class Form * @param string $moreattrib To add more attribute on select * @param int $showcurrency Show currency in label * @param string $morecss More CSS + * @param int $nooutput 1=Return string, do not send to output * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ - public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '') + public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '', $nooutput = 0) { // phpcs:enable global $langs, $conf; + $out = ''; + $langs->load("admin"); $num = 0; @@ -3964,10 +3967,10 @@ class Form $i = 0; if ($num) { - print ''; if ($useempty == 1 || ($useempty == 2 && $num > 1)) { - print ''; + $out .= ''; } while ($i < $num) @@ -3975,26 +3978,30 @@ class Form $obj = $this->db->fetch_object($result); if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { - print ''; + $out .= trim($obj->label); + if ($showcurrency) $out .= ' ('.$obj->currency_code.')'; + if ($status == 2 && $obj->status == 1) $out .= ' ('.$langs->trans("Closed").')'; + $out .= ''; $i++; } - print ""; - print ajax_combobox('select'.$htmlname); + $out .= ""; + $out .= ajax_combobox('select'.$htmlname); } else { - if ($status == 0) print ''.$langs->trans("NoActiveBankAccountDefined").''; - else print ''.$langs->trans("NoBankAccountFound").''; + if ($status == 0) $out .= ''.$langs->trans("NoActiveBankAccountDefined").''; + else $out .= ''.$langs->trans("NoBankAccountFound").''; } } else { dol_print_error($this->db); } + // Output or return + if (empty($nooutput)) print $out; + else return $out; + return $num; } diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 7cc51bfecb9..f9f1c3b99ef 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -112,26 +112,40 @@ class Notify $listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0); + $texte = ''; $nb = -1; - if (is_array($listofnotiftodo)) $nb = count($listofnotiftodo); - if ($nb < 0) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend"); - if ($nb == 0) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent"); - if ($nb == 1) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent"); - if ($nb >= 2) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb); + if (is_array($listofnotiftodo)) { + $nb = count($listofnotiftodo); + } + if ($nb < 0) { + $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend"); + } elseif ($nb == 0) { + $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent"); + } elseif ($nb == 1) { + $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent"); + } elseif ($nb >= 2) { + $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb); + } - if (is_array($listofnotiftodo)) - { + if (is_array($listofnotiftodo)) { $i = 0; - foreach ($listofnotiftodo as $key => $val) - { - if ($i) $texte .= ', '; - else $texte .= ' ('; - if ($val['isemailvalid']) $texte .= $val['email']; - else $texte .= $val['emaildesc']; + foreach ($listofnotiftodo as $key => $val) { + if ($i) { + $texte .= ', '; + } else { + $texte .= ' ('; + } + if ($val['isemailvalid']) { + $texte .= $val['email']; + } else { + $texte .= $val['emaildesc']; + } $i++; } - if ($i) $texte .= ')'; - } + if ($i) { + $texte .= ')'; + } + } return $texte; } @@ -154,12 +168,21 @@ class Notify $resarray = array(); $valueforthreshold = 0; - if (is_object($object)) $valueforthreshold = $object->total_ht; + if (is_object($object)) { + $valueforthreshold = $object->total_ht; + } - if (!$error) - { - if ($socid >= 0 && in_array('thirdparty', $scope)) - { + $sqlnotifcode = ''; + if ($notifcode) { + if (is_numeric($notifcode)) { + $sqlnotifcode = " AND n.fk_action = ".$notifcode; // Old usage + } else { + $sqlnotifcode = " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage + } + } + + if (!$error) { + if ($socid >= 0 && in_array('thirdparty', $scope)) { $sql = "SELECT a.code, c.email, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,"; $sql .= " ".MAIN_DB_PREFIX."socpeople as c,"; @@ -168,29 +191,26 @@ class Notify $sql .= " WHERE n.fk_contact = c.rowid"; $sql .= " AND a.rowid = n.fk_action"; $sql .= " AND n.fk_soc = s.rowid"; - if ($notifcode) - { - if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage - else $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage - } + $sql .= $sqlnotifcode; $sql .= " AND s.entity IN (".getEntity('societe').")"; - if ($socid > 0) $sql .= " AND s.rowid = ".$socid; + if ($socid > 0) { + $sql .= " AND s.rowid = ".$socid; + } dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { + if ($resql) { $num = $this->db->num_rows($resql); $i = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $this->db->fetch_object($resql); - if ($obj) - { + if ($obj) { $newval2 = trim($obj->email); $isvalid = isValidEmail($newval2); - if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid); + if (empty($resarray[$newval2])) { + $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid); + } } $i++; } @@ -201,39 +221,34 @@ class Notify } } - if (!$error) - { - if ($userid >= 0 && in_array('user', $scope)) - { + if (!$error) { + if ($userid >= 0 && in_array('user', $scope)) { $sql = "SELECT a.code, c.email, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,"; $sql .= " ".MAIN_DB_PREFIX."user as c,"; $sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a"; $sql .= " WHERE n.fk_user = c.rowid"; $sql .= " AND a.rowid = n.fk_action"; - if ($notifcode) - { - if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage - else $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage - } + $sql .= $sqlnotifcode; $sql .= " AND c.entity IN (".getEntity('user').")"; - if ($userid > 0) $sql .= " AND c.rowid = ".$userid; + if ($userid > 0) { + $sql .= " AND c.rowid = ".$userid; + } dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) - { + if ($resql) { $num = $this->db->num_rows($resql); $i = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $this->db->fetch_object($resql); - if ($obj) - { + if ($obj) { $newval2 = trim($obj->email); $isvalid = isValidEmail($newval2); - if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid); + if (empty($resarray[$newval2])) { + $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid); + } } $i++; } @@ -244,48 +259,55 @@ class Notify } } - if (!$error) - { - if (in_array('global', $scope)) - { + if (!$error) { + if (in_array('global', $scope)) { // List of notifications enabled for fixed email - foreach ($conf->global as $key => $val) - { - if ($notifcode) - { - if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue; + foreach ($conf->global as $key => $val) { + if ($notifcode) { + if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) { + continue; + } } else { - if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue; + if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) { + continue; + } } $threshold = (float) $reg[1]; - if ($valueforthreshold < $threshold) continue; + if ($valueforthreshold < $threshold) { + continue; + } $tmpemail = explode(',', $val); - foreach ($tmpemail as $key2 => $val2) - { + foreach ($tmpemail as $key2 => $val2) { $newval2 = trim($val2); - if ($newval2 == '__SUPERVISOREMAIL__') - { - if ($user->fk_user > 0) - { + if ($newval2 == '__SUPERVISOREMAIL__') { + if ($user->fk_user > 0) { $tmpuser = new User($this->db); $tmpuser->fetch($user->fk_user); - if ($tmpuser->email) $newval2 = trim($tmpuser->email); - else $newval2 = ''; - } else $newval2 = ''; + if ($tmpuser->email) { + $newval2 = trim($tmpuser->email); + } else { + $newval2 = ''; + } + } else { + $newval2 = ''; + } } - if ($newval2) - { + if ($newval2) { $isvalid = isValidEmail($newval2, 0); - if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid); + if (empty($resarray[$newval2])) { + $resarray[$newval2] = array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid); + } } } } } } - if ($error) return -1; + if ($error) { + return -1; + } //var_dump($resarray); return $resarray; @@ -309,11 +331,12 @@ class Notify global $dolibarr_main_url_root; global $action; - if (!in_array($notifcode, $this->arrayofnotifsupported)) return 0; + if (!in_array($notifcode, $this->arrayofnotifsupported)) { + return 0; + } include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - if (!is_object($hookmanager)) - { + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($this->db); } @@ -330,7 +353,9 @@ class Notify // Define some vars $application = 'Dolibarr'; - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $application = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + $application = $conf->global->MAIN_APPLICATION_TITLE; + } $replyto = $conf->notification->email_from; $object_type = ''; $link = ''; @@ -343,8 +368,7 @@ class Notify $sql = ''; // Check notification per third party - if (!empty($object->socid) && $object->socid > 0) - { + if (!empty($object->socid) && $object->socid > 0) { $sql .= "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; $sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; @@ -354,8 +378,11 @@ class Notify $sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql .= " AND n.fk_soc = s.rowid"; $sql .= " AND c.statut = 1"; - if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage - else $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage + if (is_numeric($notifcode)) { + $sql .= " AND n.fk_action = ".$notifcode; // Old usage + } else { + $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage + } $sql .= " AND s.rowid = ".$object->socid; $sql .= "\nUNION\n"; @@ -369,41 +396,42 @@ class Notify $sql .= " ".MAIN_DB_PREFIX."notify_def as n"; $sql .= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action"; $sql .= " AND c.statut = 1"; - if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage - else $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage + if (is_numeric($notifcode)) { + $sql .= " AND n.fk_action = ".$notifcode; // Old usage + } else { + $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage + } $result = $this->db->query($sql); - if ($result) - { + if ($result) { $num = $this->db->num_rows($result); $projtitle = ''; - if (!empty($object->fk_project)) - { + if (!empty($object->fk_project)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $proj = new Project($this->db); $proj->fetch($object->fk_project); $projtitle = '('.$proj->title.')'; } - if ($num > 0) - { + if ($num > 0) { $i = 0; - while ($i < $num && !$error) // For each notification couple defined (third party/actioncode) - { + while ($i < $num && !$error) { // For each notification couple defined (third party/actioncode) $obj = $this->db->fetch_object($result); $sendto = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"; $notifcodedefid = $obj->adid; $trackid = ''; - if ($obj->type_target == 'tocontactid') $trackid = 'con'.$obj->id; - if ($obj->type_target == 'touserid') $trackid = 'use'.$obj->id; + if ($obj->type_target == 'tocontactid') { + $trackid = 'con'.$obj->id; + } + if ($obj->type_target == 'touserid') { + $trackid = 'use'.$obj->id; + } - if (dol_strlen($obj->email)) - { + if (dol_strlen($obj->email)) { // Set output language $outputlangs = $langs; - if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) - { + if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($obj->default_lang); $outputlangs->loadLangs(array("main", "other")); @@ -511,8 +539,7 @@ class Notify } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; - if (!dol_is_file($pdf_path)) - { + if (!dol_is_file($pdf_path)) { // We can't add PDF as it is not generated yet. $filepdf = ''; } else { @@ -525,13 +552,18 @@ class Notify $message .= $mesg; $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list); - if (!isset($action)) $action = ''; + if (!isset($action)) { + $action = ''; + } $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (!empty($hookmanager->resArray['subject'])) $subject .= $hookmanager->resArray['subject']; - if (!empty($hookmanager->resArray['message'])) $message .= $hookmanager->resArray['message']; + if (empty($reshook)) { + if (!empty($hookmanager->resArray['subject'])) { + $subject .= $hookmanager->resArray['subject']; + } + if (!empty($hookmanager->resArray['message'])) { + $message .= $hookmanager->resArray['message']; + } } $mailfile = new CMailFile( @@ -553,17 +585,15 @@ class Notify 'notification' ); - if ($mailfile->sendfile()) - { + if ($mailfile->sendfile()) { if ($obj->type_target == 'touserid') { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)"; $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')"; } else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)"; $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')"; } - if (!$this->db->query($sql)) - { + if (!$this->db->query($sql)) { dol_print_error($this->db); } } else { @@ -579,23 +609,22 @@ class Notify dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".(empty($object->socid) ? '' : $object->socid)); } } else { - $error++; + $error++; $this->errors[] = $this->db->lasterror(); dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR); - return -1; + return -1; } // Check notification using fixed email - if (!$error) - { - foreach ($conf->global as $key => $val) - { + if (!$error) { + foreach ($conf->global as $key => $val) { $reg = array(); - if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue; + if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) { + continue; + } $threshold = (float) $reg[1]; - if (!empty($object->total_ht) && $object->total_ht <= $threshold) - { + if (!empty($object->total_ht) && $object->total_ht <= $threshold) { dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification"); continue; } @@ -604,7 +633,9 @@ class Notify $sendto = $conf->global->$param; $notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid'); - if ($notifcodedefid <= 0) dol_print_error($this->db, 'Failed to get id from code'); + if ($notifcodedefid <= 0) { + dol_print_error($this->db, 'Failed to get id from code'); + } $trackid = ''; $object_type = ''; @@ -721,8 +752,7 @@ class Notify } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; - if (!dol_is_file($pdf_path)) - { + if (!dol_is_file($pdf_path)) { // We can't add PDF as it is not generated yet. $filepdf = ''; } else { @@ -736,14 +766,14 @@ class Notify $message = nl2br($message); // Replace keyword __SUPERVISOREMAIL__ - if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) - { + if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) { $newval = ''; - if ($user->fk_user > 0) - { + if ($user->fk_user > 0) { $supervisoruser = new User($this->db); $supervisoruser->fetch($user->fk_user); - if ($supervisoruser->email) $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>'); + if ($supervisoruser->email) { + $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>'); + } } dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval); $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto); @@ -752,14 +782,16 @@ class Notify $sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string } - if ($sendto) - { + if ($sendto) { $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list); $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (!empty($hookmanager->resArray['subject'])) $subject .= $hookmanager->resArray['subject']; - if (!empty($hookmanager->resArray['message'])) $message .= $hookmanager->resArray['message']; + if (empty($reshook)) { + if (!empty($hookmanager->resArray['subject'])) { + $subject .= $hookmanager->resArray['subject']; + } + if (!empty($hookmanager->resArray['message'])) { + $message .= $hookmanager->resArray['message']; + } } $mailfile = new CMailFile( $subject, @@ -780,12 +812,10 @@ class Notify 'notification' ); - if ($mailfile->sendfile()) - { + if ($mailfile->sendfile()) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)"; $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')"; - if (!$this->db->query($sql)) - { + if (!$this->db->query($sql)) { dol_print_error($this->db); } } else { @@ -796,7 +826,10 @@ class Notify } } - if (!$error) return $num; - else return -1 * $error; + if (!$error) { + return $num; + } else { + return -1 * $error; + } } } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 93eaeb6d4f2..07b67e30062 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -168,7 +168,7 @@ class Utils $this->output = $langs->trans("PurgeNDirectoriesDeleted", $countdeleted); if ($count > $countdeleted) $this->output .= '
'.$langs->trans("PurgeNDirectoriesFailed", ($count - $countdeleted)); } else { - $this->output = $langs->trans("PurgeNothingToDelete").($choice == 'tempfilesold' ? ' (older than 24h)' : ''); + $this->output = $langs->trans("PurgeNothingToDelete").(in_array('tempfilesold', $choicesarray) ? ' (older than 24h for temp files)' : ''); } // Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c43a7eb890c..6a590b44368 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2647,7 +2647,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->accounting->dir_output.'/'.$original_file; } // Wrapping pour les expedition - elseif ($modulepart == 'expedition' && !empty($conf->expedition->dir_output)) + elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) { @@ -2655,7 +2655,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->expedition->dir_output."/sending/".$original_file; } // Delivery Note Wrapping - elseif ($modulepart == 'delivery' && !empty($conf->expedition->dir_output)) + elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 713da28996e..884d8eac496 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2887,12 +2887,16 @@ function getUserRemoteIP() { if (empty($_SERVER['HTTP_X_FORWARDED_FOR']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_X_FORWARDED_FOR'])) { if (empty($_SERVER['HTTP_CLIENT_IP']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_CLIENT_IP'])) { - $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); + if (empty($_SERVER["HTTP_CF_CONNECTING_IP"])) { + $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been forged by client + } else { + $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client + } } else { - $ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here + $ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here but may have been forged by proxy } } else { - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; // value is clean here + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; // value is clean here but may have been forged by proxy } return $ip; } @@ -4457,7 +4461,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $savlimit = $limit; $savtotalnboflines = $totalnboflines; - $totalnboflines = abs($totalnboflines); + $totalnboflines = abs((int) $totalnboflines); if ($picto == 'setup') $picto = 'title_setup.png'; if (($conf->browser->name == 'ie') && $picto == 'generic') $picto = 'title.gif'; @@ -4873,7 +4877,7 @@ function price2num($amount, $rounding = '', $option = 0) elseif ($rounding == 'CR') $nbofdectoround = 8; elseif (is_numeric($rounding)) $nbofdectoround = $rounding; //print "RR".$amount.' - '.$nbofdectoround.'
'; - if (dol_strlen($nbofdectoround)) $amount = round($amount, $nbofdectoround); // $nbofdectoround can be 0. + if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. else return 'ErrorBadParameterProvidedToFunction'; //print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'
'; diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 4e3ce29f69e..98311d093cd 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -129,7 +129,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $localtax1_type = 0; $localtax2_type = 0; - if (is_array($localtaxes_array)) { + if (is_array($localtaxes_array) && count($localtaxes_array)) { $localtax1_type = $localtaxes_array[0]; $localtax1_rate = $localtaxes_array[1]; $localtax2_type = $localtaxes_array[2]; diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index c11e37b7aaa..f4662f43991 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -50,7 +50,7 @@ function salaries_prepare_head($object) $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 7dae96253bb..0f9d12c1a5d 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -332,7 +332,7 @@ class modCategorie extends DolibarrModules $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_civility as civ ON civ.rowid = p.civility'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_civility as civ ON civ.code = p.civility'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON c.rowid = p.fk_pays'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc'; $this->export_sql_end[$r] .= ' WHERE cat.entity IN ('.getEntity('category').')'; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index da18f2faf11..c15f041d21d 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -294,12 +294,15 @@ class modStock extends DolibarrModules include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM ('.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'product_batch as pb)'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product_batch as pb'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps ON ps.rowid = pb.fk_product_stock'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = ps.fk_product'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'entrepot as e'; - $this->export_sql_end[$r] .= ' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock'; - $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; } + $this->export_sql_end[$r] .= ' WHERE ps.fk_entrepot = e.rowid'; + $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; + } // Export of stock movements $r++; diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index 6e68dd94bea..d2d77cf3b5c 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -23,7 +23,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e 'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 'checked' => (($extrafields->attributes[$extrafieldsobjectkey]['list'][$key] < 0) ? 0 : 1), 'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key], - 'enabled' => (abs($extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]), + 'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && $extrafields->attributes[$extrafieldsobjectkey]['perms'][$key]), 'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key], 'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key], ); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 2c55b11f8d2..1a05017c1d3 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -56,7 +56,7 @@ class EmailCollector extends CommonObject /** * @var string String with name of icon for emailcollector. Must be the part after the 'object_' into object_emailcollector.png */ - public $picto = 'generic'; + public $picto = 'email'; /** * @var string Field with ID of parent key if this field has a parent @@ -1555,10 +1555,9 @@ class EmailCollector extends CommonObject // Search and create thirdparty if ($operation['type'] == 'loadthirdparty' || $operation['type'] == 'loadandcreatethirdparty') { - if (empty($operation['actionparam'])) - { + if (empty($operation['actionparam'])) { $errorforactions++; - $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; + $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be a rule like 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to set or extract data"; $this->errors[] = $this->error; } else { $actionparam = $operation['actionparam']; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 440fc4524a6..7afb464e4f4 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -140,14 +140,7 @@ $arrayfields = array( 'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $canedituser = (!empty($user->admin) || $user->rights->user->user->creer); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index bdf60e121e7..d054f5e5bcc 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -117,14 +117,8 @@ $arrayfields = array( 'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 557bc2a0456..6c6347f67f7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1714,8 +1714,8 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; - $localtax1_type = $localtaxes_type[0]; - $localtax2_type = $localtaxes_type[2]; + $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $rangmax = $this->line_max(); $rang = $rangmax + 1; @@ -1734,8 +1734,8 @@ class CommandeFournisseur extends CommonOrder $this->line->tva_tx = $txtva; $this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0); $this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0); - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->localtax1_type = $localtax1_type; + $this->line->localtax2_type = $localtax2_type; $this->line->fk_product = $fk_product; $this->line->product_type = $product_type; $this->line->remise_percent = $remise_percent; @@ -2594,8 +2594,8 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; - $localtax1_type = $localtaxes_type[0]; - $localtax2_type = $localtaxes_type[2]; + $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; //Fetch current line from the database and then clone the object and set it in $oldline property $this->line = new CommandeFournisseurLigne($this->db); @@ -2633,8 +2633,8 @@ class CommandeFournisseur extends CommonOrder $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = $pu_ht; $this->line->rang = $this->rang; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 40ffb9024c5..c8ae31398c0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1765,8 +1765,8 @@ class FactureFournisseur extends CommonInvoice $this->line->tva_tx = $txtva; $this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0); $this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0); - $this->line->localtax1_type = $localtaxes_type[0]; - $this->line->localtax2_type = $localtaxes_type[2]; + $this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative $this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva); @@ -1952,8 +1952,8 @@ class FactureFournisseur extends CommonInvoice $line->tva_tx = $vatrate; $line->localtax1_tx = $txlocaltax1; $line->localtax2_tx = $txlocaltax2; - $line->localtax1_type = $localtaxes_type[0]; - $line->localtax2_type = $localtaxes_type[2]; + $line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; + $line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); $line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva); $line->total_localtax1 = $total_localtax1; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 12d3352205b..e680e55868a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -168,14 +168,8 @@ $arrayfields = array( 'cf.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>1) ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b439e5cad45..c615817e36f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -115,6 +115,8 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$error = 0; + /* * Actions @@ -183,8 +185,7 @@ if (empty($reshook)) } // Check parameters - if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) - { + if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) { $langs->load("stocks"); if (!$idwarehouse || $idwarehouse == -1) { @@ -194,11 +195,9 @@ if (empty($reshook)) } } - if (!$error) - { + if (!$error) { $result = $object->validate($user, '', $idwarehouse); - if ($result < 0) - { + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { // Define output language @@ -220,8 +219,7 @@ if (empty($reshook)) } } } - } elseif ($action == 'confirm_delete' && $confirm == 'yes') - { + } elseif ($action == 'confirm_delete' && $confirm == 'yes') { $object->fetch($id); $object->fetch_thirdparty(); @@ -280,15 +278,13 @@ if (empty($reshook)) } elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) { $object->fetch($id); $result = $object->set_paid($user); - if ($result < 0) - { + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } // Set supplier ref - if ($action == 'setref_supplier' && $usercancreate) - { + if ($action == 'setref_supplier' && $usercancreate) { $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); if ($object->update($user) < 0) { @@ -315,8 +311,7 @@ if (empty($reshook)) } // payments conditions - if ($action == 'setconditions' && $usercancreate) - { + if ($action == 'setconditions' && $usercancreate) { $object->fetch($id); $object->cond_reglement_code = 0; // To clean property $object->cond_reglement_id = 0; // To clean property @@ -1680,20 +1675,17 @@ if ($action == 'create') $currency_code = $conf->currency; $societe = ''; - if (GETPOST('socid') > 0) - { + if (GETPOST('socid') > 0) { $societe = new Societe($db); $societe->fetch(GETPOST('socid', 'int')); if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code; } - if (!empty($origin) && !empty($originid)) - { + if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) $element = $subelement = $origin; - if ($element == 'project') - { + if ($element == 'project') { $projectid = $originid; $element = 'projet'; } @@ -2204,8 +2196,7 @@ if ($action == 'create') // Show origin lines - if (is_object($objectsrc)) - { + if (is_object($objectsrc)) { print '
'; $title = $langs->trans('ProductsAndServices'); @@ -2218,8 +2209,7 @@ if ($action == 'create') print ''; } } else { - if ($id > 0 || !empty($ref)) - { + if ($id > 0 || !empty($ref)) { /* *************************************************************************** */ /* */ /* Fiche en mode visu ou edition */ @@ -2275,7 +2265,7 @@ if ($action == 'create') $head = facturefourn_prepare_head($object); $titre = $langs->trans('SupplierInvoice'); - print dol_get_fiche_head($head, 'card', $titre, -1, 'bill'); + print dol_get_fiche_head($head, 'card', $titre, -1, 'supplier_invoice'); $formconfirm = ''; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 99010c977dc..357abd029fa 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -134,7 +134,7 @@ if ($id > 0 || !empty($ref)) $head = facturefourn_prepare_head($object); - print dol_get_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill'); + print dol_get_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index d57abc67644..36f5a45b25e 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -90,7 +90,7 @@ llxHeader('', $title, $helpurl); if ($object->id > 0) { $head = facturefourn_prepare_head($object); - print dol_get_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'bill'); + print dol_get_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice'); $totalpaye = $object->getSommePaiement(); diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index 494f5d2aa03..131b34bbe39 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -51,7 +51,7 @@ $maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->globa llxHeader("", $langs->trans("SupplierInvoicesArea"), 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); -print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'bill'); +print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'supplier_invoice'); print '
'; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index f8522722e64..656cd3c5553 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -65,7 +65,7 @@ $alreadypaid = $object->getSommePaiement(); $head = facturefourn_prepare_head($object); $titre = $langs->trans('SupplierInvoice'); -print dol_get_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'bill'); +print dol_get_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), -1, 'supplier_invoice'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index d0dce03c87f..b0c58572955 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -189,14 +189,8 @@ $arrayfields = array( 'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index c72e7b72710..c98ad3ba1d8 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -82,7 +82,7 @@ if ($object->id > 0) $head = facturefourn_prepare_head($object); $titre = $langs->trans('SupplierInvoice'); - print dol_get_fiche_head($head, 'note', $titre, -1, 'bill'); + print dol_get_fiche_head($head, 'note', $titre, -1, 'supplier_invoice'); // Supplier invoice card diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 41ae8a6956f..cbd9b76e45e 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -143,14 +143,7 @@ $arrayfields = array( 'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; if (empty($conf->holiday->enabled)) { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/ApcCache.php b/htdocs/includes/restler/framework/Luracast/Restler/ApcCache.php index b8cdd95b373..a2ddc83c44f 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/ApcCache.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/ApcCache.php @@ -13,7 +13,7 @@ use Luracast\Restler\iCache; * @copyright 2013 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class ApcCache implements iCache { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php index d8445fdc70c..5ed160a070a 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php @@ -12,7 +12,7 @@ namespace Luracast\Restler { * @subpackage helper * @author Nick Lombard * @copyright 2012 Luracast - * @version 3.0.0rc6 + * */ class AutoLoader { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php index 2815f1f6c70..6b8b9178f6b 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php @@ -1,4 +1,5 @@ true, - 'select' => true, + 'choice' => true, + 'select' => true, 'properties' => true, ); @@ -220,7 +221,7 @@ class CommentParser */ private function parseParam($param, array $value, array $embedded) { - $data = & $this->_data; + $data = &$this->_data; $allowMultiple = false; switch ($param) { case 'param' : @@ -237,7 +238,7 @@ class CommentParser $value = $this->formatReturn($value); break; case 'class' : - $data = & $data[$param]; + $data = &$data[$param]; list ($param, $value) = $this->formatClass($value); break; case 'access' : @@ -294,7 +295,7 @@ class CommentParser += $data[$param][self::$embeddedDataName]; } if (!is_array($data[$param])) { - $data[$param] = array('description' => (string) $data[$param]); + $data[$param] = array('description' => (string)$data[$param]); } if (is_array($value)) { $data[$param] = $value + $data[$param]; @@ -320,19 +321,24 @@ class CommentParser $data['pattern'] = $matches[2]; } while (preg_match('/{@(\w+)\s?([^}]*)}/ms', $subject, $matches)) { + $name = $matches[1]; + $value = $matches[2]; $subject = str_replace($matches[0], '', $subject); - if ($matches[1] == 'pattern') { + if ($name == 'pattern') { throw new Exception('Inline pattern tag should follow {@pattern /REGEX_PATTERN_HERE/} format and can optionally include PCRE modifiers following the ending `/`'); - } elseif (isset(static::$allowsArrayValue[$matches[1]])) { - $matches[2] = explode(static::$arrayDelimiter, $matches[2]); - } elseif ($matches[2] == 'true' || $matches[2] == 'false') { - $matches[2] = $matches[2] == 'true'; - } elseif ($matches[2] == '') { - $matches[2] = true; - } elseif ($matches[1] == 'required') { - $matches[2] = explode(static::$arrayDelimiter, $matches[2]); + } elseif (isset(static::$allowsArrayValue[$name])) { + $value = explode(static::$arrayDelimiter, $value); + } elseif ($value == 'true' || $value == 'false') { + $value = $value == 'true'; + } elseif ($value == '') { + $value = true; + } elseif ($name == 'required') { + $value = explode(static::$arrayDelimiter, $value); } - $data[$matches[1]] = $matches[2]; + if (defined('Luracast\\Restler\\UI\\HtmlForm::'.$name)) { + $value = constant($value); + } + $data[$name] = $value; } while (preg_match(self::$embeddedDataPattern, $subject, $matches)) { @@ -340,9 +346,9 @@ class CommentParser $str = $matches[self::$embeddedDataIndex]; if (isset ($this->restler) && self::$embeddedDataIndex > 1 - && !empty ($matches[1]) + && !empty ($name) ) { - $extension = $matches[1]; + $extension = $name; $formatMap = $this->restler->getFormatMap(); if (isset ($formatMap[$extension])) { /** @@ -397,15 +403,15 @@ class CommentParser { $code = 500; $exception = 'Exception'; - if(count($value)>1){ + if (count($value) > 1) { $v1 = $value[0]; $v2 = $value[1]; - if(is_numeric($v1)){ + if (is_numeric($v1)) { $code = $v1; $exception = $v2; array_shift($value); array_shift($value); - } elseif(is_numeric($v2)){ + } elseif (is_numeric($v2)) { $code = $v2; $exception = $v1; array_shift($value); @@ -414,17 +420,17 @@ class CommentParser $exception = $v1; array_shift($value); } - } elseif(count($value) && is_numeric($value[0])) { + } elseif (count($value) && is_numeric($value[0])) { $code = $value[0]; array_shift($value); } $message = implode(' ', $value); - if(!isset(RestException::$codes[$code])){ + if (!isset(RestException::$codes[$code])) { $code = 500; - } elseif(empty($message)){ + } elseif (empty($message)) { $message = RestException::$codes[$code]; } - return compact('code','message','exception'); + return compact('code', 'message', 'exception'); } private function formatClass(array $value) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Compose.php b/htdocs/includes/restler/framework/Luracast/Restler/Compose.php index 594e5902004..141aa8bcb2f 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Compose.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Compose.php @@ -11,7 +11,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Compose implements iCompose { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/ApiMethodInfo.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/ApiMethodInfo.php index 4d0fa4bfd48..f4dea84df97 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/ApiMethodInfo.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/ApiMethodInfo.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class ApiMethodInfo extends ValueObject { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/Arr.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/Arr.php index 6e98a4132ea..8ae18c7003d 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/Arr.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/Arr.php @@ -10,7 +10,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Arr { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/Invalid.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/Invalid.php index 6b06d266f13..832dd30850e 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/Invalid.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/Invalid.php @@ -12,7 +12,7 @@ use Exception; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Invalid extends Exception { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/Obj.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/Obj.php index 003f1df8794..8fe2a79ab63 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/Obj.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/Obj.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Obj { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/Text.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/Text.php index 506ea25fb20..d0b39896c8e 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/Text.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/Text.php @@ -10,87 +10,91 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Text { - /** - * Given haystack contains the needle or not? - * - * @param string $haystack - * @param string $needle - * @param bool $caseSensitive - * - * @return bool - */ - public static function contains($haystack, $needle, $caseSensitive = true) - { - if (empty($needle)) - return true; - return $caseSensitive - ? strpos($haystack, $needle) !== false - : stripos($haystack, $needle) !== false; - } - - /** - * Given haystack begins with the needle or not? - * - * @param string $haystack - * @param string $needle - * - * @return bool - */ - public static function beginsWith($haystack, $needle) - { - $length = strlen($needle); - return (substr($haystack, 0, $length) === $needle); - } - - /** - * Given haystack ends with the needle or not? - * - * @param string $haystack - * @param string $needle - * - * @return bool - */ - public static function endsWith($haystack, $needle) - { - $length = strlen($needle); - if ($length == 0) { - return true; - } - return (substr($haystack, -$length) === $needle); - } - - - /** - * Convert camelCased or underscored string in to a title - * - * @param string $name - * - * @return string - */ - public static function title($name) - { - return - ucwords( - preg_replace( - array('/(?<=[^A-Z])([A-Z])/', '/(?<=[^0-9])([0-9])/', '/([_-])/', '/[^a-zA-Z0-9\s]|\s\s+/'), - array(' $0', ' $0', ' ', ' '), - $name - ) - ); - } - - /** - * Convert given string to be used as a slug or css class - * - * @param string $name - * @return string - */ - public static function slug($name) - { - return preg_replace('/[^a-zA-Z]+/', '-', strtolower(strip_tags($name))); - } + /** + * Given haystack contains the needle or not? + * + * @param string $haystack + * @param string $needle + * @param bool $caseSensitive + * + * @return bool + */ + public static function contains($haystack, $needle, $caseSensitive = true) + { + if (empty($needle)) + return true; + return $caseSensitive + ? strpos($haystack, $needle) !== false + : stripos($haystack, $needle) !== false; + } + + /** + * Given haystack begins with the needle or not? + * + * @param string $haystack + * @param string $needle + * + * @return bool + */ + public static function beginsWith($haystack, $needle) + { + $length = strlen($needle); + return (substr($haystack, 0, $length) === $needle); + } + + /** + * Given haystack ends with the needle or not? + * + * @param string $haystack + * @param string $needle + * + * @return bool + */ + public static function endsWith($haystack, $needle) + { + $length = strlen($needle); + if ($length == 0) { + return true; + } + + // @CHANGE LDR + if (!is_string($haystack)) return false; + + return (substr($haystack, -$length) === $needle); + } + + + /** + * Convert camelCased or underscored string in to a title + * + * @param string $name + * + * @return string + */ + public static function title($name) + { + return + ucwords( + preg_replace( + array('/(?<=[^A-Z])([A-Z])/', '/(?<=[^0-9])([0-9])/', '/([_-])/', '/[^a-zA-Z0-9\s]|\s\s+/'), + array(' $0', ' $0', ' ', ' '), + $name + ) + ); + } + + /** + * Convert given string to be used as a slug or css class + * + * @param string $name + * @return string + */ + public static function slug($name) + { + return preg_replace('/[^a-zA-Z]+/', '-', strtolower(strip_tags($name))); + } } \ No newline at end of file diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/ValidationInfo.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/ValidationInfo.php index 298b72ec125..fc05c5386df 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/ValidationInfo.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/ValidationInfo.php @@ -15,7 +15,7 @@ use Luracast\Restler\Util; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class ValidationInfo implements iValueObject { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/Validator.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/Validator.php index c98a17a62d6..023fc7c4d1e 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/Validator.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/Validator.php @@ -18,7 +18,7 @@ use Luracast\Restler\Util; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Validator implements iValidate { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/ValueObject.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/ValueObject.php index 46857b45329..5a2b001e841 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/ValueObject.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/ValueObject.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class ValueObject implements iValueObject { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/iValidate.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/iValidate.php index 66688b066ba..923fc79b1ce 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/iValidate.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/iValidate.php @@ -10,7 +10,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iValidate { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Data/iValueObject.php b/htdocs/includes/restler/framework/Luracast/Restler/Data/iValueObject.php index dbf36cb744c..dcce824a655 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Data/iValueObject.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Data/iValueObject.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Data; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iValueObject { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Defaults.php b/htdocs/includes/restler/framework/Luracast/Restler/Defaults.php index 8913db316b5..803c8b3177a 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Defaults.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Defaults.php @@ -15,7 +15,7 @@ use Luracast\Restler\Data\Validator; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Defaults { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/EventDispatcher.php b/htdocs/includes/restler/framework/Luracast/Restler/EventDispatcher.php index f8cd883af46..0c5d0fa676c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/EventDispatcher.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/EventDispatcher.php @@ -9,7 +9,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ use Closure; diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Filter/RateLimit.php b/htdocs/includes/restler/framework/Luracast/Restler/Filter/RateLimit.php index 5dce8591bba..e5705136fce 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Filter/RateLimit.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Filter/RateLimit.php @@ -15,7 +15,7 @@ use Luracast\Restler\RestException; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class RateLimit implements iFilter, iUseAuthentication { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Flash.php b/htdocs/includes/restler/framework/Luracast/Restler/Flash.php index 3ab04aa745e..41d097f312d 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Flash.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Flash.php @@ -15,7 +15,7 @@ use ArrayAccess; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Flash implements ArrayAccess { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/AmfFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/AmfFormat.php index 3d146fbcfac..181d95bea46 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/AmfFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/AmfFormat.php @@ -17,7 +17,7 @@ use ZendAmf\Parser\OutputStream; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class AmfFormat extends DependentFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/CsvFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/CsvFormat.php index 4bed88251c8..c33557f8463 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/CsvFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/CsvFormat.php @@ -15,7 +15,7 @@ use Luracast\Restler\RestException; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class CsvFormat extends Format implements iDecodeStream { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/Format.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/Format.php index 10b2c5834e6..edc2cbde719 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/Format.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/Format.php @@ -10,7 +10,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ abstract class Format implements iFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/HtmlFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/HtmlFormat.php index e871186c446..493e3e44061 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/HtmlFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/HtmlFormat.php @@ -1,4 +1,5 @@ 'illuminate/view:4.2.*', - 'Twig_Environment' => 'twig/twig:v1.13.*', - 'Mustache_Engine' => 'mustache/mustache:dev-master', + self::BLADE => 'illuminate/view:^8', + self::TWIG => 'twig/twig:^3', + self::MUSTACHE => 'mustache/mustache:dev-master', ); } @@ -101,7 +111,7 @@ class HtmlFormat extends DependentFormat $resolver->register('blade', function () use ($engine) { return $engine; }); - $phpEngine = new PhpEngine(); + $phpEngine = new PhpEngine($files); $resolver->register('php', function () use ($phpEngine) { return $phpEngine; }); @@ -128,32 +138,43 @@ class HtmlFormat extends DependentFormat return $view->render(); } - public static function twig(array $data, $debug = true) + /** + * @param array|object $data + * @param bool $debug + * + * @return string + * @throws \Twig\Error\LoaderError + * @throws \Twig\Error\RuntimeError + * @throws \Twig\Error\SyntaxError + */ + public static function twig($data, $debug = true) { - $loader = new \Twig_Loader_Filesystem(static::$viewPath); - $twig = new \Twig_Environment($loader, array( - 'cache' => static::$cacheDirectory, - 'debug' => $debug, + $loader = new FilesystemLoader(static::$viewPath); + $twig = new Environment($loader, array( + 'cache' => is_string(static::$cacheDirectory) + ? static::$cacheDirectory : false, + 'debug' => $debug, 'use_strict_variables' => $debug, )); - if ($debug) - $twig->addExtension(new \Twig_Extension_Debug()); + if ($debug) { + $twig->addExtension(new DebugExtension()); + } $twig->addFunction( - new \Twig_SimpleFunction( + new TwigFunction( 'form', 'Luracast\Restler\UI\Forms::get', array('is_safe' => array('html')) ) ); $twig->addFunction( - new \Twig_SimpleFunction( + new TwigFunction( 'form_key', 'Luracast\Restler\UI\Forms::key' ) ); $twig->addFunction( - new \Twig_SimpleFunction( + new TwigFunction( 'nav', 'Luracast\Restler\UI\Nav::get' ) @@ -164,7 +185,7 @@ class HtmlFormat extends DependentFormat isset(HtmlFormat::$data[$name]) && is_callable(HtmlFormat::$data[$name]) ) { - return new \Twig_SimpleFunction( + return new TwigFunction( $name, HtmlFormat::$data[$name] ); @@ -172,21 +193,35 @@ class HtmlFormat extends DependentFormat return false; }); - $template = $twig->loadTemplate(static::getViewFile()); - return $template->render($data); + $template = $twig->load(static::getViewFile()); + return $template->render((array)$data); } - public static function handlebar(array $data, $debug = true) + /** + * @param array|object $data + * @param bool $debug + * + * @return string + */ + public static function handlebar($data, $debug = true) { return static::mustache($data, $debug); } - public static function mustache(array $data, $debug = true) + /** + * @param array|object $data + * @param bool $debug + * + * @return string + */ + public static function mustache($data, $debug = true) { - if (!isset($data['nav'])) + $data = (array)$data; + if (!isset($data['nav'])) { $data['nav'] = array_values(Nav::get()); + } $options = array( - 'loader' => new \Mustache_Loader_FilesystemLoader( + 'loader' => new \Mustache_Loader_FilesystemLoader( static::$viewPath, array('extension' => static::getViewExtension()) ), @@ -200,16 +235,25 @@ class HtmlFormat extends DependentFormat }, ) ); - if (!$debug) + if (!$debug) { $options['cache'] = static::$cacheDirectory; + } $m = new \Mustache_Engine($options); return $m->render(static::getViewFile(), $data); } - public static function php(array $data, $debug = true) + /** + * @param array|object $data + * @param bool $debug + * + * @return string + * @throws RestException + */ + public static function php($data, $debug = true) { - if (static::$view == 'debug') + if (static::$view == 'debug') { static::$viewPath = dirname(__DIR__) . '/views'; + } $view = static::getViewFile(true); if (!is_readable($view)) { @@ -222,22 +266,26 @@ class HtmlFormat extends DependentFormat $path = static::$viewPath . DIRECTORY_SEPARATOR; $template = function ($view) use ($data, $path) { + $data = (array)$data; $form = function () { return call_user_func_array( 'Luracast\Restler\UI\Forms::get', func_get_args() ); }; - if (!isset($data['form'])) + if (!isset($data['form'])) { $data['form'] = $form; + } $nav = function () { return call_user_func_array( 'Luracast\Restler\UI\Nav::get', func_get_args() ); }; - if (!isset($data['nav'])) + if (!isset($data['nav'])) { $data['nav'] = $nav; + } + $_ = function () use ($data, $path) { extract($data); @@ -254,7 +302,7 @@ class HtmlFormat extends DependentFormat ) { $str = ''; foreach ($arrays as $arr) { - extract($arr); + extract((array)$arr); $str .= include $file; } return $str; @@ -264,15 +312,18 @@ class HtmlFormat extends DependentFormat } break; case 'if': - if (count($args) < 2) + if (count($args) < 2) { $args[1] = ''; - if (count($args) < 3) + } + if (count($args) < 3) { $args[2] = ''; + } return $args[0] ? $args[1] : $args[2]; break; default: - if (isset($data[$task]) && is_callable($data[$task])) + if (isset($data[$task]) && is_callable($data[$task])) { return call_user_func_array($data[$task], $args); + } } return ''; }; @@ -280,8 +331,9 @@ class HtmlFormat extends DependentFormat return @include $view; }; $value = $template($view); - if (is_string($value)) + if (is_string($value)) { return $value; + } } /** @@ -294,8 +346,8 @@ class HtmlFormat extends DependentFormat * Formatter has to make the encoded * output more human readable * - * @throws \Exception * @return string encoded string + * @throws \Exception */ public function encode($data, $humanReadable = false) { @@ -317,9 +369,9 @@ class HtmlFormat extends DependentFormat 'response' => static::$convertResponseToArray ? Obj::toArray($data) : $data, - 'stages' => $this->restler->getEvents(), - 'success' => $success, - 'error' => $error + 'stages' => $this->restler->getEvents(), + 'success' => $success, + 'error' => $error ); $info = $data['api'] = $this->restler->apiMethodInfo; $metadata = Util::nestedValue( @@ -358,7 +410,9 @@ class HtmlFormat extends DependentFormat if ($value) { $data = Util::nestedValue($data, explode('.', $value)); } - $data += static::$data; + if (is_array($data)) { + $data += static::$data; + } if (false === ($i = strrpos(self::$view, '.'))) { $template = self::$template; } else { @@ -369,17 +423,18 @@ class HtmlFormat extends DependentFormat static::$cacheDirectory = Defaults::$cacheDirectory . DIRECTORY_SEPARATOR . $template; if (!file_exists(static::$cacheDirectory)) { if (!mkdir(static::$cacheDirectory, 0770, true)) { - throw new RestException(500, 'Unable to create cache directory `' . static::$cacheDirectory . '`'); + throw new RestException(500, + 'Unable to create cache directory `' . static::$cacheDirectory . '`'); } } } if (method_exists($class = get_called_class(), $template)) { if ($template == 'blade') { - $this->checkDependency('Illuminate\View\View'); + $this->checkDependency(self::BLADE); } elseif ($template == 'twig') { - $this->checkDependency('Twig_Environment'); + $this->checkDependency(self::TWIG); } elseif ($template == 'mustache' || $template == 'handlebar') { - $this->checkDependency('Mustache_Engine'); + $this->checkDependency(self::MUSTACHE); } return call_user_func("$class::$template", $data, $humanReadable); } @@ -416,8 +471,9 @@ class HtmlFormat extends DependentFormat { $v = $fullPath ? static::$viewPath . '/' : ''; $v .= static::$view; - if ($includeExtension) + if ($includeExtension) { $v .= '.' . static::getViewExtension(); + } return $v; } diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/JsFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/JsFormat.php index 0f04b7f0ee5..913dc272e19 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/JsFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/JsFormat.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class JsFormat extends JsonFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/JsonFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/JsonFormat.php index 00c763e8ff5..170676c071b 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/JsonFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/JsonFormat.php @@ -15,7 +15,7 @@ use Luracast\Restler\RestException; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class JsonFormat extends Format { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/MultiFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/MultiFormat.php index 18fdd54b842..64afa3b3ea4 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/MultiFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/MultiFormat.php @@ -9,7 +9,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ abstract class MultiFormat implements iFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/PlistFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/PlistFormat.php index cc07066a33c..f1eca01933d 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/PlistFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/PlistFormat.php @@ -18,7 +18,7 @@ use CFPropertyList\CFPropertyList; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class PlistFormat extends DependentMultiFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/TsvFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/TsvFormat.php index 502b02d2758..4eb3006f363 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/TsvFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/TsvFormat.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class TsvFormat extends CsvFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/UploadFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/UploadFormat.php index de41bf98c71..b58b0f02b49 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/UploadFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/UploadFormat.php @@ -13,7 +13,7 @@ use Luracast\Restler\RestException; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class UploadFormat extends Format { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/UrlEncodedFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/UrlEncodedFormat.php index 12d5a410333..6d141230d82 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/UrlEncodedFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/UrlEncodedFormat.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class UrlEncodedFormat extends Format { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php index ceec32e4cb5..6f8606eb111 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php @@ -16,7 +16,7 @@ use XMLWriter; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class XmlFormat extends Format { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/YamlFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/YamlFormat.php index 07baae88b6f..4ff643de65f 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/YamlFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/YamlFormat.php @@ -14,7 +14,7 @@ use Luracast\Restler\Data\Obj; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class YamlFormat extends DependentFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/iDecodeStream.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/iDecodeStream.php index 080e3da506c..ec29330ed1f 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/iDecodeStream.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/iDecodeStream.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iDecodeStream { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/iFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/iFormat.php index d70d2019a94..0f4173d5b74 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/iFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/iFormat.php @@ -11,7 +11,7 @@ namespace Luracast\Restler\Format; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iFormat { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/HumanReadableCache.php b/htdocs/includes/restler/framework/Luracast/Restler/HumanReadableCache.php index 6e1c22b432c..2546e30a4ee 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/HumanReadableCache.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/HumanReadableCache.php @@ -10,7 +10,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class HumanReadableCache implements iCache { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/InvalidAuthCredentials.php b/htdocs/includes/restler/framework/Luracast/Restler/InvalidAuthCredentials.php index 233e543e0aa..1b402238bf3 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/InvalidAuthCredentials.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/InvalidAuthCredentials.php @@ -12,7 +12,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ diff --git a/htdocs/includes/restler/framework/Luracast/Restler/PassThrough.php b/htdocs/includes/restler/framework/Luracast/Restler/PassThrough.php index a77e533b722..2d265fb0fba 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/PassThrough.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/PassThrough.php @@ -10,7 +10,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class PassThrough { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Redirect.php b/htdocs/includes/restler/framework/Luracast/Restler/Redirect.php index 63319106759..8203b8eb18d 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Redirect.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Redirect.php @@ -12,7 +12,7 @@ use Luracast\Restler\Format\JsonFormat; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Redirect { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Resources.php b/htdocs/includes/restler/framework/Luracast/Restler/Resources.php index 2986968a990..dfb547d287b 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Resources.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Resources.php @@ -15,7 +15,7 @@ use stdClass; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Resources implements iUseAuthentication, iProvideMultiVersionApi { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/RestException.php b/htdocs/includes/restler/framework/Luracast/Restler/RestException.php index b2e51f8b122..4291381661c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/RestException.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/RestException.php @@ -14,7 +14,7 @@ use Exception; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class RestException extends Exception diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Restler.php b/htdocs/includes/restler/framework/Luracast/Restler/Restler.php index fcb5388726c..0c8f44a3864 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Restler.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Restler.php @@ -15,13 +15,14 @@ use Luracast\Restler\Format\UrlEncodedFormat; * inspired by the RestServer code from * * + * * @category Framework * @package Restler * @author R.Arul Kumaran * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * * * @method static void onGet() onGet(Callable $function) fired before reading the request details * @method static void onRoute() onRoute(Callable $function) fired before finding the api method @@ -48,10 +49,13 @@ use Luracast\Restler\Format\UrlEncodedFormat; * @method void onRespond() onRespond(Callable $function) fired before sending response * @method void onComplete() onComplete(Callable $function) fired after sending response * @method void onMessage() onMessage(Callable $function) fired before composing error response + * + * @property bool|null _authenticated + * @property bool _authVerified */ class Restler extends EventDispatcher { - const VERSION = '3.0.0rc6'; + const VERSION = '3.1.0'; // ================================================================== // @@ -693,6 +697,8 @@ class Restler extends EventDispatcher * - media type * - charset * - language + * + * @throws RestException */ protected function negotiate() { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Routes.php b/htdocs/includes/restler/framework/Luracast/Restler/Routes.php index 999094dec4c..d59b27d4418 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Routes.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Routes.php @@ -17,7 +17,7 @@ use Exception; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Routes { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Scope.php b/htdocs/includes/restler/framework/Luracast/Restler/Scope.php index 16ccdd33561..6f7b49daf40 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Scope.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Scope.php @@ -1,4 +1,6 @@ 'Luracast\Restler\Resources', 'Explorer' => 'Luracast\Restler\Explorer\v2\Explorer', - 'Explorer1' => 'Luracast\Restler\Explorer\v1\Explorer', - 'Explorer2' => 'Luracast\Restler\Explorer\v2\Explorer', + 'Explorer1' => 'Luracast\Restler\Explorer\v1\Explorer', + 'Explorer2' => 'Luracast\Restler\Explorer\v2\Explorer', //Cache classes 'HumanReadableCache' => 'Luracast\Restler\HumanReadableCache', @@ -120,6 +122,7 @@ class Scope $r = new $fullName(); static::$instances[$name] = (object)array('instance' => $r); if ($name != 'Restler') { + /** @var Restler restler */ $r->restler = static::get('Restler'); $m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata'); if ($m) { @@ -138,15 +141,14 @@ class Scope } if ( $r instanceof iUseAuthentication && - static::get('Restler')->_authVerified && + $r->restler && $r->restler->_authVerified && !isset(static::$instances[$name]->authVerified) ) { static::$instances[$name]->authVerified = true; - $r->__setAuthenticationStatus - (static::get('Restler')->_authenticated); + $r->__setAuthenticationStatus($r->restler->_authenticated); } if (isset(static::$instances[$name]->initPending)) { - $m = Util::nestedValue(static::get('Restler'), 'apiMethodInfo', 'metadata'); + $m = Util::nestedValue($r->restler, 'apiMethodInfo', 'metadata'); $fullName = $name; if (class_exists($name)) { $shortName = Util::getShortName($name); @@ -194,15 +196,15 @@ class Scope */ public static function resolve($className, array $scope) { - if (empty($className) || !is_string($className)) + if (empty($className) || !is_string($className)) { return false; + } if (self::isPrimitiveDataType($className)) { return false; } $divider = '\\'; - $qualified = false; if ($className[0] == $divider) { $qualified = trim($className, $divider); } elseif (array_key_exists($className, $scope)) { @@ -210,18 +212,21 @@ class Scope } else { $qualified = $scope['*'] . $className; } - if (class_exists($qualified)) + if (class_exists($qualified)) { return $qualified; + } if (isset(static::$classAliases[$className])) { $qualified = static::$classAliases[$className]; - if (class_exists($qualified)) + if (class_exists($qualified)) { return $qualified; + } } return false; } /** * @param string $stringName + * * @return boolean */ private static function isPrimitiveDataType($stringName) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php b/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php index 435804b4469..66090568a47 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php @@ -8,7 +8,7 @@ use Luracast\Restler\Util; * Class Emmet * @package Luracast\Restler\UI * - * @version 3.0.0rc6 + * @version 3.1.0 */ class Emmet { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/UI/Forms.php b/htdocs/includes/restler/framework/Luracast/Restler/UI/Forms.php index 7073bfcf837..20749a2e691 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/UI/Forms.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/UI/Forms.php @@ -1,4 +1,5 @@ url; + } $info = $restler->url == $action && Util::getRequestMethod() == $method @@ -126,23 +134,25 @@ class Forms implements iFilter //echo $e->getErrorMessage(); $info = false; } - if (!$info) + if (!$info) { throw new RestException(500, 'invalid action path for form `' . $method . ' ' . $action . '`'); + } static::$info = $info; $m = $info->metadata; $r = static::fields($dataOnly); if ($method != 'GET' && $method != 'POST') { - if (empty(Defaults::$httpMethodOverrideProperty)) + if (empty(Defaults::$httpMethodOverrideProperty)) { throw new RestException( 500, 'Forms require `Defaults::\$httpMethodOverrideProperty`' . "for supporting HTTP $method" ); + } if ($dataOnly) { $r[] = array( - 'tag' => 'input', - 'name' => Defaults::$httpMethodOverrideProperty, - 'type' => 'hidden', + 'tag' => 'input', + 'name' => Defaults::$httpMethodOverrideProperty, + 'type' => 'hidden', 'value' => 'method', ); } else { @@ -158,9 +168,9 @@ class Forms implements iFilter $form_key = static::key($method, $action); if ($dataOnly) { $r[] = array( - 'tag' => 'input', - 'name' => static::FORM_KEY, - 'type' => 'hidden', + 'tag' => 'input', + 'name' => static::FORM_KEY, + 'type' => 'hidden', 'value' => 'hidden', ); } else { @@ -173,15 +183,16 @@ class Forms implements iFilter } $s = array( - 'tag' => 'button', - 'type' => 'submit', + 'tag' => 'button', + 'type' => 'submit', 'label' => Util::nestedValue($m, 'return', CommentParser::$embeddedDataName, 'label') - ? : 'Submit' + ?: 'Submit' ); - if (!$dataOnly) + if (!$dataOnly) { $s = Emmet::make(static::style('submit', $m), $s); + } $r[] = $s; $t = array( 'action' => $restler->getBaseUrl() . '/' . rtrim($action, '/'), @@ -207,15 +218,18 @@ class Forms implements iFilter public static function style($name, array $metadata, $type = '') { - return isset($metadata[CommentParser::$embeddedDataName][$name]) - ? $metadata[CommentParser::$embeddedDataName][$name] - : (!empty($type) && isset(static::$style["$name-$type"]) - ? static::$style["$name-$type"] - : (isset(static::$style[$name]) - ? static::$style[$name] - : null - ) - ); + if (isset($metadata[CommentParser::$embeddedDataName][$name])) { + return $metadata[CommentParser::$embeddedDataName][$name]; + } + $style = static::$style . '::' . $name; + $typedStyle = $style . '_' . $type; + if (defined($typedStyle)) { + return constant($typedStyle); + } + if (defined($style)) { + return constant($style); + } + return null; } public static function fields($dataOnly = false) @@ -230,11 +244,13 @@ class Forms implements iFilter is_scalar($value) || ($p['type'] == 'array' && is_array($value) && $value == array_values($value)) || is_object($value) && $p['type'] == get_class($value) - ) + ) { $p['value'] = $value; + } static::$validationInfo = $v = new ValidationInfo($p); - if ($v->from == 'path') + if ($v->from == 'path') { continue; + } if (!empty($v->children)) { $t = Emmet::make(static::style('fieldset', $m), array('label' => $v->label)); foreach ($v->children as $n => $c) { @@ -243,11 +259,13 @@ class Forms implements iFilter is_scalar($value) || ($c['type'] == 'array' && is_array($value) && $value == array_values($value)) || is_object($value) && $c['type'] == get_class($value) - ) + ) { $c['value'] = $value; + } static::$validationInfo = $vc = new ValidationInfo($c); - if ($vc->from == 'path') + if ($vc->from == 'path') { continue; + } $vc->name = $v->name . '[' . $vc->name . ']'; $t [] = static::field($vc, $dataOnly); } @@ -275,7 +293,7 @@ class Forms implements iFilter //prevent XSS attacks $p->value = htmlspecialchars($p->value, ENT_QUOTES | ENT_HTML401, 'UTF-8'); } - $type = $p->field ? : static::guessFieldType($p); + $type = $p->field ?: static::guessFieldType($p); $tag = in_array($type, static::$inputTypes) ? 'input' : $type; $options = array(); @@ -291,25 +309,33 @@ class Forms implements iFilter $option['text'] = isset($p->rules['select'][$i]) ? $p->rules['select'][$i] : $choice; - if ($choice == $p->value) + if ($choice == $p->value) { $option['selected'] = true; + } $options[] = $option; } } elseif ($p->type == 'boolean' || $p->type == 'bool') { if (Text::beginsWith($type, 'radio') || Text::beginsWith($type, 'select')) { - $options[] = array('name' => $p->name, 'text' => ' Yes ', - 'value' => 'true'); - $options[] = array('name' => $p->name, 'text' => ' No ', - 'value' => 'false'); - if ($p->value || $p->default) + $options[] = array( + 'name' => $p->name, + 'text' => ' Yes ', + 'value' => 'true' + ); + $options[] = array( + 'name' => $p->name, + 'text' => ' No ', + 'value' => 'false' + ); + if ($p->value || $p->default) { $options[0]['selected'] = true; + } } else { //checkbox $r = array( - 'tag' => $tag, - 'name' => $name, - 'type' => $type, - 'label' => $p->label, - 'value' => 'true', + 'tag' => $tag, + 'name' => $name, + 'type' => $type, + 'label' => $p->label, + 'value' => 'true', 'default' => $p->default, ); $r['text'] = 'Yes'; @@ -323,13 +349,13 @@ class Forms implements iFilter } if (empty($r)) { $r = array( - 'tag' => $tag, - 'name' => $name, - 'type' => $type, - 'label' => $p->label, - 'value' => $p->value, - 'default' => $p->default, - 'options' => & $options, + 'tag' => $tag, + 'name' => $name, + 'type' => $type, + 'label' => $p->label, + 'value' => $p->value, + 'default' => $p->default, + 'options' => & $options, 'multiple' => $multiple, ); if (isset($p->rules)) { @@ -347,30 +373,36 @@ class Forms implements iFilter $r['message'] = Validator::$exceptions[$p->name]->getMessage(); } - if (true === $p->required) + if (true === $p->required) { $r['required'] = 'required'; - if (isset($p->rules['autofocus'])) + } + if (isset($p->rules['autofocus'])) { $r['autofocus'] = 'autofocus'; + } /* echo "
";
         print_r($r);
         echo "
"; */ - if ($dataOnly) + if ($dataOnly) { return $r; - if (isset($p->rules['form'])) + } + if (isset($p->rules['form'])) { return Emmet::make($p->rules['form'], $r); + } $m = static::$info->metadata; - $t = Emmet::make(static::style($type, $m, $p->type) ? : static::style($tag, $m, $p->type), $r); + $t = Emmet::make(static::style($type, $m, $p->type) ?: static::style($tag, $m, $p->type), $r); return $t; } protected static function guessFieldType(ValidationInfo $p, $type = 'type') { - if (in_array($p->$type, static::$inputTypes)) + if (in_array($p->$type, static::$inputTypes)) { return $p->$type; - if ($p->choice) + } + if ($p->choice) { return $p->type == 'array' ? 'checkbox' : 'select'; + } switch ($p->$type) { case 'boolean': return 'radio'; @@ -381,8 +413,9 @@ class Forms implements iFilter case 'array': return static::guessFieldType($p, 'contentType'); } - if ($p->name == 'password') + if ($p->name == 'password') { return 'password'; + } return 'text'; } @@ -397,11 +430,13 @@ class Forms implements iFilter */ public static function key($method = 'POST', $action = null) { - if (is_null($action)) + if (is_null($action)) { $action = Scope::get('Restler')->url; + } $target = "$method $action"; - if (empty(static::$key[$target])) + if (empty(static::$key[$target])) { static::$key[$target] = md5($target . User::getIpAddress() . uniqid(mt_rand())); + } $_SESSION[static::FORM_KEY] = static::$key; return static::$key[$target]; } @@ -425,8 +460,9 @@ class Forms implements iFilter $url = $restler->url; foreach (static::$excludedPaths as $exclude) { if (empty($exclude)) { - if ($url == $exclude) + if ($url == $exclude) { return true; + } } elseif (Text::beginsWith($url, $exclude)) { return true; } @@ -447,4 +483,4 @@ class Forms implements iFilter } return true; } -} \ No newline at end of file +} diff --git a/htdocs/includes/restler/framework/Luracast/Restler/UI/Nav.php b/htdocs/includes/restler/framework/Luracast/Restler/UI/Nav.php index b74054a99c5..4a7445ccbe6 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/UI/Nav.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/UI/Nav.php @@ -19,7 +19,7 @@ use Luracast\Restler\Util; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class Nav { @@ -130,7 +130,8 @@ class Nav } else { return $tree; } - return null; + $value = null; + return $value; } public static function addUrls(array $urls) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/UI/Tags.php b/htdocs/includes/restler/framework/Luracast/Restler/UI/Tags.php index 2c194cdbd1b..27e90bc89b5 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/UI/Tags.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/UI/Tags.php @@ -14,7 +14,7 @@ use Luracast\Restler\Util; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * * * ============================ magic properties ============================== * @property Tags parent parent tag diff --git a/htdocs/includes/restler/framework/Luracast/Restler/User.php b/htdocs/includes/restler/framework/Luracast/Restler/User.php index 57465e26e46..463fd46867c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/User.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/User.php @@ -11,7 +11,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ class User implements iIdentifyUser { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Util.php b/htdocs/includes/restler/framework/Luracast/Restler/Util.php index 9674550814f..a181a0e0da9 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Util.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Util.php @@ -1,5 +1,7 @@ 0) + } + if (strlen($resourcePath) > 0) { $resourcePath .= '/'; + } return $prefix . $resourcePath; } @@ -114,8 +121,9 @@ class Util */ public static function removeCommonPath($fromPath, $usingPath, $char = '/') { - if (empty($fromPath)) + if (empty($fromPath)) { return ''; + } $fromPath = explode($char, $fromPath); $usingPath = explode($char, $usingPath); while (count($usingPath)) { @@ -145,8 +153,9 @@ class Util */ public static function splitCommonPath($fromPath, $usingPath, $char = '/') { - if (empty($fromPath)) + if (empty($fromPath)) { return array('', ''); + } $fromPath = explode($char, $fromPath); $usingPath = explode($char, $usingPath); $commonPath = array(); @@ -213,11 +222,18 @@ class Util $accepts = array($accepts); } foreach ($accepts as $pos => $accept) { - $parts = explode(';q=', trim($accept)); - $type = array_shift($parts); - $quality = count($parts) ? - floatval(array_shift($parts)) : - (1000 - $pos) / 1000; + $parts = explode(';', $accept); + $type = trim(array_shift($parts)); + $parameters = []; + foreach ($parts as $part) { + $part = explode('=', $part); + if (2 !== count($part)) { + continue; + } + $key = strtolower(trim($part[0])); + $parameters[$key] = trim($part[1], ' "'); + } + $quality = isset($parameters['q']) ? (float)$parameters['q'] : (1000 - $pos) / 1000; $acceptList[$type] = $quality; } arsort($acceptList); @@ -227,8 +243,7 @@ class Util public static function getShortName($className) { // @CHANGE LDR - if (! is_string($className)) return ''; - //var_dump($className); + if (!is_string($className)) return; $className = explode('\\', $className); return end($className); diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iAuthenticate.php b/htdocs/includes/restler/framework/Luracast/Restler/iAuthenticate.php index 6bacb8cec09..954055343e4 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iAuthenticate.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iAuthenticate.php @@ -11,7 +11,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iAuthenticate extends iFilter { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iCache.php b/htdocs/includes/restler/framework/Luracast/Restler/iCache.php index 37d6aaea261..3b6504340b6 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iCache.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iCache.php @@ -9,7 +9,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iCache { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iCompose.php b/htdocs/includes/restler/framework/Luracast/Restler/iCompose.php index b06b2c3bc6c..2bc0579befe 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iCompose.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iCompose.php @@ -13,7 +13,7 @@ use Exception; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iCompose { /** diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iFilter.php b/htdocs/includes/restler/framework/Luracast/Restler/iFilter.php index 89b50ce9812..dc1b355db0f 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iFilter.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iFilter.php @@ -12,7 +12,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iFilter { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iIdentifyUser.php b/htdocs/includes/restler/framework/Luracast/Restler/iIdentifyUser.php index d3dd4a5d8c5..834897668db 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iIdentifyUser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iIdentifyUser.php @@ -12,7 +12,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iIdentifyUser { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iProvideMultiVersionApi.php b/htdocs/includes/restler/framework/Luracast/Restler/iProvideMultiVersionApi.php index c7afe11fcb7..b57fc876f41 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iProvideMultiVersionApi.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iProvideMultiVersionApi.php @@ -5,7 +5,7 @@ namespace Luracast\Restler; * Interface iProvideMultiVersionApi * @package Luracast\Restler * - * @version 3.0.0rc6 + * */ interface iProvideMultiVersionApi { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/iUseAuthentication.php b/htdocs/includes/restler/framework/Luracast/Restler/iUseAuthentication.php index 611d909b305..ee3a9e0bcca 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/iUseAuthentication.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/iUseAuthentication.php @@ -11,7 +11,7 @@ namespace Luracast\Restler; * @copyright 2010 Luracast * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link http://luracast.com/products/restler/ - * @version 3.0.0rc6 + * */ interface iUseAuthentication { diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index eccc22de899..cfe42adc79f 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -44,21 +44,45 @@ dolibarr_install_syslog("- fileconf: entering fileconf.php page"); // install.forced.php into directory htdocs/install (This is the case with some wizard // installer like DoliWamp, DoliMamp or DoliBuntu). // We first init "forced values" to nothing. -if (!isset($force_install_noedit)) $force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters -if (!isset($force_install_type)) $force_install_type = ''; -if (!isset($force_install_dbserver)) $force_install_dbserver = ''; -if (!isset($force_install_port)) $force_install_port = ''; -if (!isset($force_install_database)) $force_install_database = ''; -if (!isset($force_install_prefix)) $force_install_prefix = ''; -if (!isset($force_install_createdatabase)) $force_install_createdatabase = ''; -if (!isset($force_install_databaselogin)) $force_install_databaselogin = ''; -if (!isset($force_install_databasepass)) $force_install_databasepass = ''; -if (!isset($force_install_databaserootlogin)) $force_install_databaserootlogin = ''; -if (!isset($force_install_databaserootpass)) $force_install_databaserootpass = ''; +if (!isset($force_install_noedit)) { + $force_install_noedit = ''; // 1=To block vars specific to distrib, 2 to block all technical parameters +} +if (!isset($force_install_type)) { + $force_install_type = ''; +} +if (!isset($force_install_dbserver)) { + $force_install_dbserver = ''; +} +if (!isset($force_install_port)) { + $force_install_port = ''; +} +if (!isset($force_install_database)) { + $force_install_database = ''; +} +if (!isset($force_install_prefix)) { + $force_install_prefix = ''; +} +if (!isset($force_install_createdatabase)) { + $force_install_createdatabase = ''; +} +if (!isset($force_install_databaselogin)) { + $force_install_databaselogin = ''; +} +if (!isset($force_install_databasepass)) { + $force_install_databasepass = ''; +} +if (!isset($force_install_databaserootlogin)) { + $force_install_databaserootlogin = ''; +} +if (!isset($force_install_databaserootpass)) { + $force_install_databaserootpass = ''; +} // Now we load forced values from install.forced.php file. $useforcedwizard = false; $forcedfile = "./install.forced.php"; -if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php"; // Must be after inc.php +if ($conffile == "/etc/dolibarr/conf.php") { + $forcedfile = "/etc/dolibarr/install.forced.php"; // Must be after inc.php +} if (@file_exists($forcedfile)) { $useforcedwizard = true; include_once $forcedfile; @@ -75,8 +99,7 @@ session_start(); // To be able to keep info into session (used for not losing pa pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis'); // Test if we can run a first install process -if (!is_writable($conffile)) -{ +if (!is_writable($conffile)) { print $langs->trans("ConfFileIsNotWritable", $conffiletoshow); dolibarr_install_syslog("fileconf: config file is not writable", LOG_WARNING); dolibarr_install_syslog("- fileconf: end"); @@ -84,29 +107,30 @@ if (!is_writable($conffile)) exit; } -if (!empty($force_install_message)) -{ +if (!empty($force_install_message)) { print '

'.$langs->trans($force_install_message).'
'; /*print ''; + print ''; - print '
'.$langs->trans("ShowEditTechnicalParameters").'
'; - */ + print '
'.$langs->trans("ShowEditTechnicalParameters").'
'; + */ } ?>
- +
- + - - - + - + @@ -252,8 +282,7 @@ if (!empty($force_install_noedit)) { @@ -273,55 +302,86 @@ if (!empty($force_install_noedit)) { // Scan les drivers $dir = DOL_DOCUMENT_ROOT.'/core/db'; $handle = opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { - if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) - { + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) { $type = $reg[1]; - if ($type === 'DoliDB') continue; // Skip abstract class + if ($type === 'DoliDB') { + continue; // Skip abstract class + } $class = 'DoliDB'.ucfirst($type); include_once $dir."/".$file; - if ($type == 'sqlite') continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) - if ($type == 'sqlite3') continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) + if ($type == 'sqlite') { + continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) + } + if ($type == 'sqlite3') { + continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) + } // Version min of database $versionbasemin = explode('.', $class::VERSIONMIN); $note = '('.$class::LABEL.' >= '.$class::VERSIONMIN.')'; // Switch to mysql if mysqli is not present - if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql'; + if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) { + $defaultype = 'mysql'; + } // Show line into list - if ($type == 'mysql') { $testfunction = 'mysql_connect'; $testclass = ''; } - if ($type == 'mysqli') { $testfunction = 'mysqli_connect'; $testclass = ''; } - if ($type == 'pgsql') { $testfunction = 'pg_connect'; $testclass = ''; } - if ($type == 'mssql') { $testfunction = 'mssql_connect'; $testclass = ''; } - if ($type == 'sqlite') { $testfunction = ''; $testclass = 'PDO'; } - if ($type == 'sqlite3') { $testfunction = ''; $testclass = 'SQLite3'; } + if ($type == 'mysql') { + $testfunction = 'mysql_connect'; $testclass = ''; + } + if ($type == 'mysqli') { + $testfunction = 'mysqli_connect'; $testclass = ''; + } + if ($type == 'pgsql') { + $testfunction = 'pg_connect'; $testclass = ''; + } + if ($type == 'mssql') { + $testfunction = 'mssql_connect'; $testclass = ''; + } + if ($type == 'sqlite') { + $testfunction = ''; $testclass = 'PDO'; + } + if ($type == 'sqlite3') { + $testfunction = ''; $testclass = 'SQLite3'; + } $option .= ''; } } } ?> @@ -335,10 +395,12 @@ if (!empty($force_install_noedit)) { - + - + - + @@ -405,9 +477,9 @@ if (!empty($force_install_noedit)) { @@ -425,10 +499,14 @@ if (!empty($force_install_noedit)) { '; -// Date +// Date payment print ''; +// Date value +print ''; // Type print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); -print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "s.datep,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateValue", $_SERVER["PHP_SELF"], "s.datev,s.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder); @@ -421,6 +423,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) print '\n"; if (!$i) $totalarray['nbfield']++; + // Date value + print '\n"; + if (!$i) $totalarray['nbfield']++; + // Type print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 7a793b04a8c..81a1c167a02 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -20,7 +20,6 @@ use Luracast\Restler\RestException; - /** * API class for thirdparties * @@ -69,7 +68,7 @@ class Thirdparties extends DolibarrApi * Return an array with thirdparty informations * * @param int $id Id of third party to load - * @return Object Cleaned Societe object + * @return array|mixed Cleaned Societe object * * @throws RestException */ @@ -84,7 +83,7 @@ class Thirdparties extends DolibarrApi * Return an array with thirdparty informations * * @param string $email Email of third party to load - * @return Object Cleaned Societe object + * @return array|mixed Cleaned Societe object * * @url GET email/{email} * @@ -101,7 +100,7 @@ class Thirdparties extends DolibarrApi * Return an array with thirdparty informations * * @param string $barcode Barcode of third party to load - * @return Object Cleaned Societe object + * @return array|mixed Cleaned Societe object * * @url GET barcode/{barcode} * @@ -247,7 +246,7 @@ class Thirdparties extends DolibarrApi * * @param int $id Id of thirdparty to update * @param array $request_data Datas - * @return Object|boolean + * @return array|mixed|boolean */ public function put($id, $request_data = null) { @@ -1190,7 +1189,7 @@ class Thirdparties extends DolibarrApi * @param int $id ID of thirdparty * @param array $request_data Request data * - * @return object BankAccount of thirdparty + * @return array|mixed BankAccount of thirdparty * * @url POST {id}/bankaccounts */ @@ -1233,7 +1232,7 @@ class Thirdparties extends DolibarrApi * @param int $bankaccount_id ID of CompanyBankAccount * @param array $request_data Request data * - * @return object BankAccount of thirdparty + * @return array|mixed BankAccount of thirdparty * * @url PUT {id}/bankaccounts/{bankaccount_id} */ @@ -1389,7 +1388,7 @@ class Thirdparties extends DolibarrApi * @param int $id ID of thirdparty * @param string $site Site key * - * @return SocieteAccount[] + * @return array|mixed * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty * @@ -1461,7 +1460,7 @@ class Thirdparties extends DolibarrApi * @param int $id ID of thirdparty * @param array $request_data Request data * - * @return SocieteAccount + * @return array|mixed * * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 409 Conflict: A SocieteAccount entity (gateway) already exists for this company and site. @@ -1519,7 +1518,7 @@ class Thirdparties extends DolibarrApi * @param string $site Site key * @param array $request_data Request data * - * @return SocieteAccount + * @return array|mixed * * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 422 Unprocessable Entity: You must pass the site attribute in your request data ! @@ -1599,7 +1598,7 @@ class Thirdparties extends DolibarrApi * @param string $site Site key * @param array $request_data Request data * - * @return SocieteAccount + * @return array|mixed * * @throws RestException 401 Unauthorized: User does not have permission to read thirdparties * @throws RestException 404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty @@ -1733,7 +1732,7 @@ class Thirdparties extends DolibarrApi * Clean sensible object datas * * @param Object $object Object to clean - * @return Object Object with cleaned properties + * @return array|mixed Object with cleaned properties */ protected function _cleanObjectDatas($object) { @@ -1806,7 +1805,7 @@ class Thirdparties extends DolibarrApi * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) * @param string $email Email of third party (Warning, this can return several records) * @param string $ref_alias Name_alias of third party (Warning, this can return several records) - * @return Object cleaned Societe object + * @return array|mixed cleaned Societe object * * @throws RestException */ diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 69e8efd02e1..ff3108d2427 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -99,14 +99,8 @@ foreach ($objectwebsiteaccount->fields as $key => $val) } // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 5fc27d63a8c..d74f2fbdec3 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -165,14 +165,8 @@ $arrayfields = array( 'sp.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index a2293786924..961168221f6 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -686,7 +686,10 @@ function OpenDrawer(){ console.log("OpenDrawer call ajax url http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print"); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) echo "url: '".$conf->global->TAKEPOS_PRINT_SERVER."/printer/drawer.php',"; + else echo "url: 'http://".$conf->global->TAKEPOS_PRINT_SERVER.":8111/print',"; + ?> data: "opendrawer" }); } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index e68ecb8bc1d..d50fec76353 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -142,11 +142,11 @@ class Users extends DolibarrApi * Get properties of an user object * * @param int $id ID of user - * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed data without useless information + * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) + * @return array|mixed data without useless information * - * @throws RestException 401 Insufficient rights - * @throws RestException 404 User or group not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 User or group not found */ public function get($id, $includepermissions = 0) { @@ -177,13 +177,13 @@ class Users extends DolibarrApi * Get properties of an user object by login * * @param string $login Login of user - * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed data without useless information + * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) + * @return array|mixed Data without useless information * * @url GET login/{login} * - * @throws RestException 401 Insufficient rights - * @throws RestException 404 User or group not found + * @throws RestException 401 Insufficient rights + * @throws RestException 404 User or group not found */ public function getByLogin($login, $includepermissions = 0) { @@ -211,8 +211,8 @@ class Users extends DolibarrApi * Get properties of an user object by Email * * @param string $email Email of user - * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed data without useless information + * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) + * @return array|mixed Data without useless information * * @url GET email/{email} * @@ -314,11 +314,13 @@ class Users extends DolibarrApi /** * Update account * - * @param int $id Id of account to update - * @param array $request_data Datas - * @return array + * @param int $id Id of account to update + * @param array $request_data Datas + * @return array|mixed Record after update * - * @throws RestException + * @throws RestException 401 Not allowed + * @throws RestException 404 Not found + * @throws RestException 500 System error */ public function put($id, $request_data = null) { diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 6cda745056a..986db1b14bc 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -44,7 +44,7 @@ if ($object->fetch($id) < 1) { if ($cancel) $action = ''; if ($action) { - if ($action == 'edit') { + if ($action == 'update') { $object->ref = $ref; $object->label = $label; @@ -55,7 +55,7 @@ if ($action) { header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2)); exit(); } - } elseif ($action == 'update') { + } elseif ($action == 'update_value') { if ($objectval->fetch($valueid) > 0) { $objectval->ref = $ref; $objectval->value = GETPOST('value', 'alpha'); @@ -139,7 +139,12 @@ $h++; print dol_get_fiche_head($head, 'variant', $langs->trans('ProductAttributeName'), -1, 'generic'); if ($action == 'edit') { - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } @@ -232,7 +237,7 @@ if ($action == 'edit') { if ($action == 'edit_value') { print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 3a2936d0df5..24da596f3c2 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -227,7 +227,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $db->commit(); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } -} elseif ($valueid > 0) { +} elseif ($action === 'update' && $valueid > 0) { if ($prodcomb->fetch($valueid) < 0) { dol_print_error($db, $langs->trans('ErrorRecordNotFound')); exit(); diff --git a/htdocs/variants/create.php b/htdocs/variants/create.php index 84530e01cb5..e37548f39f3 100644 --- a/htdocs/variants/create.php +++ b/htdocs/variants/create.php @@ -29,7 +29,7 @@ $action = GETPOST('action', 'alpha'); * Actions */ -if ($action == 'create') { +if ($action == 'add') { if (empty($ref) || empty($label)) { setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } else { diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 7864c93243f..140351e7d21 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -122,7 +122,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -315,7 +315,7 @@ function getActionComm($authentication, $id) //Get extrafield values $actioncomm->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -454,7 +454,7 @@ function createActionComm($authentication, $actioncomm) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -551,7 +551,7 @@ function updateActionComm($authentication, $actioncomm) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 9abc7b6088f..6fc521a43c7 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -127,7 +127,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -319,7 +319,7 @@ function getContact($authentication, $id, $ref_ext) //Get extrafield values $contact->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -424,7 +424,7 @@ function createContact($authentication, $contact) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -671,7 +671,7 @@ function updateContact($authentication, $contact) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 62e8dc99d72..30c105d7192 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -120,7 +120,7 @@ $extrafield_line_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_line_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -224,7 +224,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -705,7 +705,7 @@ function createOrder($authentication, $order) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -743,7 +743,7 @@ function createOrder($authentication, $order) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -948,7 +948,7 @@ function updateOrder($authentication, $order) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index f723dcfd054..f285d245030 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -142,7 +142,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -436,7 +436,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' //Get extrafield values $product->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -563,7 +563,7 @@ function createProductOrService($authentication, $product) $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -719,7 +719,7 @@ function updateProductOrService($authentication, $product) $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -1090,7 +1090,7 @@ function getProductsForCategory($authentication, $id, $lang = '') //Get extrafield values $tmpproduct->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 9d4c93c9ce9..0817332c09f 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -169,7 +169,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -277,7 +277,7 @@ function createProject($authentication, $project) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -386,7 +386,7 @@ function getProject($authentication, $id = '', $ref = '') $extrafields->fetch_name_optionals_label($elementtype, true); //Get extrafield values - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { $project->fetch_optionals(); foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 3a1e911f510..5bde94cc0d5 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -130,7 +130,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -365,7 +365,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') //Get extrafield values $thirdparty->fetch_optionals(); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -481,7 +481,7 @@ function createThirdParty($authentication, $thirdparty) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -615,7 +615,7 @@ function updateThirdParty($authentication, $thirdparty) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -723,7 +723,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) $extrafieldsOptions = array(); $obj = $db->fetch_object($resql); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 6f7ed5c10aa..25cb2324412 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -193,7 +193,7 @@ $extrafield_array = null; if (is_array($extrafields) && count($extrafields) > 0) { $extrafield_array = array(); } -if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) +if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { @@ -599,7 +599,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) // fetch optionals attributes and labels $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); - if (is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) + if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key=>$label) { diff --git a/htdocs/zapier/hook_list.php b/htdocs/zapier/hook_list.php index 59432aea44b..93461517107 100644 --- a/htdocs/zapier/hook_list.php +++ b/htdocs/zapier/hook_list.php @@ -112,12 +112,8 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); } // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index fab2452c2b8..fcaa40e1fde 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -74,6 +74,10 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; +if (!empty($conf->global->MAILING_DELAY)) { + print 'A delay of '.((float) $conf->global->MAILING_DELAY * 1000000).' millisecond has been set between each email'."\n"; +} + if ($conf->global->MAILING_LIMIT_SENDBYCLI == '-1') {} $user = new User($db); @@ -332,7 +336,7 @@ if ($resql) { } if (!empty($conf->global->MAILING_DELAY)) { - sleep($conf->global->MAILING_DELAY); + usleep((float) $conf->global->MAILING_DELAY * 1000000); } } } else { diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index a937bdbd9f8..6222f7fcaf7 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -130,7 +130,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertNotNull($object, "Parsing of json result must not be null"); $this->assertEquals('200', $object['success']['code']); $this->api_key = $object['success']['token']; @@ -164,22 +164,22 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase print __METHOD__." Request GET url=".$url."\n"; $result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); - //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; + //print __METHOD__." result for get on unexisting user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(404, $object['error']['code']); + $this->assertNotNull($object, "Parsing of json result must not be null"); + $this->assertEquals(404, $object['error']['code'], 'Error code is not 404'); $url = $this->api_url.'/users/1?api_key='.$this->api_key; print __METHOD__." Request GET url=".$url."\n"; $result=getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); - //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; + print __METHOD__." result for get on an existing user: ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertNotNull($object, "Parsing of json result must not be null"); $this->assertEquals(1, $object['statut']); } @@ -190,7 +190,6 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase */ public function testRestCreateUser() { - // attemp to create without mandatory fields : $url = $this->api_url.'/users?api_key='.$this->api_key; $addheaders=array('Content-Type: application/json'); @@ -222,7 +221,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase $body = json_encode($bodyobj); print __METHOD__." Request POST url=".$url."\n"; $result=getURLContent($url, 'POST', $body, 1, $addheaders, array('http', 'https'), 2); - print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; + print __METHOD__." rclsesult code for creating user ".var_export($result, true)."\n"; print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; $this->assertEquals($result['curl_error_no'], ''); $resid=json_decode($result['content'], true);
@@ -116,7 +140,7 @@ if (!empty($force_install_message))
@@ -185,14 +209,14 @@ if (!empty($force_install_noedit)) { } ?>
+
- - + + + > trans("CheckToForceHttps"); ?> @@ -238,13 +266,15 @@ if (!empty($force_install_noedit)) {
+ id="db_name" + name="db_name" + value="" + > trans("DatabaseName"); ?> + id="db_host" + name="db_host" + value="" + > trans("ServerAddressDescription"); ?> @@ -347,13 +409,15 @@ if (!empty($force_install_noedit)) {
+ name="db_port" + id="db_port" + value="" + > trans("ServerPortDescription"); ?> @@ -362,26 +426,32 @@ if (!empty($force_install_noedit)) {
+ id="db_prefix" + name="db_prefix" + value="" + > trans("DatabasePrefixDescription"); ?>
- + id="db_create_database" + name="db_create_database" + + > trans("CheckToCreateDatabase"); ?> @@ -392,10 +462,12 @@ if (!empty($force_install_noedit)) { + id="db_user" + name="db_user" + value="" + > trans("AdminLogin"); ?> + > trans("AdminPassword"); ?> - + id="db_create_user" + name="db_create_user" + + > trans("CheckToCreateUser"); ?> @@ -451,11 +529,13 @@ if (!empty($force_install_noedit)) { 0 && !empty($force_install_databaserootlogin)) { print ' disabled'; } ?> + id="db_user_root" + name="db_user_root" + class="needroot" + value="" + 0 && !empty($force_install_databaserootlogin)) { + print ' disabled'; + } ?> > trans("DatabaseRootLoginDescription"); ?> @@ -473,25 +553,29 @@ if (!empty($force_install_noedit)) { " - 0 && !empty($force_install_databaserootpass)) { print ' disabled'; /* May be removed by javascript*/ } ?> + 0 && !empty($force_install_databaserootpass)) { + print ' disabled'; /* May be removed by javascript*/ + } ?> > trans("KeepEmptyIfNoPassword"); ?> @@ -535,7 +619,7 @@ jQuery(document).ready(function() { jQuery(".hideroot").show(); - jQuery(".needroot").removeAttr('disabled'); + jQuery(".needroot").removeAttr('disabled'); } else diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e391787479d..309d4d4b170 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -552,3 +552,6 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES -- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); + +ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index a36adb3a672..1b95444b3a1 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -35,6 +35,7 @@ create table llx_projet fk_statut integer DEFAULT 0 NOT NULL, -- open or close fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities opp_percent double(5,2), + fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose) date_close datetime DEFAULT NULL, fk_user_close integer DEFAULT NULL, note_private text, diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index d3346e344f4..e43dc33e700 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -132,7 +132,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); } } */ diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d74201b2f17..bd83272a3e7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -87,7 +87,6 @@ ShowPreview=Show preview ShowHideDetails=Show-Hide details PreviewNotAvailable=Preview not available ThemeCurrentlyActive=Theme currently active -CurrentTimeZone=TimeZone PHP (server) MySQLTimeZone=TimeZone MySql (database) TZHasNoEffect=Dates are stored and returned by database server as if they were kept as submitted string. The timezone has effect only when using the UNIX_TIMESTAMP function (that should not be used by Dolibarr, so database TZ should have no effect, even if changed after data was entered). Space=Space @@ -258,6 +257,7 @@ ReferencedPreferredPartners=Preferred Partners OtherResources=Other resources ExternalResources=External Resources SocialNetworks=Social Networks +SocialNetworkId=Social Network ID ForDocumentationSeeWiki=For user or developer documentation (Doc, FAQs...),
take a look at the Dolibarr Wiki:
%s ForAnswersSeeForum=For any other questions/help, you can use the Dolibarr forum:
%s HelpCenterDesc1=Here are some resources for getting help and support with Dolibarr. @@ -1985,11 +1985,12 @@ EMailHost=Host of email IMAP server MailboxSourceDirectory=Mailbox source directory MailboxTargetDirectory=Mailbox target directory EmailcollectorOperations=Operations to do by collector +EmailcollectorOperationsDesc=Operations are executed from top to bottom order MaxEmailCollectPerCollect=Max number of emails collected per collect CollectNow=Collect now ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ? -DateLastCollectResult=Date latest collect tried -DateLastcollectResultOk=Date latest collect successfull +DateLastCollectResult=Date of latest collect try +DateLastcollectResultOk=Date of latest collect success LastResult=Latest result EmailCollectorConfirmCollectTitle=Email collect confirmation EmailCollectorConfirmCollect=Do you want to run the collection for this collector now ? @@ -2007,7 +2008,7 @@ WithDolTrackingID=Message from a conversation initiated by a first email sent fr WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr WithDolTrackingIDInMsgId=Message sent from Dolibarr WithoutDolTrackingIDInMsgId=Message NOT sent from Dolibarr -CreateCandidature=Create candidature +CreateCandidature=Create job application FormatZip=Zip MainMenuCode=Menu entry code (mainmenu) ECMAutoTree=Show automatic ECM tree diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 18ee01eb3bb..1afeb6e3727 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -140,7 +140,7 @@ ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fisc ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. -CalcModeDebt=Analysis of known recorded invoices even if they are not yet accounted in ledger. +CalcModeDebt=Analysis of known recorded documents even if they are not yet accounted in ledger. CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger. CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table. CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s @@ -154,9 +154,9 @@ AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary AnnualByCompanies=Balance of income and expenses, by predefined groups of account AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode %sClaims-Debts%s said Commitment accounting. AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode %sIncomes-Expenses%s said cash accounting. -SeeReportInInputOutputMode=See %sanalysis of payments%s for a calculation on actual payments made even if they are not yet accounted in Ledger. -SeeReportInDueDebtMode=See %sanalysis of invoices%s for a calculation based on known recorded invoices even if they are not yet accounted in Ledger. -SeeReportInBookkeepingMode=See %sBookeeping report%s for a calculation on Bookkeeping Ledger table +SeeReportInInputOutputMode=See %sanalysis of payments%s for a calculation based on recorded payments made even if they are not yet accounted in Ledger +SeeReportInDueDebtMode=See %sanalysis of recorded documents%s for a calculation based on known recorded documents even if they are not yet accounted in Ledger +SeeReportInBookkeepingMode=See %sanalysis of bookeeping ledger table%s for a report based on Bookkeeping Ledger table RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.
- It is based on the billing date of invoices and on the due date for expenses or tax payments. For salaries defined with Salary module, the value date of payment is used. RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation. diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 056bec48fe9..5634905da6e 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -254,7 +254,8 @@ ErrorNotAvailableWithThisDistribution=Not available with this distribution ErrorPublicInterfaceNotEnabled=Public interface was not enabled ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page - +ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation + # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 906394eb9c1..a7cfde68ae7 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -92,6 +92,7 @@ MailingModuleDescEmailsFromUser=Emails input by user MailingModuleDescDolibarrUsers=Users with Emails MailingModuleDescThirdPartiesByCategories=Third parties (by categories) SendingFromWebInterfaceIsNotAllowed=Sending from web interface is not allowed. +EmailCollectorFilterDesc=All filters must match to have an email being collected # Libelle des modules de liste de destinataires mailing LineInFile=Line %s in file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c2eae911053..7075df90783 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -28,6 +28,7 @@ NoTemplateDefined=No template available for this email type AvailableVariables=Available substitution variables NoTranslation=No translation Translation=Translation +CurrentTimeZone=TimeZone PHP (server) EmptySearchString=Enter non empty search criterias EnterADateCriteria=Enter a date criteria NoRecordFound=No record found @@ -436,6 +437,7 @@ RemainToPay=Remain to pay Module=Module/Application Modules=Modules/Applications Option=Option +Filters=Filters List=List FullList=Full list FullConversation=Full conversation diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 82be9955e0f..01e51e5e96f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -417,7 +417,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl // Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions) if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || - in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check'))) + in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check'))) { if (!GETPOSTISSET('token')) { if (GETPOST('uploadform', 'int')) { @@ -2802,7 +2802,7 @@ if (!function_exists("llxFooter")) if (!empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage; if (!empty($page) && $page > 0) $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page; - if (!empty($limit) && $limit != $conf->limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit; + if (!empty($limit) && $limit != $conf->liste_limit) $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit; unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); unset($_SESSION['lastsearch_page_'.$relativepathstring]); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 2ed8e4577fa..7d09667bd22 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -129,7 +129,7 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = dol_eval($val['visible'], 1); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index f7406692f8d..189161712d5 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1514,6 +1514,7 @@ class Products extends DolibarrApi foreach ($combinations as $key => $combination) { $prodc2vp = new ProductCombination2ValuePair($this->db); $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); + $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); } return $combinations; @@ -1547,6 +1548,7 @@ class Products extends DolibarrApi foreach ($combinations as $key => $combination) { $prodc2vp = new ProductCombination2ValuePair($this->db); $combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id); + $combinations[$key] = $this->_cleanObjectDatas($combinations[$key]); } return $combinations; @@ -1754,7 +1756,7 @@ class Products extends DolibarrApi unset($object->libelle); unset($object->product_id_already_linked); unset($object->reputations); - + unset($object->db); unset($object->name); unset($object->firstname); unset($object->lastname); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 25051baa9c3..c40ffd4e0a9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1247,6 +1247,15 @@ class Product extends CommonObject } } + // Remove extrafields + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); + } + } + // Delete product if (!$error) { $sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product"; @@ -1274,16 +1283,6 @@ class Product extends CommonObject } } - // Remove extrafields - if (!$error) - { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } - } - if (!$error) { $this->db->commit(); return 1; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index a23846c3e08..2429a4c09c5 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -981,6 +981,10 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $origin = new User($this->db); break; + case 'reception': + require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; + $origin = new Reception($this->db); + break; default: if ($origintype) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9e15a580358..24ac982896e 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -129,7 +129,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); } } $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 8b49aa2e0c2..4f8fbb8d865 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -143,7 +143,7 @@ if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafi foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) { if (!empty($extrafields->attributes['projet_task']['list'][$key])) - $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs($extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key])); + $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key])); } } $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ba1840c4101..52e105c1443 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -119,14 +119,8 @@ if ($object->usage_bill_time) { } // Extra fields -if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $arrayfields = dol_sort_array($arrayfields, 'position'); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index b9d1a19c629..1951df8c0e1 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -136,14 +136,8 @@ $arrayfields = array( //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index c18ec6e4434..cb92be401c1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -869,14 +869,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1)); $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time)); // Extra fields - if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) - { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } - } + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $arrayfields = dol_sort_array($arrayfields, 'position'); $param = ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e175437c0cc..ec08c7ba94a 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -110,15 +110,10 @@ $arrayfields = array( 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_RECEPTION))) ); + // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index ccf061b50b7..c1b67edaa0e 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -121,14 +121,8 @@ $arrayfields = array( ), ); // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) -{ - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } -} +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; + $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 26477900be2..b8a0ba69ef7 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -154,9 +154,7 @@ if (empty($reshook)) // Mass actions $objectclass = 'PaymentSalary'; $objectlabel = 'SalariesPayments'; - $permissiontoread = $user->rights->salaries->read; - $permissiontodelete = $user->rights->salaries->delete; - $uploaddir = $conf->bom->dir_output; + $uploaddir = $conf->salaries->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // Validate records @@ -308,7 +306,7 @@ print '
'; print '
'; print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -317,6 +315,9 @@ print '
'; print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print '
'; +print ''; $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16); @@ -352,7 +353,8 @@ print '
'.dol_print_date($db->jdate($obj->datep), 'day')."'.dol_print_date($db->jdate($obj->datev), 'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'