@@ -825,10 +825,10 @@ |
||
| 825 | 825 | $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; |
| 826 | 826 | } elseif ($key == 't.credit' || $key == 't.debit') { |
| 827 | 827 | $sqlwhere[] = natural_search($key, $value, 1, 1); |
| 828 | - } elseif ($key == 't.reconciled_option') { |
|
| 829 | - $sqlwhere[] = 't.lettering_code IS NULL'; |
|
| 830 | - } elseif ($key == 't.code_journal' && !empty($value)) { |
|
| 831 | - $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); |
|
| 828 | + } elseif ($key == 't.reconciled_option') { |
|
| 829 | + $sqlwhere[] = 't.lettering_code IS NULL'; |
|
| 830 | + } elseif ($key == 't.code_journal' && !empty($value)) { |
|
| 831 | + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); |
|
| 832 | 832 | } else { |
| 833 | 833 | $sqlwhere[] = natural_search($key, $value, 0, 1); |
| 834 | 834 | } |
@@ -537,17 +537,17 @@ discard block |
||
| 537 | 537 | $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); |
| 538 | 538 | |
| 539 | 539 | // Credit invoice - invert sens |
| 540 | - if ($data->montant < 0) { |
|
| 541 | - if ($data->sens == 'C') { |
|
| 542 | - $Tab['sens'] = 'D'; |
|
| 543 | - } else { |
|
| 544 | - $Tab['sens'] = 'C'; |
|
| 545 | - } |
|
| 546 | - $Tab['signe_montant'] = '-'; |
|
| 547 | - } else { |
|
| 548 | - $Tab['sens'] = $data->sens; // C or D |
|
| 549 | - $Tab['signe_montant'] = '+'; |
|
| 550 | - } |
|
| 540 | + if ($data->montant < 0) { |
|
| 541 | + if ($data->sens == 'C') { |
|
| 542 | + $Tab['sens'] = 'D'; |
|
| 543 | + } else { |
|
| 544 | + $Tab['sens'] = 'C'; |
|
| 545 | + } |
|
| 546 | + $Tab['signe_montant'] = '-'; |
|
| 547 | + } else { |
|
| 548 | + $Tab['sens'] = $data->sens; // C or D |
|
| 549 | + $Tab['signe_montant'] = '+'; |
|
| 550 | + } |
|
| 551 | 551 | |
| 552 | 552 | // The amount must be in centimes without decimal points. |
| 553 | 553 | $Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT); |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | foreach ($objectLines as $line) { |
| 847 | 847 | if ($line->debit == 0 && $line->credit == 0) { |
| 848 | - unset($array[$line]); |
|
| 849 | - } else { |
|
| 848 | + unset($array[$line]); |
|
| 849 | + } else { |
|
| 850 | 850 | $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); |
| 851 | 851 | $date_document = dol_print_date($line->doc_date, '%Y%m%d'); |
| 852 | 852 | $date_lettering = dol_print_date($line->date_lettering, '%Y%m%d'); |
@@ -952,55 +952,55 @@ discard block |
||
| 952 | 952 | $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); |
| 953 | 953 | |
| 954 | 954 | // FEC:JournalCode |
| 955 | - print $line->code_journal . $separator; |
|
| 955 | + print $line->code_journal.$separator; |
|
| 956 | 956 | |
| 957 | 957 | // FEC:JournalLib |
| 958 | - print $line->journal_label . $separator; |
|
| 958 | + print $line->journal_label.$separator; |
|
| 959 | 959 | |
| 960 | 960 | // FEC:EcritureNum |
| 961 | - print $line->piece_num . $separator; |
|
| 961 | + print $line->piece_num.$separator; |
|
| 962 | 962 | |
| 963 | 963 | // FEC:EcritureDate |
| 964 | - print $date_creation . $separator; |
|
| 964 | + print $date_creation.$separator; |
|
| 965 | 965 | |
| 966 | 966 | // FEC:CompteNum |
| 967 | - print $line->numero_compte . $separator; |
|
| 967 | + print $line->numero_compte.$separator; |
|
| 968 | 968 | |
| 969 | 969 | // FEC:CompteLib |
| 970 | - print dol_string_unaccent($line->label_compte) . $separator; |
|
| 970 | + print dol_string_unaccent($line->label_compte).$separator; |
|
| 971 | 971 | |
| 972 | 972 | // FEC:CompAuxNum |
| 973 | - print $line->subledger_account . $separator; |
|
| 973 | + print $line->subledger_account.$separator; |
|
| 974 | 974 | |
| 975 | 975 | // FEC:CompAuxLib |
| 976 | - print dol_string_unaccent($line->subledger_label) . $separator; |
|
| 976 | + print dol_string_unaccent($line->subledger_label).$separator; |
|
| 977 | 977 | |
| 978 | 978 | // FEC:PieceRef |
| 979 | - print $line->doc_ref . $separator; |
|
| 979 | + print $line->doc_ref.$separator; |
|
| 980 | 980 | |
| 981 | 981 | // FEC:PieceDate |
| 982 | - print $date_document . $separator; |
|
| 982 | + print $date_document.$separator; |
|
| 983 | 983 | |
| 984 | 984 | // FEC:EcritureLib |
| 985 | - print dol_string_unaccent($line->label_operation) . $separator; |
|
| 985 | + print dol_string_unaccent($line->label_operation).$separator; |
|
| 986 | 986 | |
| 987 | 987 | // FEC:Debit |
| 988 | - print price2fec($line->debit) . $separator; |
|
| 988 | + print price2fec($line->debit).$separator; |
|
| 989 | 989 | |
| 990 | 990 | // FEC:Credit |
| 991 | - print price2fec($line->credit) . $separator; |
|
| 991 | + print price2fec($line->credit).$separator; |
|
| 992 | 992 | |
| 993 | 993 | // FEC:EcritureLet |
| 994 | - print $line->lettering_code . $separator; |
|
| 994 | + print $line->lettering_code.$separator; |
|
| 995 | 995 | |
| 996 | 996 | // FEC:DateLet |
| 997 | - print $date_lettering . $separator; |
|
| 997 | + print $date_lettering.$separator; |
|
| 998 | 998 | |
| 999 | 999 | // FEC:ValidDate |
| 1000 | - print $date_validation . $separator; |
|
| 1000 | + print $date_validation.$separator; |
|
| 1001 | 1001 | |
| 1002 | 1002 | // FEC:Montantdevise |
| 1003 | - print $line->multicurrency_amount . $separator; |
|
| 1003 | + print $line->multicurrency_amount.$separator; |
|
| 1004 | 1004 | |
| 1005 | 1005 | // FEC:Idevise |
| 1006 | 1006 | print $line->multicurrency_code; |
@@ -1634,9 +1634,9 @@ discard block |
||
| 1634 | 1634 | ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { |
| 1635 | 1635 | if ($line->doc_type == 'customer_invoice') { |
| 1636 | 1636 | // Get new customer invoice ref and company name |
| 1637 | - $sql = 'SELECT f.facnumber, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; |
|
| 1638 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; |
|
| 1639 | - $sql .= ' WHERE f.rowid = ' . $line->fk_doc; |
|
| 1637 | + $sql = 'SELECT f.facnumber, s.nom FROM '.MAIN_DB_PREFIX.'facture as f'; |
|
| 1638 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON f.fk_soc = s.rowid'; |
|
| 1639 | + $sql .= ' WHERE f.rowid = '.$line->fk_doc; |
|
| 1640 | 1640 | $resql = $this->db->query($sql); |
| 1641 | 1641 | if ($resql) { |
| 1642 | 1642 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -1648,9 +1648,9 @@ discard block |
||
| 1648 | 1648 | } |
| 1649 | 1649 | } else { |
| 1650 | 1650 | // Get new supplier invoice ref and company name |
| 1651 | - $sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff'; |
|
| 1652 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid'; |
|
| 1653 | - $sql .= ' WHERE ff.rowid = ' . $line->fk_doc; |
|
| 1651 | + $sql = 'SELECT ff.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; |
|
| 1652 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON ff.fk_soc = s.rowid'; |
|
| 1653 | + $sql .= ' WHERE ff.rowid = '.$line->fk_doc; |
|
| 1654 | 1654 | $resql = $this->db->query($sql); |
| 1655 | 1655 | if ($resql) { |
| 1656 | 1656 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -1672,28 +1672,28 @@ discard block |
||
| 1672 | 1672 | } |
| 1673 | 1673 | } |
| 1674 | 1674 | |
| 1675 | - print $line->id . $this->separator; |
|
| 1676 | - print $date . $this->separator; |
|
| 1677 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
| 1675 | + print $line->id.$this->separator; |
|
| 1676 | + print $date.$this->separator; |
|
| 1677 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
| 1678 | 1678 | |
| 1679 | 1679 | if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
| 1680 | - print length_accountg($line->subledger_account) . $this->separator; |
|
| 1680 | + print length_accountg($line->subledger_account).$this->separator; |
|
| 1681 | 1681 | } else { |
| 1682 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
| 1682 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
| 1683 | 1683 | } |
| 1684 | 1684 | //Libellé Auto |
| 1685 | 1685 | print $this->separator; |
| 1686 | 1686 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
| 1687 | 1687 | //Libellé manuel |
| 1688 | - print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator; |
|
| 1688 | + print dol_trunc(str_replace('"', '', $invoice_ref.(!empty($company_name) ? ' - ' : '').$company_name), 40, 'right', 'UTF-8', 1).$this->separator; |
|
| 1689 | 1689 | //Numéro de pièce |
| 1690 | - print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator; |
|
| 1690 | + print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).$this->separator; |
|
| 1691 | 1691 | //Devise |
| 1692 | - print 'EUR' . $this->separator; |
|
| 1692 | + print 'EUR'.$this->separator; |
|
| 1693 | 1693 | //Montant |
| 1694 | - print price2num(abs($line->montant)) . $this->separator; |
|
| 1694 | + print price2num(abs($line->montant)).$this->separator; |
|
| 1695 | 1695 | //Sens |
| 1696 | - print $line->sens . $this->separator; |
|
| 1696 | + print $line->sens.$this->separator; |
|
| 1697 | 1697 | //Code lettrage |
| 1698 | 1698 | print $this->separator; |
| 1699 | 1699 | //Date Echéance |
@@ -1717,21 +1717,21 @@ discard block |
||
| 1717 | 1717 | foreach ($objectLines as $line) { |
| 1718 | 1718 | $date = dol_print_date($line->doc_date, '%d%m%Y'); |
| 1719 | 1719 | |
| 1720 | - print $line->id . $this->separator; |
|
| 1721 | - print $date . $this->separator; |
|
| 1722 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
| 1723 | - if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
|
| 1724 | - print length_accountg($line->subledger_account) . $this->separator; |
|
| 1720 | + print $line->id.$this->separator; |
|
| 1721 | + print $date.$this->separator; |
|
| 1722 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
| 1723 | + if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
|
| 1724 | + print length_accountg($line->subledger_account).$this->separator; |
|
| 1725 | 1725 | } else { |
| 1726 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
| 1726 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
| 1727 | 1727 | } |
| 1728 | 1728 | print $this->separator; |
| 1729 | 1729 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
| 1730 | - print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"' . $this->separator; |
|
| 1730 | + print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"'.$this->separator; |
|
| 1731 | 1731 | print '"'.dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).'"'.$this->separator; |
| 1732 | 1732 | print price2num($line->montant).$this->separator; |
| 1733 | 1733 | print $line->sens.$this->separator; |
| 1734 | - print $date . $this->separator; |
|
| 1734 | + print $date.$this->separator; |
|
| 1735 | 1735 | print $this->separator; |
| 1736 | 1736 | print $this->separator; |
| 1737 | 1737 | print 'EUR'; |
@@ -479,8 +479,9 @@ discard block |
||
| 479 | 479 | $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd |
| 480 | 480 | foreach ($TData as $data) { |
| 481 | 481 | $code_compta = $data->numero_compte; |
| 482 | - if (!empty($data->subledger_account)) |
|
| 483 | - $code_compta = $data->subledger_account; |
|
| 482 | + if (!empty($data->subledger_account)) { |
|
| 483 | + $code_compta = $data->subledger_account; |
|
| 484 | + } |
|
| 484 | 485 | |
| 485 | 486 | $Tab = array(); |
| 486 | 487 | $Tab['num_ecriture'] = str_pad($i, 5); |
@@ -520,8 +521,9 @@ discard block |
||
| 520 | 521 | // $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy |
| 521 | 522 | foreach ($TData as $data) { |
| 522 | 523 | $code_compta = $data->numero_compte; |
| 523 | - if (!empty($data->subledger_account)) |
|
| 524 | - $code_compta = $data->subledger_account; |
|
| 524 | + if (!empty($data->subledger_account)) { |
|
| 525 | + $code_compta = $data->subledger_account; |
|
| 526 | + } |
|
| 525 | 527 | |
| 526 | 528 | $Tab = array(); |
| 527 | 529 | $Tab['type_ligne'] = 'M'; |
@@ -614,8 +616,9 @@ discard block |
||
| 614 | 616 | //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy |
| 615 | 617 | foreach ($TData as $data) { |
| 616 | 618 | $code_compta = $data->numero_compte; |
| 617 | - if (!empty($data->subledger_account)) |
|
| 618 | - $code_compta = $data->subledger_account; |
|
| 619 | + if (!empty($data->subledger_account)) { |
|
| 620 | + $code_compta = $data->subledger_account; |
|
| 621 | + } |
|
| 619 | 622 | |
| 620 | 623 | $Tab = array(); |
| 621 | 624 | //$Tab['type_ligne'] = 'M'; |
@@ -1587,8 +1590,9 @@ discard block |
||
| 1587 | 1590 | |
| 1588 | 1591 | print self::trunc($line->code_journal, 6).$separator; //Journal code |
| 1589 | 1592 | |
| 1590 | - if (!empty($line->subledger_account)) $account = $line->subledger_account; |
|
| 1591 | - else { |
|
| 1593 | + if (!empty($line->subledger_account)) { |
|
| 1594 | + $account = $line->subledger_account; |
|
| 1595 | + } else { |
|
| 1592 | 1596 | $account = $line->numero_compte; |
| 1593 | 1597 | } |
| 1594 | 1598 | print self::trunc($account, 15).$separator; //Account number |
@@ -546,15 +546,15 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | // Is it a break ? |
| 548 | 548 | if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { |
| 549 | - if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { |
|
| 550 | - $colnumber = 3; |
|
| 551 | - $colnumberend = 7; |
|
| 552 | - } else { |
|
| 553 | - $colnumber = 4; |
|
| 554 | - $colnumberend = 7; |
|
| 555 | - } |
|
| 556 | - $colspan = $totalarray['nbfield'] - $colnumber; |
|
| 557 | - $colspanend = $totalarray['nbfield'] - $colnumberend; |
|
| 549 | + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { |
|
| 550 | + $colnumber = 3; |
|
| 551 | + $colnumberend = 7; |
|
| 552 | + } else { |
|
| 553 | + $colnumber = 4; |
|
| 554 | + $colnumberend = 7; |
|
| 555 | + } |
|
| 556 | + $colspan = $totalarray['nbfield'] - $colnumber; |
|
| 557 | + $colspanend = $totalarray['nbfield'] - $colnumberend; |
|
| 558 | 558 | // Show a subtotal by accounting account |
| 559 | 559 | if (isset($displayed_account_number)) { |
| 560 | 560 | print '<tr class="liste_total">'; |
@@ -763,11 +763,11 @@ discard block |
||
| 763 | 763 | |
| 764 | 764 | // Show sub-total of last shown account |
| 765 | 765 | if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { |
| 766 | - $colnumber = 3; |
|
| 767 | - $colnumberend = 7; |
|
| 766 | + $colnumber = 3; |
|
| 767 | + $colnumberend = 7; |
|
| 768 | 768 | } else { |
| 769 | - $colnumber = 4; |
|
| 770 | - $colnumberend = 7; |
|
| 769 | + $colnumber = 4; |
|
| 770 | + $colnumberend = 7; |
|
| 771 | 771 | } |
| 772 | 772 | $colspan = $totalarray['nbfield'] - $colnumber; |
| 773 | 773 | $colspanend = $totalarray['nbfield'] - $colnumberend; |
@@ -81,8 +81,12 @@ discard block |
||
| 81 | 81 | $offset = $limit * $page; |
| 82 | 82 | $pageprev = $page - 1; |
| 83 | 83 | $pagenext = $page + 1; |
| 84 | -if ($sortorder == "") $sortorder = "ASC"; |
|
| 85 | -if ($sortfield == "") $sortfield = "t.doc_date,t.rowid"; |
|
| 84 | +if ($sortorder == "") { |
|
| 85 | + $sortorder = "ASC"; |
|
| 86 | +} |
|
| 87 | +if ($sortfield == "") { |
|
| 88 | + $sortfield = "t.doc_date,t.rowid"; |
|
| 89 | +} |
|
| 86 | 90 | |
| 87 | 91 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 88 | 92 | $object = new BookKeeping($db); |
@@ -105,7 +109,10 @@ discard block |
||
| 105 | 109 | } else { |
| 106 | 110 | $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); |
| 107 | 111 | $year_start = dol_print_date(dol_now(), '%Y'); |
| 108 | - if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year |
|
| 112 | + if (dol_print_date(dol_now(), '%m') < $month_start) { |
|
| 113 | + $year_start--; |
|
| 114 | + } |
|
| 115 | + // If current month is lower that starting fiscal month, we start last year |
|
| 109 | 116 | $year_end = $year_start + 1; |
| 110 | 117 | $month_end = $month_start - 1; |
| 111 | 118 | if ($month_end < 1) |
@@ -130,7 +137,9 @@ discard block |
||
| 130 | 137 | 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), |
| 131 | 138 | ); |
| 132 | 139 | |
| 133 | -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); |
|
| 140 | +if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { |
|
| 141 | + unset($arrayfields['t.lettering_code']); |
|
| 142 | +} |
|
| 134 | 143 | |
| 135 | 144 | if ($search_date_start && empty($search_date_startyear)) { |
| 136 | 145 | $tmparray = dol_getdate($search_date_start); |
@@ -154,15 +163,19 @@ discard block |
||
| 154 | 163 | |
| 155 | 164 | $parameters = array('socid'=>$socid); |
| 156 | 165 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
| 157 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 166 | +if ($reshook < 0) { |
|
| 167 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 168 | +} |
|
| 158 | 169 | |
| 159 | 170 | if (empty($reshook)) |
| 160 | 171 | { |
| 161 | 172 | include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
| 162 | 173 | |
| 163 | - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers |
|
| 174 | + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
| 175 | + // All tests are required to be compatible with all browsers |
|
| 164 | 176 | { |
| 165 | 177 | $search_doc_date = ''; |
| 178 | + } |
|
| 166 | 179 | $search_accountancy_code = ''; |
| 167 | 180 | $search_accountancy_code_start = ''; |
| 168 | 181 | $search_accountancy_code_end = ''; |
@@ -391,7 +404,9 @@ discard block |
||
| 391 | 404 | print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
| 392 | 405 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
| 393 | 406 | print '<input type="hidden" name="action" value="list">'; |
| 394 | -if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 407 | +if ($optioncss != '') { |
|
| 408 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 409 | +} |
|
| 395 | 410 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
| 396 | 411 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
| 397 | 412 | print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
@@ -407,8 +422,12 @@ discard block |
||
| 407 | 422 | $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); |
| 408 | 423 | } |
| 409 | 424 | |
| 410 | -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
| 411 | -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
| 425 | +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
| 426 | + $param .= '&contextpage='.urlencode($contextpage); |
|
| 427 | +} |
|
| 428 | +if ($limit > 0 && $limit != $conf->liste_limit) { |
|
| 429 | + $param .= '&limit='.urlencode($limit); |
|
| 430 | +} |
|
| 412 | 431 | |
| 413 | 432 | print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); |
| 414 | 433 | |
@@ -416,11 +435,16 @@ discard block |
||
| 416 | 435 | |
| 417 | 436 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
| 418 | 437 | $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields |
| 419 | -if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
|
| 438 | +if ($massactionbutton) { |
|
| 439 | + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
|
| 440 | +} |
|
| 420 | 441 | |
| 421 | 442 | // Reverse sort order |
| 422 | -if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc"; |
|
| 423 | -else $sortorder = "desc"; |
|
| 443 | +if (preg_match('/^asc/i', $sortorder)) { |
|
| 444 | + $sortorder = "asc"; |
|
| 445 | +} else { |
|
| 446 | + $sortorder = "desc"; |
|
| 447 | +} |
|
| 424 | 448 | |
| 425 | 449 | $moreforfilter = ''; |
| 426 | 450 | |
@@ -437,8 +461,11 @@ discard block |
||
| 437 | 461 | |
| 438 | 462 | $parameters = array(); |
| 439 | 463 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
| 440 | -if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; |
|
| 441 | -else $moreforfilter = $hookmanager->resPrint; |
|
| 464 | +if (empty($reshook)) { |
|
| 465 | + $moreforfilter .= $hookmanager->resPrint; |
|
| 466 | +} else { |
|
| 467 | + $moreforfilter = $hookmanager->resPrint; |
|
| 468 | +} |
|
| 442 | 469 | |
| 443 | 470 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
| 444 | 471 | print $moreforfilter; |
@@ -508,14 +535,30 @@ discard block |
||
| 508 | 535 | print "</tr>\n"; |
| 509 | 536 | |
| 510 | 537 | print '<tr class="liste_titre">'; |
| 511 | -if (!empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 512 | -if (!empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 513 | -if (!empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); |
|
| 514 | -if (!empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); |
|
| 515 | -if (!empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); |
|
| 516 | -if (!empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); |
|
| 517 | -if (!empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); |
|
| 518 | -if (!empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 538 | +if (!empty($arrayfields['t.code_journal']['checked'])) { |
|
| 539 | + print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 540 | +} |
|
| 541 | +if (!empty($arrayfields['t.doc_date']['checked'])) { |
|
| 542 | + print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 543 | +} |
|
| 544 | +if (!empty($arrayfields['t.piece_num']['checked'])) { |
|
| 545 | + print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder); |
|
| 546 | +} |
|
| 547 | +if (!empty($arrayfields['t.doc_ref']['checked'])) { |
|
| 548 | + print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); |
|
| 549 | +} |
|
| 550 | +if (!empty($arrayfields['t.label_operation']['checked'])) { |
|
| 551 | + print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); |
|
| 552 | +} |
|
| 553 | +if (!empty($arrayfields['t.debit']['checked'])) { |
|
| 554 | + print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); |
|
| 555 | +} |
|
| 556 | +if (!empty($arrayfields['t.credit']['checked'])) { |
|
| 557 | + print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); |
|
| 558 | +} |
|
| 559 | +if (!empty($arrayfields['t.lettering_code']['checked'])) { |
|
| 560 | + print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); |
|
| 561 | +} |
|
| 519 | 562 | // Hook fields |
| 520 | 563 | $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); |
| 521 | 564 | $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook |
@@ -591,7 +634,9 @@ discard block |
||
| 591 | 634 | } else { |
| 592 | 635 | // Should not happen: subledger account must be null or a non empty value |
| 593 | 636 | print '<span class="error">'.$langs->trans("Unknown"); |
| 594 | - if ($line->subledger_label) print ' ('.$line->subledger_label.')'; |
|
| 637 | + if ($line->subledger_label) { |
|
| 638 | + print ' ('.$line->subledger_label.')'; |
|
| 639 | + } |
|
| 595 | 640 | $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined'; |
| 596 | 641 | print $form->textwithpicto('', $htmltext); |
| 597 | 642 | print '</span>'; |
@@ -616,14 +661,18 @@ discard block |
||
| 616 | 661 | $result = $accountingjournal->fetch('', $line->code_journal); |
| 617 | 662 | $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); |
| 618 | 663 | print '<td class="center">'.$journaltoshow.'</td>'; |
| 619 | - if (!$i) $totalarray['nbfield']++; |
|
| 664 | + if (!$i) { |
|
| 665 | + $totalarray['nbfield']++; |
|
| 666 | + } |
|
| 620 | 667 | } |
| 621 | 668 | |
| 622 | 669 | // Document date |
| 623 | 670 | if (!empty($arrayfields['t.doc_date']['checked'])) |
| 624 | 671 | { |
| 625 | 672 | print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>'; |
| 626 | - if (!$i) $totalarray['nbfield']++; |
|
| 673 | + if (!$i) { |
|
| 674 | + $totalarray['nbfield']++; |
|
| 675 | + } |
|
| 627 | 676 | } |
| 628 | 677 | |
| 629 | 678 | // Piece number |
@@ -634,7 +683,9 @@ discard block |
||
| 634 | 683 | $object->piece_num = $line->piece_num; |
| 635 | 684 | print $object->getNomUrl(1, '', 0, '', 1); |
| 636 | 685 | print '</td>'; |
| 637 | - if (!$i) $totalarray['nbfield']++; |
|
| 686 | + if (!$i) { |
|
| 687 | + $totalarray['nbfield']++; |
|
| 688 | + } |
|
| 638 | 689 | } |
| 639 | 690 | |
| 640 | 691 | // Document ref |
@@ -699,7 +750,9 @@ discard block |
||
| 699 | 750 | print '</td></tr></table>'; |
| 700 | 751 | |
| 701 | 752 | print "</td>\n"; |
| 702 | - if (!$i) $totalarray['nbfield']++; |
|
| 753 | + if (!$i) { |
|
| 754 | + $totalarray['nbfield']++; |
|
| 755 | + } |
|
| 703 | 756 | } |
| 704 | 757 | |
| 705 | 758 | // Label operation |
@@ -707,23 +760,33 @@ discard block |
||
| 707 | 760 | // Affiche un lien vers la facture client/fournisseur |
| 708 | 761 | $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); |
| 709 | 762 | print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>'; |
| 710 | - if (!$i) $totalarray['nbfield']++; |
|
| 763 | + if (!$i) { |
|
| 764 | + $totalarray['nbfield']++; |
|
| 765 | + } |
|
| 711 | 766 | } |
| 712 | 767 | |
| 713 | 768 | // Amount debit |
| 714 | 769 | if (!empty($arrayfields['t.debit']['checked'])) |
| 715 | 770 | { |
| 716 | 771 | print '<td class="nowrap right">'.($line->debit ? price($line->debit) : '').'</td>'; |
| 717 | - if (!$i) $totalarray['nbfield']++; |
|
| 718 | - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; |
|
| 772 | + if (!$i) { |
|
| 773 | + $totalarray['nbfield']++; |
|
| 774 | + } |
|
| 775 | + if (!$i) { |
|
| 776 | + $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit'; |
|
| 777 | + } |
|
| 719 | 778 | $totalarray['val']['totaldebit'] += $line->debit; |
| 720 | 779 | } |
| 721 | 780 | |
| 722 | 781 | // Amount credit |
| 723 | 782 | if (!empty($arrayfields['t.credit']['checked'])) { |
| 724 | 783 | print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>'; |
| 725 | - if (!$i) $totalarray['nbfield']++; |
|
| 726 | - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; |
|
| 784 | + if (!$i) { |
|
| 785 | + $totalarray['nbfield']++; |
|
| 786 | + } |
|
| 787 | + if (!$i) { |
|
| 788 | + $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; |
|
| 789 | + } |
|
| 727 | 790 | $totalarray['val']['totalcredit'] += $line->credit; |
| 728 | 791 | } |
| 729 | 792 | |
@@ -731,7 +794,9 @@ discard block |
||
| 731 | 794 | if (!empty($arrayfields['t.lettering_code']['checked'])) |
| 732 | 795 | { |
| 733 | 796 | print '<td class="center">'.$line->lettering_code.'</td>'; |
| 734 | - if (!$i) $totalarray['nbfield']++; |
|
| 797 | + if (!$i) { |
|
| 798 | + $totalarray['nbfield']++; |
|
| 799 | + } |
|
| 735 | 800 | } |
| 736 | 801 | |
| 737 | 802 | // Fields from hook |
@@ -750,7 +815,9 @@ discard block |
||
| 750 | 815 | } |
| 751 | 816 | } |
| 752 | 817 | print '</td>'; |
| 753 | - if (!$i) $totalarray['nbfield']++; |
|
| 818 | + if (!$i) { |
|
| 819 | + $totalarray['nbfield']++; |
|
| 820 | + } |
|
| 754 | 821 | |
| 755 | 822 | // Comptabilise le sous-total |
| 756 | 823 | $sous_total_debit += $line->debit; |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $langs->loadLangs(array("accountancy", "compta")); |
| 40 | 40 | |
| 41 | 41 | $action = GETPOST('action', 'aZ09'); |
| 42 | -$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
| 43 | -$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
| 44 | -$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
| 45 | -$search_date_endyear = GETPOST('search_date_endyear', 'int'); |
|
| 46 | -$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
| 47 | -$search_date_endday = GETPOST('search_date_endday', 'int'); |
|
| 42 | +$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
| 43 | +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
| 44 | +$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
| 45 | +$search_date_endyear = GETPOST('search_date_endyear', 'int'); |
|
| 46 | +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
| 47 | +$search_date_endday = GETPOST('search_date_endday', 'int'); |
|
| 48 | 48 | $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); |
| 49 | 49 | $search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 50 | 50 | $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | } elseif ($line->doc_type == 'bank') { |
| 702 | 702 | print $objectstatic->getNomUrl(1); |
| 703 | 703 | $bank_ref = strstr($line->doc_ref, '-'); |
| 704 | - print " " . $bank_ref; |
|
| 704 | + print " ".$bank_ref; |
|
| 705 | 705 | } else { |
| 706 | 706 | print $line->doc_ref; |
| 707 | 707 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | 8 => 'bank_line', |
| 99 | 99 | 9 => 'warehouse', |
| 100 | 100 | 10 => 'actioncomm', |
| 101 | - 11 => 'website_page' |
|
| 101 | + 11 => 'website_page' |
|
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | * @see Categorie::TYPE_PROJECT |
| 232 | 232 | * @see Categorie::TYPE_ACCOUNT |
| 233 | 233 | * @see Categorie::TYPE_BANK_LINE |
| 234 | - * @see Categorie::TYPE_WAREHOUSE |
|
| 235 | - * @see Categorie::TYPE_ACTIONCOMM |
|
| 236 | - * @see Categorie::TYPE_WEBSITE_PAGE |
|
| 234 | + * @see Categorie::TYPE_WAREHOUSE |
|
| 235 | + * @see Categorie::TYPE_ACTIONCOMM |
|
| 236 | + * @see Categorie::TYPE_WEBSITE_PAGE |
|
| 237 | 237 | */ |
| 238 | 238 | public $type; |
| 239 | 239 | |
@@ -313,8 +313,12 @@ discard block |
||
| 313 | 313 | global $conf; |
| 314 | 314 | |
| 315 | 315 | // Check parameters |
| 316 | - if (empty($id) && empty($label) && empty($ref_ext)) return -1; |
|
| 317 | - if (!is_null($type) && !is_numeric($type)) $type = $this->MAP_ID[$type]; |
|
| 316 | + if (empty($id) && empty($label) && empty($ref_ext)) { |
|
| 317 | + return -1; |
|
| 318 | + } |
|
| 319 | + if (!is_null($type) && !is_numeric($type)) { |
|
| 320 | + $type = $this->MAP_ID[$type]; |
|
| 321 | + } |
|
| 318 | 322 | |
| 319 | 323 | $sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type, ref_ext"; |
| 320 | 324 | $sql .= ", date_creation, tms, fk_user_creat, fk_user_modif"; |
@@ -325,7 +329,9 @@ discard block |
||
| 325 | 329 | $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; |
| 326 | 330 | } else { |
| 327 | 331 | $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; |
| 328 | - if (!is_null($type)) $sql .= " AND type = ".((int) $type); |
|
| 332 | + if (!is_null($type)) { |
|
| 333 | + $sql .= " AND type = ".((int) $type); |
|
| 334 | + } |
|
| 329 | 335 | } |
| 330 | 336 | |
| 331 | 337 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
@@ -357,7 +363,9 @@ discard block |
||
| 357 | 363 | $this->db->free($resql); |
| 358 | 364 | |
| 359 | 365 | // multilangs |
| 360 | - if (!empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); |
|
| 366 | + if (!empty($conf->global->MAIN_MULTILANGS)) { |
|
| 367 | + $this->getMultiLangs(); |
|
| 368 | + } |
|
| 361 | 369 | |
| 362 | 370 | return 1; |
| 363 | 371 | } else { |
@@ -385,7 +393,9 @@ discard block |
||
| 385 | 393 | |
| 386 | 394 | $type = $this->type; |
| 387 | 395 | |
| 388 | - if (!is_numeric($type)) $type = $this->MAP_ID[$type]; |
|
| 396 | + if (!is_numeric($type)) { |
|
| 397 | + $type = $this->MAP_ID[$type]; |
|
| 398 | + } |
|
| 389 | 399 | |
| 390 | 400 | $error = 0; |
| 391 | 401 | |
@@ -397,7 +407,9 @@ discard block |
||
| 397 | 407 | $this->color = trim($this->color); |
| 398 | 408 | $this->import_key = trim($this->import_key); |
| 399 | 409 | $this->ref_ext = trim($this->ref_ext); |
| 400 | - if (empty($this->visible)) $this->visible = 0; |
|
| 410 | + if (empty($this->visible)) { |
|
| 411 | + $this->visible = 0; |
|
| 412 | + } |
|
| 401 | 413 | $this->fk_parent = ($this->fk_parent != "" ? intval($this->fk_parent) : 0); |
| 402 | 414 | |
| 403 | 415 | if ($this->already_exists()) { |
@@ -577,7 +589,9 @@ discard block |
||
| 577 | 589 | if (!$error && !$notrigger) { |
| 578 | 590 | // Call trigger |
| 579 | 591 | $result = $this->call_trigger('CATEGORY_DELETE', $user); |
| 580 | - if ($result < 0) $error++; |
|
| 592 | + if ($result < 0) { |
|
| 593 | + $error++; |
|
| 594 | + } |
|
| 581 | 595 | // End call triggers |
| 582 | 596 | } |
| 583 | 597 | |
@@ -647,9 +661,13 @@ discard block |
||
| 647 | 661 | |
| 648 | 662 | $error = 0; |
| 649 | 663 | |
| 650 | - if ($this->id == -1) return -2; |
|
| 664 | + if ($this->id == -1) { |
|
| 665 | + return -2; |
|
| 666 | + } |
|
| 651 | 667 | |
| 652 | - if (empty($type)) $type = $obj->element; |
|
| 668 | + if (empty($type)) { |
|
| 669 | + $type = $obj->element; |
|
| 670 | + } |
|
| 653 | 671 | |
| 654 | 672 | $this->db->begin(); |
| 655 | 673 | |
@@ -803,7 +821,9 @@ discard block |
||
| 803 | 821 | if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) { |
| 804 | 822 | $sql .= " AND o.rowid = ".$user->socid; |
| 805 | 823 | } |
| 806 | - if ($limit > 0 || $offset > 0) $sql .= $this->db->plimit($limit + 1, $offset); |
|
| 824 | + if ($limit > 0 || $offset > 0) { |
|
| 825 | + $sql .= $this->db->plimit($limit + 1, $offset); |
|
| 826 | + } |
|
| 807 | 827 | $sql .= $this->db->order($sortfield, $sortorder); |
| 808 | 828 | |
| 809 | 829 | dol_syslog(get_class($this)."::getObjectsInCateg", LOG_DEBUG); |
@@ -1035,7 +1055,9 @@ discard block |
||
| 1035 | 1055 | // phpcs:enable |
| 1036 | 1056 | global $conf, $langs; |
| 1037 | 1057 | |
| 1038 | - if (!is_numeric($type)) $type = $this->MAP_ID[$type]; |
|
| 1058 | + if (!is_numeric($type)) { |
|
| 1059 | + $type = $this->MAP_ID[$type]; |
|
| 1060 | + } |
|
| 1039 | 1061 | if (is_null($type)) { |
| 1040 | 1062 | $this->error = 'BadValueForParameterType'; |
| 1041 | 1063 | return -1; |
@@ -1061,9 +1083,13 @@ discard block |
||
| 1061 | 1083 | |
| 1062 | 1084 | // Init $this->cats array |
| 1063 | 1085 | $sql = "SELECT DISTINCT c.rowid, c.label, c.ref_ext, c.description, c.color, c.fk_parent, c.visible"; // Distinct reduce pb with old tables with duplicates |
| 1064 | - if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= ", t.label as label_trans, t.description as description_trans"; |
|
| 1086 | + if (!empty($conf->global->MAIN_MULTILANGS)) { |
|
| 1087 | + $sql .= ", t.label as label_trans, t.description as description_trans"; |
|
| 1088 | + } |
|
| 1065 | 1089 | $sql .= " FROM ".MAIN_DB_PREFIX."categorie as c"; |
| 1066 | - if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$this->db->escape($current_lang)."'"; |
|
| 1090 | + if (!empty($conf->global->MAIN_MULTILANGS)) { |
|
| 1091 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$this->db->escape($current_lang)."'"; |
|
| 1092 | + } |
|
| 1067 | 1093 | $sql .= " WHERE c.entity IN (".getEntity('category').")"; |
| 1068 | 1094 | $sql .= " AND c.type = ".(int) $type; |
| 1069 | 1095 | |
@@ -1200,14 +1226,18 @@ discard block |
||
| 1200 | 1226 | public function get_all_categories($type = null, $parent = false) |
| 1201 | 1227 | { |
| 1202 | 1228 | // phpcs:enable |
| 1203 | - if (!is_numeric($type)) $type = $this->MAP_ID[$type]; |
|
| 1229 | + if (!is_numeric($type)) { |
|
| 1230 | + $type = $this->MAP_ID[$type]; |
|
| 1231 | + } |
|
| 1204 | 1232 | |
| 1205 | 1233 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; |
| 1206 | 1234 | $sql .= " WHERE entity IN (".getEntity('category').")"; |
| 1207 | - if (!is_null($type)) |
|
| 1208 | - $sql .= " AND type = ".(int) $type; |
|
| 1209 | - if ($parent) |
|
| 1210 | - $sql .= " AND fk_parent = 0"; |
|
| 1235 | + if (!is_null($type)) { |
|
| 1236 | + $sql .= " AND type = ".(int) $type; |
|
| 1237 | + } |
|
| 1238 | + if ($parent) { |
|
| 1239 | + $sql .= " AND fk_parent = 0"; |
|
| 1240 | + } |
|
| 1211 | 1241 | |
| 1212 | 1242 | $res = $this->db->query($sql); |
| 1213 | 1243 | if ($res) { |
@@ -1248,7 +1278,9 @@ discard block |
||
| 1248 | 1278 | // phpcs:enable |
| 1249 | 1279 | $type = $this->type; |
| 1250 | 1280 | |
| 1251 | - if (!is_numeric($type)) $type = $this->MAP_ID[$type]; |
|
| 1281 | + if (!is_numeric($type)) { |
|
| 1282 | + $type = $this->MAP_ID[$type]; |
|
| 1283 | + } |
|
| 1252 | 1284 | |
| 1253 | 1285 | /* We have to select any rowid from llx_categorie which category's mother and label |
| 1254 | 1286 | * are equals to those of the calling category |
@@ -1314,7 +1346,9 @@ discard block |
||
| 1314 | 1346 | // Check contrast with background and correct text color |
| 1315 | 1347 | $forced_color = 'categtextwhite'; |
| 1316 | 1348 | if ($cat->color) { |
| 1317 | - if (colorIsLight($cat->color)) $forced_color = 'categtextblack'; |
|
| 1349 | + if (colorIsLight($cat->color)) { |
|
| 1350 | + $forced_color = 'categtextblack'; |
|
| 1351 | + } |
|
| 1318 | 1352 | } |
| 1319 | 1353 | } |
| 1320 | 1354 | } |
@@ -1395,8 +1429,9 @@ discard block |
||
| 1395 | 1429 | } |
| 1396 | 1430 | } |
| 1397 | 1431 | |
| 1398 | - if (count($ways) == 0) |
|
| 1399 | - $ways[0][0] = $this; |
|
| 1432 | + if (count($ways) == 0) { |
|
| 1433 | + $ways[0][0] = $this; |
|
| 1434 | + } |
|
| 1400 | 1435 | |
| 1401 | 1436 | return $ways; |
| 1402 | 1437 | } |
@@ -1415,7 +1450,9 @@ discard block |
||
| 1415 | 1450 | { |
| 1416 | 1451 | $cats = array(); |
| 1417 | 1452 | |
| 1418 | - if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; |
|
| 1453 | + if (is_numeric($type)) { |
|
| 1454 | + $type = Categorie::$MAP_ID_TO_CODE[$type]; |
|
| 1455 | + } |
|
| 1419 | 1456 | |
| 1420 | 1457 | if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code after migration of llx_bank_categ into llx_categorie |
| 1421 | 1458 | // Load bank categories |
@@ -1505,11 +1542,14 @@ discard block |
||
| 1505 | 1542 | $sql .= " WHERE type = ".$this->MAP_ID[$type]; |
| 1506 | 1543 | $sql .= " AND entity IN (".getEntity('category').")"; |
| 1507 | 1544 | if ($nom) { |
| 1508 | - if (!$exact) |
|
| 1509 | - $nom = '%'.str_replace('*', '%', $nom).'%'; |
|
| 1510 | - if (!$case) |
|
| 1511 | - $sql .= " AND label LIKE '".$this->db->escape($nom)."'"; |
|
| 1512 | - else $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'"; |
|
| 1545 | + if (!$exact) { |
|
| 1546 | + $nom = '%'.str_replace('*', '%', $nom).'%'; |
|
| 1547 | + } |
|
| 1548 | + if (!$case) { |
|
| 1549 | + $sql .= " AND label LIKE '".$this->db->escape($nom)."'"; |
|
| 1550 | + } else { |
|
| 1551 | + $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'"; |
|
| 1552 | + } |
|
| 1513 | 1553 | } |
| 1514 | 1554 | if ($id) { |
| 1515 | 1555 | $sql .= " AND rowid = '".$id."'"; |
@@ -1550,7 +1590,9 @@ discard block |
||
| 1550 | 1590 | // Check contrast with background and correct text color |
| 1551 | 1591 | $forced_color = 'categtextwhite'; |
| 1552 | 1592 | if ($this->color) { |
| 1553 | - if (colorIsLight($this->color)) $forced_color = 'categtextblack'; |
|
| 1593 | + if (colorIsLight($this->color)) { |
|
| 1594 | + $forced_color = 'categtextblack'; |
|
| 1595 | + } |
|
| 1554 | 1596 | } |
| 1555 | 1597 | |
| 1556 | 1598 | $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : '')).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">'; |
@@ -1559,9 +1601,15 @@ discard block |
||
| 1559 | 1601 | $picto = 'category'; |
| 1560 | 1602 | |
| 1561 | 1603 | |
| 1562 | - if ($withpicto) $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); |
|
| 1563 | - if ($withpicto && $withpicto != 2) $result .= ' '; |
|
| 1564 | - if ($withpicto != 2) $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; |
|
| 1604 | + if ($withpicto) { |
|
| 1605 | + $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); |
|
| 1606 | + } |
|
| 1607 | + if ($withpicto && $withpicto != 2) { |
|
| 1608 | + $result .= ' '; |
|
| 1609 | + } |
|
| 1610 | + if ($withpicto != 2) { |
|
| 1611 | + $result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend; |
|
| 1612 | + } |
|
| 1565 | 1613 | return $result; |
| 1566 | 1614 | } |
| 1567 | 1615 | |
@@ -1649,13 +1697,18 @@ discard block |
||
| 1649 | 1697 | // Objet |
| 1650 | 1698 | $obj = array(); |
| 1651 | 1699 | $obj['photo'] = $photo; |
| 1652 | - if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette'] = 'thumbs/'.$photo_vignette; |
|
| 1653 | - else $obj['photo_vignette'] = ""; |
|
| 1700 | + if ($photo_vignette && is_file($dirthumb.$photo_vignette)) { |
|
| 1701 | + $obj['photo_vignette'] = 'thumbs/'.$photo_vignette; |
|
| 1702 | + } else { |
|
| 1703 | + $obj['photo_vignette'] = ""; |
|
| 1704 | + } |
|
| 1654 | 1705 | |
| 1655 | 1706 | $tabobj[$nbphoto - 1] = $obj; |
| 1656 | 1707 | |
| 1657 | 1708 | // On continue ou on arrete de boucler |
| 1658 | - if ($nbmax && $nbphoto >= $nbmax) break; |
|
| 1709 | + if ($nbmax && $nbphoto >= $nbmax) { |
|
| 1710 | + break; |
|
| 1711 | + } |
|
| 1659 | 1712 | } |
| 1660 | 1713 | } |
| 1661 | 1714 | |
@@ -1760,8 +1813,9 @@ discard block |
||
| 1760 | 1813 | } |
| 1761 | 1814 | |
| 1762 | 1815 | // on ne sauvegarde pas des champs vides |
| 1763 | - if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"]) |
|
| 1764 | - dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); |
|
| 1816 | + if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"]) { |
|
| 1817 | + dol_syslog(get_class($this).'::setMultiLangs', LOG_DEBUG); |
|
| 1818 | + } |
|
| 1765 | 1819 | if (!$this->db->query($sql2)) { |
| 1766 | 1820 | $this->error = $this->db->lasterror(); |
| 1767 | 1821 | return -1; |
@@ -1872,7 +1926,9 @@ discard block |
||
| 1872 | 1926 | */ |
| 1873 | 1927 | public static function getFilterJoinQuery($type, $rowIdName) |
| 1874 | 1928 | { |
| 1875 | - if ($type == 'bank_account') $type = 'account'; |
|
| 1929 | + if ($type == 'bank_account') { |
|
| 1930 | + $type = 'account'; |
|
| 1931 | + } |
|
| 1876 | 1932 | |
| 1877 | 1933 | return " LEFT JOIN ".MAIN_DB_PREFIX."categorie_".$type." as cp ON ".$rowIdName." = cp.fk_".$type; |
| 1878 | 1934 | } |
@@ -1887,7 +1943,9 @@ discard block |
||
| 1887 | 1943 | */ |
| 1888 | 1944 | public static function getFilterSelectQuery($type, $rowIdName, $searchList) |
| 1889 | 1945 | { |
| 1890 | - if ($type == 'bank_account') $type = 'account'; |
|
| 1946 | + if ($type == 'bank_account') { |
|
| 1947 | + $type = 'account'; |
|
| 1948 | + } |
|
| 1891 | 1949 | |
| 1892 | 1950 | if (empty($searchList) && !is_array($searchList)) { |
| 1893 | 1951 | return ""; |
@@ -64,9 +64,11 @@ discard block |
||
| 64 | 64 | // Ne fonctionne que si on est pas en safe_mode. |
| 65 | 65 | $err = error_reporting(); |
| 66 | 66 | error_reporting(0); |
| 67 | -if (!empty($conf->global->MAIN_OVERRIDE_TIME_LIMIT)) |
|
| 67 | +if (!empty($conf->global->MAIN_OVERRIDE_TIME_LIMIT)) { |
|
| 68 | 68 | @set_time_limit((int) $conf->global->MAIN_OVERRIDE_TIME_LIMIT); |
| 69 | -else @set_time_limit(600); |
|
| 69 | +} else { |
|
| 70 | + @set_time_limit(600); |
|
| 71 | +} |
|
| 70 | 72 | error_reporting($err); |
| 71 | 73 | |
| 72 | 74 | $setuplang = GETPOST("selectlang", 'aZ09', 3) ?GETPOST("selectlang", 'aZ09', 3) : 'auto'; |
@@ -77,13 +79,21 @@ discard block |
||
| 77 | 79 | |
| 78 | 80 | $langs->loadLangs(array("admin", "install", "bills", "suppliers")); |
| 79 | 81 | |
| 80 | -if ($dolibarr_main_db_type == 'mysqli') $choix = 1; |
|
| 81 | -if ($dolibarr_main_db_type == 'pgsql') $choix = 2; |
|
| 82 | -if ($dolibarr_main_db_type == 'mssql') $choix = 3; |
|
| 82 | +if ($dolibarr_main_db_type == 'mysqli') { |
|
| 83 | + $choix = 1; |
|
| 84 | +} |
|
| 85 | +if ($dolibarr_main_db_type == 'pgsql') { |
|
| 86 | + $choix = 2; |
|
| 87 | +} |
|
| 88 | +if ($dolibarr_main_db_type == 'mssql') { |
|
| 89 | + $choix = 3; |
|
| 90 | +} |
|
| 83 | 91 | |
| 84 | 92 | |
| 85 | 93 | dolibarr_install_syslog("--- upgrade2: entering upgrade2.php page ".$versionfrom." ".$versionto." ".$enablemodules); |
| 86 | -if (!is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR); |
|
| 94 | +if (!is_object($conf)) { |
|
| 95 | + dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR); |
|
| 96 | +} |
|
| 87 | 97 | |
| 88 | 98 | |
| 89 | 99 | |
@@ -124,7 +134,9 @@ discard block |
||
| 124 | 134 | $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); |
| 125 | 135 | $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); |
| 126 | 136 | $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted |
| 127 | - } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
| 137 | + } else { |
|
| 138 | + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
| 139 | + } |
|
| 128 | 140 | } |
| 129 | 141 | |
| 130 | 142 | // $conf is already instancied inside inc.php |
@@ -159,9 +171,13 @@ discard block |
||
| 159 | 171 | } |
| 160 | 172 | } |
| 161 | 173 | |
| 162 | - if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0; |
|
| 174 | + if (empty($dolibarr_main_db_encryption)) { |
|
| 175 | + $dolibarr_main_db_encryption = 0; |
|
| 176 | + } |
|
| 163 | 177 | $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
| 164 | - if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = ''; |
|
| 178 | + if (empty($dolibarr_main_db_cryptkey)) { |
|
| 179 | + $dolibarr_main_db_cryptkey = ''; |
|
| 180 | + } |
|
| 165 | 181 | $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
| 166 | 182 | |
| 167 | 183 | // Chargement config |
@@ -169,7 +185,9 @@ discard block |
||
| 169 | 185 | { |
| 170 | 186 | $conf->setValues($db); |
| 171 | 187 | // Reset forced setup after the setValues |
| 172 | - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
| 188 | + if (defined('SYSLOG_FILE')) { |
|
| 189 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
| 190 | + } |
|
| 173 | 191 | $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; |
| 174 | 192 | } |
| 175 | 193 | |
@@ -541,9 +559,11 @@ discard block |
||
| 541 | 559 | } |
| 542 | 560 | } else { |
| 543 | 561 | //if (! empty($conf->modules)) |
| 544 | - if (!empty($conf->modules_parts['hooks'])) // If there is at least one module with one hook, we show message to say nothing was done |
|
| 562 | + if (!empty($conf->modules_parts['hooks'])) { |
|
| 563 | + // If there is at least one module with one hook, we show message to say nothing was done |
|
| 545 | 564 | { |
| 546 | 565 | print '<tr><td colspan="4">'; |
| 566 | + } |
|
| 547 | 567 | print '<b>'.$langs->trans('UpgradeExternalModule').'</b>: '.$langs->trans("None"); |
| 548 | 568 | print '</td></tr>'; |
| 549 | 569 | } |
@@ -584,16 +604,22 @@ discard block |
||
| 584 | 604 | } |
| 585 | 605 | |
| 586 | 606 | $ret = 0; |
| 587 | -if ($error && isset($argv[1])) $ret = 1; |
|
| 607 | +if ($error && isset($argv[1])) { |
|
| 608 | + $ret = 1; |
|
| 609 | +} |
|
| 588 | 610 | dolibarr_install_syslog("Exit ".$ret); |
| 589 | 611 | |
| 590 | 612 | dolibarr_install_syslog("--- upgrade2: end"); |
| 591 | 613 | pFooter($error ? 2 : 0, $setuplang); |
| 592 | 614 | |
| 593 | -if ($db->connected) $db->close(); |
|
| 615 | +if ($db->connected) { |
|
| 616 | + $db->close(); |
|
| 617 | +} |
|
| 594 | 618 | |
| 595 | 619 | // Return code if ran from command line |
| 596 | -if ($ret) exit($ret); |
|
| 620 | +if ($ret) { |
|
| 621 | + exit($ret); |
|
| 622 | +} |
|
| 597 | 623 | |
| 598 | 624 | |
| 599 | 625 | |
@@ -724,9 +750,12 @@ discard block |
||
| 724 | 750 | while ($i < $num) |
| 725 | 751 | { |
| 726 | 752 | $obj = $db->fetch_object($resql); |
| 727 | - if ($obj->pamount == $obj->bamount && $obj->socid) // Pour etre sur d'avoir bon cas |
|
| 753 | + if ($obj->pamount == $obj->bamount && $obj->socid) { |
|
| 754 | + // Pour etre sur d'avoir bon cas |
|
| 728 | 755 | { |
| 729 | - $row[$j]['paymentid'] = $obj->rowid; // paymentid |
|
| 756 | + $row[$j]['paymentid'] = $obj->rowid; |
|
| 757 | + } |
|
| 758 | + // paymentid |
|
| 730 | 759 | $row[$j]['pamount'] = $obj->pamount; |
| 731 | 760 | $row[$j]['fk_bank'] = $obj->fk_bank; |
| 732 | 761 | $row[$j]['bamount'] = $obj->bamount; |
@@ -749,7 +778,9 @@ discard block |
||
| 749 | 778 | $num = count($row); |
| 750 | 779 | for ($i = 0; $i < $num; $i++) |
| 751 | 780 | { |
| 752 | - if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '* '.$row[$i]['datec'].' paymentid='.$row[$i]['paymentid'].' pamount='.$row[$i]['pamount'].' fk_bank='.$row[$i]['fk_bank'].' bamount='.$row[$i]['bamount'].' socid='.$row[$i]['socid'].'<br>'; |
|
| 781 | + if ($conf->global->MAIN_FEATURES_LEVEL == 2) { |
|
| 782 | + print '* '.$row[$i]['datec'].' paymentid='.$row[$i]['paymentid'].' pamount='.$row[$i]['pamount'].' fk_bank='.$row[$i]['fk_bank'].' bamount='.$row[$i]['bamount'].' socid='.$row[$i]['socid'].'<br>'; |
|
| 783 | + } |
|
| 753 | 784 | |
| 754 | 785 | // On cherche facture sans lien paiement et du meme montant et pour meme societe. |
| 755 | 786 | $sql = " SELECT distinct f.rowid from ".MAIN_DB_PREFIX."facture as f"; |
@@ -840,9 +871,12 @@ discard block |
||
| 840 | 871 | while ($i < $num) |
| 841 | 872 | { |
| 842 | 873 | $obj = $db->fetch_object($resql); |
| 843 | - if ($obj->pamount == $obj->bamount && $obj->socid) // Pour etre sur d'avoir bon cas |
|
| 874 | + if ($obj->pamount == $obj->bamount && $obj->socid) { |
|
| 875 | + // Pour etre sur d'avoir bon cas |
|
| 844 | 876 | { |
| 845 | - $row[$j]['paymentid'] = $obj->rowid; // paymentid |
|
| 877 | + $row[$j]['paymentid'] = $obj->rowid; |
|
| 878 | + } |
|
| 879 | + // paymentid |
|
| 846 | 880 | $row[$j]['pamount'] = $obj->pamount; |
| 847 | 881 | $row[$j]['fk_bank'] = $obj->fk_bank; |
| 848 | 882 | $row[$j]['bamount'] = $obj->bamount; |
@@ -867,7 +901,9 @@ discard block |
||
| 867 | 901 | $res = 0; |
| 868 | 902 | for ($i = 0; $i < $num; $i++) |
| 869 | 903 | { |
| 870 | - if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '* '.$row[$i]['datec'].' paymentid='.$row[$i]['paymentid'].' '.$row[$i]['pamount'].' fk_bank='.$row[$i]['fk_bank'].' '.$row[$i]['bamount'].' socid='.$row[$i]['socid'].'<br>'; |
|
| 904 | + if ($conf->global->MAIN_FEATURES_LEVEL == 2) { |
|
| 905 | + print '* '.$row[$i]['datec'].' paymentid='.$row[$i]['paymentid'].' '.$row[$i]['pamount'].' fk_bank='.$row[$i]['fk_bank'].' '.$row[$i]['bamount'].' socid='.$row[$i]['socid'].'<br>'; |
|
| 906 | + } |
|
| 871 | 907 | |
| 872 | 908 | // On cherche facture sans lien paiement et du meme montant et pour meme societe. |
| 873 | 909 | $sql = " SELECT distinct f.rowid from ".MAIN_DB_PREFIX."facture as f"; |
@@ -1118,18 +1154,26 @@ discard block |
||
| 1118 | 1154 | $sql = "update ".MAIN_DB_PREFIX."contrat set date_contrat=tms where date_contrat is null"; |
| 1119 | 1155 | dolibarr_install_syslog("upgrade2::migrate_contracts_date1"); |
| 1120 | 1156 | $resql = $db->query($sql); |
| 1121 | - if (!$resql) dol_print_error($db); |
|
| 1122 | - if ($db->affected_rows($resql) > 0) |
|
| 1123 | - print $langs->trans('MigrationContractsEmptyDatesUpdateSuccess')."<br>\n"; |
|
| 1124 | - else print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."<br>\n"; |
|
| 1157 | + if (!$resql) { |
|
| 1158 | + dol_print_error($db); |
|
| 1159 | + } |
|
| 1160 | + if ($db->affected_rows($resql) > 0) { |
|
| 1161 | + print $langs->trans('MigrationContractsEmptyDatesUpdateSuccess')."<br>\n"; |
|
| 1162 | + } else { |
|
| 1163 | + print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."<br>\n"; |
|
| 1164 | + } |
|
| 1125 | 1165 | |
| 1126 | 1166 | $sql = "update ".MAIN_DB_PREFIX."contrat set datec=tms where datec is null"; |
| 1127 | 1167 | dolibarr_install_syslog("upgrade2::migrate_contracts_date1"); |
| 1128 | 1168 | $resql = $db->query($sql); |
| 1129 | - if (!$resql) dol_print_error($db); |
|
| 1130 | - if ($db->affected_rows($resql) > 0) |
|
| 1131 | - print $langs->trans('MigrationContractsEmptyCreationDatesUpdateSuccess')."<br>\n"; |
|
| 1132 | - else print $langs->trans('MigrationContractsEmptyCreationDatesNothingToUpdate')."<br>\n"; |
|
| 1169 | + if (!$resql) { |
|
| 1170 | + dol_print_error($db); |
|
| 1171 | + } |
|
| 1172 | + if ($db->affected_rows($resql) > 0) { |
|
| 1173 | + print $langs->trans('MigrationContractsEmptyCreationDatesUpdateSuccess')."<br>\n"; |
|
| 1174 | + } else { |
|
| 1175 | + print $langs->trans('MigrationContractsEmptyCreationDatesNothingToUpdate')."<br>\n"; |
|
| 1176 | + } |
|
| 1133 | 1177 | |
| 1134 | 1178 | print '</td></tr>'; |
| 1135 | 1179 | } |
@@ -1182,7 +1226,9 @@ discard block |
||
| 1182 | 1226 | $sql .= " SET date_contrat='".$db->idate($datemin)."'"; |
| 1183 | 1227 | $sql .= " WHERE rowid=".$obj->cref; |
| 1184 | 1228 | $resql2 = $db->query($sql); |
| 1185 | - if (!$resql2) dol_print_error($db); |
|
| 1229 | + if (!$resql2) { |
|
| 1230 | + dol_print_error($db); |
|
| 1231 | + } |
|
| 1186 | 1232 | |
| 1187 | 1233 | $nbcontratsmodifie++; |
| 1188 | 1234 | } |
@@ -1191,9 +1237,11 @@ discard block |
||
| 1191 | 1237 | |
| 1192 | 1238 | $db->commit(); |
| 1193 | 1239 | |
| 1194 | - if ($nbcontratsmodifie) |
|
| 1195 | - print $langs->trans('MigrationContractsInvalidDatesNumber', $nbcontratsmodifie)."<br>\n"; |
|
| 1196 | - else print $langs->trans('MigrationContractsInvalidDatesNothingToUpdate')."<br>\n"; |
|
| 1240 | + if ($nbcontratsmodifie) { |
|
| 1241 | + print $langs->trans('MigrationContractsInvalidDatesNumber', $nbcontratsmodifie)."<br>\n"; |
|
| 1242 | + } else { |
|
| 1243 | + print $langs->trans('MigrationContractsInvalidDatesNothingToUpdate')."<br>\n"; |
|
| 1244 | + } |
|
| 1197 | 1245 | } |
| 1198 | 1246 | } else { |
| 1199 | 1247 | dol_print_error($db); |
@@ -1220,10 +1268,14 @@ discard block |
||
| 1220 | 1268 | $sql = "update ".MAIN_DB_PREFIX."contrat set datec=date_contrat where datec is null or datec > date_contrat"; |
| 1221 | 1269 | dolibarr_install_syslog("upgrade2::migrate_contracts_date3"); |
| 1222 | 1270 | $resql = $db->query($sql); |
| 1223 | - if (!$resql) dol_print_error($db); |
|
| 1224 | - if ($db->affected_rows($resql) > 0) |
|
| 1225 | - print $langs->trans('MigrationContractsIncoherentCreationDateUpdateSuccess')."<br>\n"; |
|
| 1226 | - else print $langs->trans('MigrationContractsIncoherentCreationDateNothingToUpdate')."<br>\n"; |
|
| 1271 | + if (!$resql) { |
|
| 1272 | + dol_print_error($db); |
|
| 1273 | + } |
|
| 1274 | + if ($db->affected_rows($resql) > 0) { |
|
| 1275 | + print $langs->trans('MigrationContractsIncoherentCreationDateUpdateSuccess')."<br>\n"; |
|
| 1276 | + } else { |
|
| 1277 | + print $langs->trans('MigrationContractsIncoherentCreationDateNothingToUpdate')."<br>\n"; |
|
| 1278 | + } |
|
| 1227 | 1279 | |
| 1228 | 1280 | print '</td></tr>'; |
| 1229 | 1281 | } |
@@ -1247,7 +1299,9 @@ discard block |
||
| 1247 | 1299 | $sql .= " WHERE cd.statut = 4 AND c.statut=2 AND c.rowid=cd.fk_contrat"; |
| 1248 | 1300 | dolibarr_install_syslog("upgrade2::migrate_contracts_open"); |
| 1249 | 1301 | $resql = $db->query($sql); |
| 1250 | - if (!$resql) dol_print_error($db); |
|
| 1302 | + if (!$resql) { |
|
| 1303 | + dol_print_error($db); |
|
| 1304 | + } |
|
| 1251 | 1305 | if ($db->affected_rows($resql) > 0) { |
| 1252 | 1306 | $i = 0; |
| 1253 | 1307 | $row = array(); |
@@ -1267,7 +1321,9 @@ discard block |
||
| 1267 | 1321 | $sql .= " SET statut=1"; |
| 1268 | 1322 | $sql .= " WHERE rowid=".$obj->cref; |
| 1269 | 1323 | $resql2 = $db->query($sql); |
| 1270 | - if (!$resql2) dol_print_error($db); |
|
| 1324 | + if (!$resql2) { |
|
| 1325 | + dol_print_error($db); |
|
| 1326 | + } |
|
| 1271 | 1327 | |
| 1272 | 1328 | $nbcontratsmodifie++; |
| 1273 | 1329 | |
@@ -1276,11 +1332,15 @@ discard block |
||
| 1276 | 1332 | |
| 1277 | 1333 | $db->commit(); |
| 1278 | 1334 | |
| 1279 | - if ($nbcontratsmodifie) |
|
| 1280 | - print $langs->trans('MigrationReopenedContractsNumber', $nbcontratsmodifie)."<br>\n"; |
|
| 1281 | - else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."<br>\n"; |
|
| 1335 | + if ($nbcontratsmodifie) { |
|
| 1336 | + print $langs->trans('MigrationReopenedContractsNumber', $nbcontratsmodifie)."<br>\n"; |
|
| 1337 | + } else { |
|
| 1338 | + print $langs->trans('MigrationReopeningContractsNothingToUpdate')."<br>\n"; |
|
| 1339 | + } |
|
| 1282 | 1340 | } |
| 1283 | - } else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."<br>\n"; |
|
| 1341 | + } else { |
|
| 1342 | + print $langs->trans('MigrationReopeningContractsNothingToUpdate')."<br>\n"; |
|
| 1343 | + } |
|
| 1284 | 1344 | |
| 1285 | 1345 | print '</td></tr>'; |
| 1286 | 1346 | } |
@@ -1621,7 +1681,10 @@ discard block |
||
| 1621 | 1681 | |
| 1622 | 1682 | $tmpmysoc = new Societe($db); |
| 1623 | 1683 | $tmpmysoc->setMysoc($conf); |
| 1624 | - if (empty($tmpmysoc->country_id)) $tmpmysoc->country_id = 0; // Ti not have this set to '' or will make sql syntax error. |
|
| 1684 | + if (empty($tmpmysoc->country_id)) { |
|
| 1685 | + $tmpmysoc->country_id = 0; |
|
| 1686 | + } |
|
| 1687 | + // Ti not have this set to '' or will make sql syntax error. |
|
| 1625 | 1688 | |
| 1626 | 1689 | print '<tr><td colspan="4">'; |
| 1627 | 1690 | |
@@ -1942,7 +2005,9 @@ discard block |
||
| 1942 | 2005 | // Aucun model par defaut. |
| 1943 | 2006 | $sql = " insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('crabe','invoice')"; |
| 1944 | 2007 | $resql = $db->query($sql); |
| 1945 | - if (!$resql) dol_print_error($db); |
|
| 2008 | + if (!$resql) { |
|
| 2009 | + dol_print_error($db); |
|
| 2010 | + } |
|
| 1946 | 2011 | } |
| 1947 | 2012 | } |
| 1948 | 2013 | |
@@ -1955,7 +2020,9 @@ discard block |
||
| 1955 | 2020 | // Aucun model par defaut. |
| 1956 | 2021 | $sql = " insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('einstein','order')"; |
| 1957 | 2022 | $resql = $db->query($sql); |
| 1958 | - if (!$resql) dol_print_error($db); |
|
| 2023 | + if (!$resql) { |
|
| 2024 | + dol_print_error($db); |
|
| 2025 | + } |
|
| 1959 | 2026 | } |
| 1960 | 2027 | } |
| 1961 | 2028 | |
@@ -1968,7 +2035,9 @@ discard block |
||
| 1968 | 2035 | // Aucun model par defaut. |
| 1969 | 2036 | $sql = " insert into ".MAIN_DB_PREFIX."document_model(nom,type) values('rouget','shipping')"; |
| 1970 | 2037 | $resql = $db->query($sql); |
| 1971 | - if (!$resql) dol_print_error($db); |
|
| 2038 | + if (!$resql) { |
|
| 2039 | + dol_print_error($db); |
|
| 2040 | + } |
|
| 1972 | 2041 | } |
| 1973 | 2042 | } |
| 1974 | 2043 | |
@@ -2528,7 +2597,9 @@ discard block |
||
| 2528 | 2597 | //print ". "; |
| 2529 | 2598 | $i++; |
| 2530 | 2599 | } |
| 2531 | - } else print $langs->trans('AlreadyDone')."<br>\n"; |
|
| 2600 | + } else { |
|
| 2601 | + print $langs->trans('AlreadyDone')."<br>\n"; |
|
| 2602 | + } |
|
| 2532 | 2603 | |
| 2533 | 2604 | if ($error == 0) |
| 2534 | 2605 | { |
@@ -2929,11 +3000,17 @@ discard block |
||
| 2929 | 3000 | } |
| 2930 | 3001 | print ". "; |
| 2931 | 3002 | $oldtime++; |
| 2932 | - if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $newtime; |
|
| 2933 | - else $totaltime[$obj->fk_task] = $newtime; |
|
| 3003 | + if (!empty($totaltime[$obj->fk_task])) { |
|
| 3004 | + $totaltime[$obj->fk_task] += $newtime; |
|
| 3005 | + } else { |
|
| 3006 | + $totaltime[$obj->fk_task] = $newtime; |
|
| 3007 | + } |
|
| 2934 | 3008 | } else { |
| 2935 | - if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $obj->task_duration; |
|
| 2936 | - else $totaltime[$obj->fk_task] = $obj->task_duration; |
|
| 3009 | + if (!empty($totaltime[$obj->fk_task])) { |
|
| 3010 | + $totaltime[$obj->fk_task] += $obj->task_duration; |
|
| 3011 | + } else { |
|
| 3012 | + $totaltime[$obj->fk_task] = $obj->task_duration; |
|
| 3013 | + } |
|
| 2937 | 3014 | } |
| 2938 | 3015 | |
| 2939 | 3016 | $i++; |
@@ -3400,7 +3477,9 @@ discard block |
||
| 3400 | 3477 | } |
| 3401 | 3478 | } |
| 3402 | 3479 | |
| 3403 | - if ($count == 0) print $langs->trans('AlreadyDone')."<br>\n"; |
|
| 3480 | + if ($count == 0) { |
|
| 3481 | + print $langs->trans('AlreadyDone')."<br>\n"; |
|
| 3482 | + } |
|
| 3404 | 3483 | |
| 3405 | 3484 | |
| 3406 | 3485 | print '</td></tr>'; |
@@ -3418,12 +3497,16 @@ discard block |
||
| 3418 | 3497 | function migrate_clean_association($db, $langs, $conf) |
| 3419 | 3498 | { |
| 3420 | 3499 | $result = $db->DDLDescTable(MAIN_DB_PREFIX."categorie_association"); |
| 3421 | - if ($result) // result defined for version 3.2 or - |
|
| 3500 | + if ($result) { |
|
| 3501 | + // result defined for version 3.2 or - |
|
| 3422 | 3502 | { |
| 3423 | 3503 | $obj = $db->fetch_object($result); |
| 3424 | - if ($obj) // It table categorie_association exists |
|
| 3504 | + } |
|
| 3505 | + if ($obj) { |
|
| 3506 | + // It table categorie_association exists |
|
| 3425 | 3507 | { |
| 3426 | 3508 | $couples = array(); |
| 3509 | + } |
|
| 3427 | 3510 | $filles = array(); |
| 3428 | 3511 | $sql = "SELECT fk_categorie_mere, fk_categorie_fille"; |
| 3429 | 3512 | $sql .= " FROM ".MAIN_DB_PREFIX."categorie_association"; |
@@ -3434,11 +3517,14 @@ discard block |
||
| 3434 | 3517 | $num = $db->num_rows($resql); |
| 3435 | 3518 | while ($obj = $db->fetch_object($resql)) |
| 3436 | 3519 | { |
| 3437 | - if (!isset($filles[$obj->fk_categorie_fille])) // Only one record as child (a child has only on parent). |
|
| 3520 | + if (!isset($filles[$obj->fk_categorie_fille])) { |
|
| 3521 | + // Only one record as child (a child has only on parent). |
|
| 3438 | 3522 | { |
| 3439 | 3523 | if ($obj->fk_categorie_mere != $obj->fk_categorie_fille) |
| 3440 | 3524 | { |
| 3441 | - $filles[$obj->fk_categorie_fille] = 1; // Set record for this child |
|
| 3525 | + $filles[$obj->fk_categorie_fille] = 1; |
|
| 3526 | + } |
|
| 3527 | + // Set record for this child |
|
| 3442 | 3528 | $couples[$obj->fk_categorie_mere.'_'.$obj->fk_categorie_fille] = array('mere'=>$obj->fk_categorie_mere, 'fille'=>$obj->fk_categorie_fille); |
| 3443 | 3529 | } |
| 3444 | 3530 | } |
@@ -3466,7 +3552,9 @@ discard block |
||
| 3466 | 3552 | $sql .= " VALUES(".$val['mere'].", ".$val['fille'].")"; |
| 3467 | 3553 | dolibarr_install_syslog("upgrade: insert association"); |
| 3468 | 3554 | $resqli = $db->query($sql); |
| 3469 | - if (!$resqli) $error++; |
|
| 3555 | + if (!$resqli) { |
|
| 3556 | + $error++; |
|
| 3557 | + } |
|
| 3470 | 3558 | } |
| 3471 | 3559 | } |
| 3472 | 3560 | |
@@ -4291,12 +4379,17 @@ discard block |
||
| 4291 | 4379 | */ |
| 4292 | 4380 | function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $force = 0) |
| 4293 | 4381 | { |
| 4294 | - if (count($listofmodule) == 0) return; |
|
| 4382 | + if (count($listofmodule) == 0) { |
|
| 4383 | + return; |
|
| 4384 | + } |
|
| 4295 | 4385 | |
| 4296 | 4386 | dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".join(',', array_keys($listofmodule))); |
| 4297 | 4387 | |
| 4298 | 4388 | foreach ($listofmodule as $moduletoreload => $reloadmode) { // reloadmodule can be 'noboxes', 'newboxdefonly', 'forceactivate' |
| 4299 | - if (empty($moduletoreload) || (empty($conf->global->$moduletoreload) && !$force)) continue; // Discard reload if module not enabled |
|
| 4389 | + if (empty($moduletoreload) || (empty($conf->global->$moduletoreload) && !$force)) { |
|
| 4390 | + continue; |
|
| 4391 | + } |
|
| 4392 | + // Discard reload if module not enabled |
|
| 4300 | 4393 | |
| 4301 | 4394 | $mod = null; |
| 4302 | 4395 | |
@@ -4465,9 +4558,11 @@ discard block |
||
| 4465 | 4558 | $tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg); |
| 4466 | 4559 | if (!empty($reg[1])) |
| 4467 | 4560 | { |
| 4468 | - if (strtoupper($moduletoreload) == $moduletoreload) // If key is un uppercase |
|
| 4561 | + if (strtoupper($moduletoreload) == $moduletoreload) { |
|
| 4562 | + // If key is un uppercase |
|
| 4469 | 4563 | { |
| 4470 | 4564 | $moduletoreloadshort = ucfirst(strtolower($reg[1])); |
| 4565 | + } |
|
| 4471 | 4566 | } else // If key is a mix of up and low case |
| 4472 | 4567 | { |
| 4473 | 4568 | $moduletoreloadshort = $reg[1]; |
@@ -4574,7 +4669,10 @@ discard block |
||
| 4574 | 4669 | include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 4575 | 4670 | $fuser = new User($db); |
| 4576 | 4671 | |
| 4577 | - if (!is_object($user)) $user = $fuser; // To avoid error during migration |
|
| 4672 | + if (!is_object($user)) { |
|
| 4673 | + $user = $fuser; |
|
| 4674 | + } |
|
| 4675 | + // To avoid error during migration |
|
| 4578 | 4676 | |
| 4579 | 4677 | $sql = "SELECT rowid as uid from ".MAIN_DB_PREFIX."user"; // Get list of all users |
| 4580 | 4678 | $resql = $db->query($sql); |
@@ -4609,11 +4707,15 @@ discard block |
||
| 4609 | 4707 | { |
| 4610 | 4708 | while (($file = readdir($handle)) !== false) |
| 4611 | 4709 | { |
| 4612 | - if ($file == '.' || $file == '..') continue; |
|
| 4710 | + if ($file == '.' || $file == '..') { |
|
| 4711 | + continue; |
|
| 4712 | + } |
|
| 4613 | 4713 | |
| 4614 | - if (dol_is_dir($origin.'/'.$file)) // it is a dir (like 'thumbs') |
|
| 4714 | + if (dol_is_dir($origin.'/'.$file)) { |
|
| 4715 | + // it is a dir (like 'thumbs') |
|
| 4615 | 4716 | { |
| 4616 | 4717 | $thumbs = opendir($origin_osencoded.'/'.$file); |
| 4718 | + } |
|
| 4617 | 4719 | if (is_resource($thumbs)) |
| 4618 | 4720 | { |
| 4619 | 4721 | dol_mkdir($destin.'/'.$file); |
@@ -4621,7 +4723,9 @@ discard block |
||
| 4621 | 4723 | { |
| 4622 | 4724 | if (!dol_is_file($destin.'/'.$file.'/'.$thumb)) |
| 4623 | 4725 | { |
| 4624 | - if ($thumb == '.' || $thumb == '..') continue; |
|
| 4726 | + if ($thumb == '.' || $thumb == '..') { |
|
| 4727 | + continue; |
|
| 4728 | + } |
|
| 4625 | 4729 | |
| 4626 | 4730 | //print $origin.'/'.$file.'/'.$thumb.' -> '.$destin.'/'.$file.'/'.$thumb.'<br>'."\n"; |
| 4627 | 4731 | print '.'; |
@@ -140,8 +140,11 @@ discard block |
||
| 140 | 140 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; |
| 141 | 141 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; |
| 142 | 142 | $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')'; |
| 143 | - if ($ref) $sql .= " AND cs.rowid = ".$ref; |
|
| 144 | - else $sql .= " AND cs.rowid = ".$id; |
|
| 143 | + if ($ref) { |
|
| 144 | + $sql .= " AND cs.rowid = ".$ref; |
|
| 145 | + } else { |
|
| 146 | + $sql .= " AND cs.rowid = ".$id; |
|
| 147 | + } |
|
| 145 | 148 | |
| 146 | 149 | dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
| 147 | 150 | $resql = $this->db->query($sql); |
@@ -243,7 +246,9 @@ discard block |
||
| 243 | 246 | |
| 244 | 247 | //dol_syslog("ChargesSociales::create this->id=".$this->id); |
| 245 | 248 | $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user); |
| 246 | - if ($result < 0) $error++; |
|
| 249 | + if ($result < 0) { |
|
| 250 | + $error++; |
|
| 251 | + } |
|
| 247 | 252 | |
| 248 | 253 | if (empty($error)) { |
| 249 | 254 | $this->db->commit(); |
@@ -362,7 +367,9 @@ discard block |
||
| 362 | 367 | { |
| 363 | 368 | // Call trigger |
| 364 | 369 | $result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user); |
| 365 | - if ($result < 0) $error++; |
|
| 370 | + if ($result < 0) { |
|
| 371 | + $error++; |
|
| 372 | + } |
|
| 366 | 373 | // End call triggers |
| 367 | 374 | } |
| 368 | 375 | } |
@@ -433,8 +440,11 @@ discard block |
||
| 433 | 440 | $sql .= " paye = 1"; |
| 434 | 441 | $sql .= " WHERE rowid = ".$this->id; |
| 435 | 442 | $return = $this->db->query($sql); |
| 436 | - if ($return) return 1; |
|
| 437 | - else return -1; |
|
| 443 | + if ($return) { |
|
| 444 | + return 1; |
|
| 445 | + } else { |
|
| 446 | + return -1; |
|
| 447 | + } |
|
| 438 | 448 | } |
| 439 | 449 | |
| 440 | 450 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
@@ -451,8 +461,11 @@ discard block |
||
| 451 | 461 | $sql .= " paye = 0"; |
| 452 | 462 | $sql .= " WHERE rowid = ".$this->id; |
| 453 | 463 | $return = $this->db->query($sql); |
| 454 | - if ($return) return 1; |
|
| 455 | - else return -1; |
|
| 464 | + if ($return) { |
|
| 465 | + return 1; |
|
| 466 | + } else { |
|
| 467 | + return -1; |
|
| 468 | + } |
|
| 456 | 469 | } |
| 457 | 470 | |
| 458 | 471 | /** |
@@ -494,15 +507,23 @@ discard block |
||
| 494 | 507 | //$langs->load("mymodule"); |
| 495 | 508 | $this->labelStatus[self::STATUS_UNPAID] = $langs->trans('Unpaid'); |
| 496 | 509 | $this->labelStatus[self::STATUS_PAID] = $langs->trans('Paid'); |
| 497 | - if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); |
|
| 510 | + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) { |
|
| 511 | + $this->labelStatus[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); |
|
| 512 | + } |
|
| 498 | 513 | $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans('Unpaid'); |
| 499 | 514 | $this->labelStatusShort[self::STATUS_PAID] = $langs->trans('Paid'); |
| 500 | - if ($status == self::STATUS_UNPAID && $alreadypaid > 0) $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); |
|
| 515 | + if ($status == self::STATUS_UNPAID && $alreadypaid > 0) { |
|
| 516 | + $this->labelStatusShort[self::STATUS_UNPAID] = $langs->trans("BillStatusStarted"); |
|
| 517 | + } |
|
| 501 | 518 | } |
| 502 | 519 | |
| 503 | 520 | $statusType = 'status1'; |
| 504 | - if ($status == 0 && $alreadypaid > 0) $statusType = 'status3'; |
|
| 505 | - if ($status == 1) $statusType = 'status6'; |
|
| 521 | + if ($status == 0 && $alreadypaid > 0) { |
|
| 522 | + $statusType = 'status3'; |
|
| 523 | + } |
|
| 524 | + if ($status == 1) { |
|
| 525 | + $statusType = 'status6'; |
|
| 526 | + } |
|
| 506 | 527 | |
| 507 | 528 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
| 508 | 529 | } |
@@ -522,34 +543,48 @@ discard block |
||
| 522 | 543 | { |
| 523 | 544 | global $langs, $conf, $user, $form; |
| 524 | 545 | |
| 525 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 546 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 547 | + $notooltip = 1; |
|
| 548 | + } |
|
| 549 | + // Force disable tooltips |
|
| 526 | 550 | |
| 527 | 551 | $result = ''; |
| 528 | 552 | |
| 529 | 553 | $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id; |
| 530 | 554 | |
| 531 | - if ($short) return $url; |
|
| 555 | + if ($short) { |
|
| 556 | + return $url; |
|
| 557 | + } |
|
| 532 | 558 | |
| 533 | 559 | if ($option !== 'nolink') |
| 534 | 560 | { |
| 535 | 561 | // Add param to save lastsearch_values or not |
| 536 | 562 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 537 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
| 538 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
| 563 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 564 | + $add_save_lastsearch_values = 1; |
|
| 565 | + } |
|
| 566 | + if ($add_save_lastsearch_values) { |
|
| 567 | + $url .= '&save_lastsearch_values=1'; |
|
| 568 | + } |
|
| 539 | 569 | } |
| 540 | 570 | |
| 541 | - if (empty($this->ref)) $this->ref = $this->label; |
|
| 571 | + if (empty($this->ref)) { |
|
| 572 | + $this->ref = $this->label; |
|
| 573 | + } |
|
| 542 | 574 | |
| 543 | 575 | $label = img_picto('', 'tax').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>'; |
| 544 | 576 | if (isset($this->paye)) { |
| 545 | 577 | $label .= ' '.$this->getLibStatut(5); |
| 546 | 578 | } |
| 547 | - if (!empty($this->ref)) |
|
| 548 | - $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 549 | - if (!empty($this->label)) |
|
| 550 | - $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
|
| 551 | - if (!empty($this->type_label)) |
|
| 552 | - $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label; |
|
| 579 | + if (!empty($this->ref)) { |
|
| 580 | + $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 581 | + } |
|
| 582 | + if (!empty($this->label)) { |
|
| 583 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
|
| 584 | + } |
|
| 585 | + if (!empty($this->type_label)) { |
|
| 586 | + $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label; |
|
| 587 | + } |
|
| 553 | 588 | |
| 554 | 589 | $linkclose = ''; |
| 555 | 590 | if (empty($notooltip) && $user->rights->facture->lire) |
@@ -568,8 +603,12 @@ discard block |
||
| 568 | 603 | $linkend = '</a>'; |
| 569 | 604 | |
| 570 | 605 | $result .= $linkstart; |
| 571 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 572 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 606 | + if ($withpicto) { |
|
| 607 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 608 | + } |
|
| 609 | + if ($withpicto != 2) { |
|
| 610 | + $result .= $this->ref; |
|
| 611 | + } |
|
| 573 | 612 | $result .= $linkend; |
| 574 | 613 | |
| 575 | 614 | return $result; |
@@ -595,7 +634,9 @@ discard block |
||
| 595 | 634 | $amount = 0; |
| 596 | 635 | |
| 597 | 636 | $obj = $this->db->fetch_object($resql); |
| 598 | - if ($obj) $amount = $obj->amount ? $obj->amount : 0; |
|
| 637 | + if ($obj) { |
|
| 638 | + $amount = $obj->amount ? $obj->amount : 0; |
|
| 639 | + } |
|
| 599 | 640 | |
| 600 | 641 | $this->db->free($resql); |
| 601 | 642 | return $amount; |
@@ -218,7 +218,9 @@ discard block |
||
| 218 | 218 | $this->titre = trim(isset($this->titre) ? $this->titre : $this->title); // deprecated |
| 219 | 219 | $this->title = trim($this->title); |
| 220 | 220 | $this->usenewprice = empty($this->usenewprice) ? 0 : $this->usenewprice; |
| 221 | - if (empty($this->suspended)) $this->suspended = 0; |
|
| 221 | + if (empty($this->suspended)) { |
|
| 222 | + $this->suspended = 0; |
|
| 223 | + } |
|
| 222 | 224 | |
| 223 | 225 | // No frequency defined then no next date to execution |
| 224 | 226 | if (empty($this->frequency)) |
@@ -315,7 +317,9 @@ discard block |
||
| 315 | 317 | for ($i = 0; $i < $num; $i++) |
| 316 | 318 | { |
| 317 | 319 | $tva_tx = $facsrc->lines[$i]->tva_tx; |
| 318 | - if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; |
|
| 320 | + if (!empty($facsrc->lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { |
|
| 321 | + $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')'; |
|
| 322 | + } |
|
| 319 | 323 | |
| 320 | 324 | $result_insert = $this->addline( |
| 321 | 325 | $facsrc->lines[$i]->desc, |
@@ -360,9 +364,12 @@ discard block |
||
| 360 | 364 | } |
| 361 | 365 | } |
| 362 | 366 | |
| 363 | - if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects |
|
| 367 | + if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) { |
|
| 368 | + // To use new linkedObjectsIds instead of old linked_objects |
|
| 364 | 369 | { |
| 365 | - $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds |
|
| 370 | + $this->linked_objects = $this->linkedObjectsIds; |
|
| 371 | + } |
|
| 372 | + // TODO Replace linked_objects with linkedObjectsIds |
|
| 366 | 373 | } |
| 367 | 374 | |
| 368 | 375 | // Add object linked |
@@ -370,11 +377,13 @@ discard block |
||
| 370 | 377 | { |
| 371 | 378 | foreach ($this->linked_objects as $origin => $tmp_origin_id) |
| 372 | 379 | { |
| 373 | - if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) |
|
| 380 | + if (is_array($tmp_origin_id)) { |
|
| 381 | + // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) |
|
| 374 | 382 | { |
| 375 | 383 | foreach ($tmp_origin_id as $origin_id) |
| 376 | 384 | { |
| 377 | 385 | $ret = $this->add_object_linked($origin, $origin_id); |
| 386 | + } |
|
| 378 | 387 | if (!$ret) |
| 379 | 388 | { |
| 380 | 389 | $this->error = $this->db->lasterror(); |
@@ -512,8 +521,11 @@ discard block |
||
| 512 | 521 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
| 513 | 522 | //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; |
| 514 | 523 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
| 515 | - if ($rowid) $sql .= ' AND f.rowid='.$rowid; |
|
| 516 | - elseif ($ref) $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
|
| 524 | + if ($rowid) { |
|
| 525 | + $sql .= ' AND f.rowid='.$rowid; |
|
| 526 | + } elseif ($ref) { |
|
| 527 | + $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
|
| 528 | + } |
|
| 517 | 529 | /* This field are not used for template invoice |
| 518 | 530 | if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'"; |
| 519 | 531 | if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'"; |
@@ -584,7 +596,9 @@ discard block |
||
| 584 | 596 | $this->multicurrency_total_tva = $obj->multicurrency_total_tva; |
| 585 | 597 | $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; |
| 586 | 598 | |
| 587 | - if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; |
|
| 599 | + if ($this->statut == self::STATUS_DRAFT) { |
|
| 600 | + $this->brouillon = 1; |
|
| 601 | + } |
|
| 588 | 602 | |
| 589 | 603 | // Retrieve all extrafield |
| 590 | 604 | // fetch optionals attributes and labels |
@@ -772,10 +786,14 @@ discard block |
||
| 772 | 786 | { |
| 773 | 787 | // Delete linked object |
| 774 | 788 | $res = $this->deleteObjectLinked(); |
| 775 | - if ($res < 0) $error = -3; |
|
| 789 | + if ($res < 0) { |
|
| 790 | + $error = -3; |
|
| 791 | + } |
|
| 776 | 792 | // Delete extrafields |
| 777 | 793 | $res = $this->deleteExtraFields(); |
| 778 | - if ($res < 0) $error = -4; |
|
| 794 | + if ($res < 0) { |
|
| 795 | + $error = -4; |
|
| 796 | + } |
|
| 779 | 797 | } else { |
| 780 | 798 | $this->error = $this->db->lasterror(); |
| 781 | 799 | $error = -1; |
@@ -833,7 +851,9 @@ discard block |
||
| 833 | 851 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 834 | 852 | |
| 835 | 853 | // Check parameters |
| 836 | - if ($type < 0) return -1; |
|
| 854 | + if ($type < 0) { |
|
| 855 | + return -1; |
|
| 856 | + } |
|
| 837 | 857 | |
| 838 | 858 | $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); |
| 839 | 859 | |
@@ -849,17 +869,27 @@ discard block |
||
| 849 | 869 | { |
| 850 | 870 | // Clean parameters |
| 851 | 871 | $remise_percent = price2num($remise_percent); |
| 852 | - if (empty($remise_percent)) $remise_percent = 0; |
|
| 872 | + if (empty($remise_percent)) { |
|
| 873 | + $remise_percent = 0; |
|
| 874 | + } |
|
| 853 | 875 | $qty = price2num($qty); |
| 854 | 876 | $pu_ht = price2num($pu_ht); |
| 855 | 877 | $pu_ttc = price2num($pu_ttc); |
| 856 | 878 | $txtva = price2num($txtva); |
| 857 | 879 | $txlocaltax1 = price2num($txlocaltax1); |
| 858 | 880 | $txlocaltax2 = price2num($txlocaltax2); |
| 859 | - if (empty($txtva)) $txtva = 0; |
|
| 860 | - if (empty($txlocaltax1)) $txlocaltax1 = 0; |
|
| 861 | - if (empty($txlocaltax2)) $txlocaltax2 = 0; |
|
| 862 | - if (empty($info_bits)) $info_bits = 0; |
|
| 881 | + if (empty($txtva)) { |
|
| 882 | + $txtva = 0; |
|
| 883 | + } |
|
| 884 | + if (empty($txlocaltax1)) { |
|
| 885 | + $txlocaltax1 = 0; |
|
| 886 | + } |
|
| 887 | + if (empty($txlocaltax2)) { |
|
| 888 | + $txlocaltax2 = 0; |
|
| 889 | + } |
|
| 890 | + if (empty($info_bits)) { |
|
| 891 | + $info_bits = 0; |
|
| 892 | + } |
|
| 863 | 893 | |
| 864 | 894 | if ($price_base_type == 'HT') |
| 865 | 895 | { |
@@ -1017,30 +1047,48 @@ discard block |
||
| 1017 | 1047 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 1018 | 1048 | |
| 1019 | 1049 | // Clean parameters |
| 1020 | - if (empty($remise_percent)) $remise_percent = 0; |
|
| 1050 | + if (empty($remise_percent)) { |
|
| 1051 | + $remise_percent = 0; |
|
| 1052 | + } |
|
| 1021 | 1053 | |
| 1022 | 1054 | // Check parameters |
| 1023 | - if ($type < 0) return -1; |
|
| 1055 | + if ($type < 0) { |
|
| 1056 | + return -1; |
|
| 1057 | + } |
|
| 1024 | 1058 | |
| 1025 | 1059 | if ($this->brouillon) |
| 1026 | 1060 | { |
| 1027 | 1061 | // Clean parameters |
| 1028 | 1062 | $remise_percent = price2num($remise_percent); |
| 1029 | 1063 | $qty = price2num($qty); |
| 1030 | - if (empty($info_bits)) $info_bits = 0; |
|
| 1064 | + if (empty($info_bits)) { |
|
| 1065 | + $info_bits = 0; |
|
| 1066 | + } |
|
| 1031 | 1067 | $pu_ht = price2num($pu_ht); |
| 1032 | 1068 | $pu_ttc = price2num($pu_ttc); |
| 1033 | 1069 | $pu_ht_devise = price2num($pu_ht_devise); |
| 1034 | 1070 | $txtva = price2num($txtva); |
| 1035 | 1071 | $txlocaltax1 = price2num($txlocaltax1); |
| 1036 | 1072 | $txlocaltax2 = price2num($txlocaltax2); |
| 1037 | - if (empty($txlocaltax1)) $txlocaltax1 = 0; |
|
| 1038 | - if (empty($txlocaltax2)) $txlocaltax2 = 0; |
|
| 1073 | + if (empty($txlocaltax1)) { |
|
| 1074 | + $txlocaltax1 = 0; |
|
| 1075 | + } |
|
| 1076 | + if (empty($txlocaltax2)) { |
|
| 1077 | + $txlocaltax2 = 0; |
|
| 1078 | + } |
|
| 1039 | 1079 | |
| 1040 | - if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice = 0; |
|
| 1041 | - if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht = 0; |
|
| 1042 | - if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva = 0; |
|
| 1043 | - if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc = 0; |
|
| 1080 | + if (empty($this->multicurrency_subprice)) { |
|
| 1081 | + $this->multicurrency_subprice = 0; |
|
| 1082 | + } |
|
| 1083 | + if (empty($this->multicurrency_total_ht)) { |
|
| 1084 | + $this->multicurrency_total_ht = 0; |
|
| 1085 | + } |
|
| 1086 | + if (empty($this->multicurrency_total_tva)) { |
|
| 1087 | + $this->multicurrency_total_tva = 0; |
|
| 1088 | + } |
|
| 1089 | + if (empty($this->multicurrency_total_ttc)) { |
|
| 1090 | + $this->multicurrency_total_ttc = 0; |
|
| 1091 | + } |
|
| 1044 | 1092 | |
| 1045 | 1093 | if ($price_base_type == 'HT') |
| 1046 | 1094 | { |
@@ -1144,7 +1192,9 @@ discard block |
||
| 1144 | 1192 | */ |
| 1145 | 1193 | public function getNextDate() |
| 1146 | 1194 | { |
| 1147 | - if (empty($this->date_when)) return false; |
|
| 1195 | + if (empty($this->date_when)) { |
|
| 1196 | + return false; |
|
| 1197 | + } |
|
| 1148 | 1198 | return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); |
| 1149 | 1199 | } |
| 1150 | 1200 | |
@@ -1156,7 +1206,9 @@ discard block |
||
| 1156 | 1206 | public function isMaxNbGenReached() |
| 1157 | 1207 | { |
| 1158 | 1208 | $ret = false; |
| 1159 | - if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) $ret = true; |
|
| 1209 | + if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) { |
|
| 1210 | + $ret = true; |
|
| 1211 | + } |
|
| 1160 | 1212 | return $ret; |
| 1161 | 1213 | } |
| 1162 | 1214 | |
@@ -1204,8 +1256,9 @@ discard block |
||
| 1204 | 1256 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
| 1205 | 1257 | $sql .= ' AND suspended = 0'; |
| 1206 | 1258 | $sql .= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here |
| 1207 | - if ($restrictioninvoiceid > 0) |
|
| 1208 | - $sql .= ' AND rowid = '.$restrictioninvoiceid; |
|
| 1259 | + if ($restrictioninvoiceid > 0) { |
|
| 1260 | + $sql .= ' AND rowid = '.$restrictioninvoiceid; |
|
| 1261 | + } |
|
| 1209 | 1262 | $sql .= $this->db->order('entity', 'ASC'); |
| 1210 | 1263 | //print $sql;exit; |
| 1211 | 1264 | $parameters = array( |
@@ -1220,15 +1273,19 @@ discard block |
||
| 1220 | 1273 | $i = 0; |
| 1221 | 1274 | $num = $this->db->num_rows($resql); |
| 1222 | 1275 | |
| 1223 | - if ($num) |
|
| 1224 | - $this->output .= $langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; |
|
| 1225 | - else $this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); |
|
| 1276 | + if ($num) { |
|
| 1277 | + $this->output .= $langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; |
|
| 1278 | + } else { |
|
| 1279 | + $this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); |
|
| 1280 | + } |
|
| 1226 | 1281 | |
| 1227 | 1282 | $saventity = $conf->entity; |
| 1228 | 1283 | |
| 1229 | - while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass. |
|
| 1284 | + while ($i < $num) { |
|
| 1285 | + // Loop on each template invoice. If $num = 0, test is false at first pass. |
|
| 1230 | 1286 | { |
| 1231 | 1287 | $line = $this->db->fetch_object($resql); |
| 1288 | + } |
|
| 1232 | 1289 | |
| 1233 | 1290 | $this->db->begin(); |
| 1234 | 1291 | |
@@ -1314,7 +1371,9 @@ discard block |
||
| 1314 | 1371 | } |
| 1315 | 1372 | |
| 1316 | 1373 | $conf->entity = $saventity; // Restore entity context |
| 1317 | - } else dol_print_error($this->db); |
|
| 1374 | + } else { |
|
| 1375 | + dol_print_error($this->db); |
|
| 1376 | + } |
|
| 1318 | 1377 | |
| 1319 | 1378 | $this->output = trim($this->output); |
| 1320 | 1379 | |
@@ -1353,28 +1412,40 @@ discard block |
||
| 1353 | 1412 | if (!empty($this->date_when)) { |
| 1354 | 1413 | $label .= '<br><b>'.$langs->trans('NextDateToExecution').':</b> '; |
| 1355 | 1414 | $label .= (empty($this->suspended) ? '' : '<strike>').dol_print_date($this->date_when, 'day').(empty($this->suspended) ? '' : '</strike>'); // No hour for this property |
| 1356 | - if (!empty($this->suspended)) $label .= ' ('.$langs->trans("Disabled").')'; |
|
| 1415 | + if (!empty($this->suspended)) { |
|
| 1416 | + $label .= ' ('.$langs->trans("Disabled").')'; |
|
| 1417 | + } |
|
| 1357 | 1418 | } |
| 1358 | 1419 | } |
| 1359 | 1420 | |
| 1360 | 1421 | $url = DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$this->id; |
| 1361 | 1422 | |
| 1362 | - if ($short) return $url; |
|
| 1423 | + if ($short) { |
|
| 1424 | + return $url; |
|
| 1425 | + } |
|
| 1363 | 1426 | |
| 1364 | 1427 | if ($option != 'nolink') |
| 1365 | 1428 | { |
| 1366 | 1429 | // Add param to save lastsearch_values or not |
| 1367 | 1430 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 1368 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
| 1369 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
| 1431 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 1432 | + $add_save_lastsearch_values = 1; |
|
| 1433 | + } |
|
| 1434 | + if ($add_save_lastsearch_values) { |
|
| 1435 | + $url .= '&save_lastsearch_values=1'; |
|
| 1436 | + } |
|
| 1370 | 1437 | } |
| 1371 | 1438 | |
| 1372 | 1439 | $linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; |
| 1373 | 1440 | $linkend = '</a>'; |
| 1374 | 1441 | |
| 1375 | 1442 | $result .= $linkstart; |
| 1376 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1377 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 1443 | + if ($withpicto) { |
|
| 1444 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1445 | + } |
|
| 1446 | + if ($withpicto != 2) { |
|
| 1447 | + $result .= $this->ref; |
|
| 1448 | + } |
|
| 1378 | 1449 | $result .= $linkend; |
| 1379 | 1450 | |
| 1380 | 1451 | return $result; |
@@ -1512,7 +1583,9 @@ discard block |
||
| 1512 | 1583 | } elseif ($mode == 5 || $mode == 6) |
| 1513 | 1584 | { |
| 1514 | 1585 | $prefix = ''; |
| 1515 | - if ($mode == 5) $prefix = 'Short'; |
|
| 1586 | + if ($mode == 5) { |
|
| 1587 | + $prefix = 'Short'; |
|
| 1588 | + } |
|
| 1516 | 1589 | if ($recur) |
| 1517 | 1590 | { |
| 1518 | 1591 | if ($status == self::STATUS_SUSPENDED) { |
@@ -1533,7 +1606,9 @@ discard block |
||
| 1533 | 1606 | } |
| 1534 | 1607 | } |
| 1535 | 1608 | |
| 1536 | - if (empty($labelStatusShort)) $labelStatusShort = $labelStatus; |
|
| 1609 | + if (empty($labelStatusShort)) { |
|
| 1610 | + $labelStatusShort = $labelStatus; |
|
| 1611 | + } |
|
| 1537 | 1612 | |
| 1538 | 1613 | return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); |
| 1539 | 1614 | } |
@@ -1609,24 +1684,30 @@ discard block |
||
| 1609 | 1684 | $line->localtax1_tx = 0; |
| 1610 | 1685 | $line->localtax2_tx = 0; |
| 1611 | 1686 | $line->remise_percent = 0; |
| 1612 | - if ($xnbp == 1) // Qty is negative (product line) |
|
| 1687 | + if ($xnbp == 1) { |
|
| 1688 | + // Qty is negative (product line) |
|
| 1613 | 1689 | { |
| 1614 | 1690 | $prodid = mt_rand(1, $num_prods); |
| 1691 | + } |
|
| 1615 | 1692 | $line->fk_product = $prodids[$prodid]; |
| 1616 | 1693 | $line->qty = -1; |
| 1617 | 1694 | $line->total_ht = -100; |
| 1618 | 1695 | $line->total_ttc = -119.6; |
| 1619 | 1696 | $line->total_tva = -19.6; |
| 1620 | - } elseif ($xnbp == 2) // UP is negative (free line) |
|
| 1697 | + } elseif ($xnbp == 2) { |
|
| 1698 | + // UP is negative (free line) |
|
| 1621 | 1699 | { |
| 1622 | 1700 | $line->subprice = -100; |
| 1701 | + } |
|
| 1623 | 1702 | $line->total_ht = -100; |
| 1624 | 1703 | $line->total_ttc = -119.6; |
| 1625 | 1704 | $line->total_tva = -19.6; |
| 1626 | 1705 | $line->remise_percent = 0; |
| 1627 | - } elseif ($xnbp == 3) // Discount is 50% (product line) |
|
| 1706 | + } elseif ($xnbp == 3) { |
|
| 1707 | + // Discount is 50% (product line) |
|
| 1628 | 1708 | { |
| 1629 | 1709 | $prodid = mt_rand(1, $num_prods); |
| 1710 | + } |
|
| 1630 | 1711 | $line->fk_product = $prodids[$prodid]; |
| 1631 | 1712 | $line->total_ht = 50; |
| 1632 | 1713 | $line->total_ttc = 59.8; |
@@ -1719,7 +1800,9 @@ discard block |
||
| 1719 | 1800 | dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG); |
| 1720 | 1801 | if ($this->db->query($sql)) { |
| 1721 | 1802 | $this->frequency = $frequency; |
| 1722 | - if (!empty($unit)) $this->unit_frequency = $unit; |
|
| 1803 | + if (!empty($unit)) { |
|
| 1804 | + $this->unit_frequency = $unit; |
|
| 1805 | + } |
|
| 1723 | 1806 | return 1; |
| 1724 | 1807 | } else { |
| 1725 | 1808 | dol_print_error($this->db); |
@@ -1743,14 +1826,18 @@ discard block |
||
| 1743 | 1826 | } |
| 1744 | 1827 | $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; |
| 1745 | 1828 | $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "null"); |
| 1746 | - if ($increment_nb_gen_done > 0) $sql .= ', nb_gen_done = nb_gen_done + 1'; |
|
| 1829 | + if ($increment_nb_gen_done > 0) { |
|
| 1830 | + $sql .= ', nb_gen_done = nb_gen_done + 1'; |
|
| 1831 | + } |
|
| 1747 | 1832 | $sql .= ' WHERE rowid = '.$this->id; |
| 1748 | 1833 | |
| 1749 | 1834 | dol_syslog(get_class($this)."::setNextDate", LOG_DEBUG); |
| 1750 | 1835 | if ($this->db->query($sql)) |
| 1751 | 1836 | { |
| 1752 | 1837 | $this->date_when = $date; |
| 1753 | - if ($increment_nb_gen_done > 0) $this->nb_gen_done++; |
|
| 1838 | + if ($increment_nb_gen_done > 0) { |
|
| 1839 | + $this->nb_gen_done++; |
|
| 1840 | + } |
|
| 1754 | 1841 | return 1; |
| 1755 | 1842 | } else { |
| 1756 | 1843 | dol_print_error($this->db); |
@@ -1772,7 +1859,9 @@ discard block |
||
| 1772 | 1859 | return -1; |
| 1773 | 1860 | } |
| 1774 | 1861 | |
| 1775 | - if (empty($nb)) $nb = 0; |
|
| 1862 | + if (empty($nb)) { |
|
| 1863 | + $nb = 0; |
|
| 1864 | + } |
|
| 1776 | 1865 | |
| 1777 | 1866 | $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; |
| 1778 | 1867 | $sql .= ' SET nb_gen_max = '.$nb; |
@@ -78,7 +78,9 @@ discard block |
||
| 78 | 78 | $ret = delDocumentModel($value, $type); |
| 79 | 79 | if ($ret > 0) |
| 80 | 80 | { |
| 81 | - if ($conf->global->TICKET_ADDON_PDF == "$value") dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity); |
|
| 81 | + if ($conf->global->TICKET_ADDON_PDF == "$value") { |
|
| 82 | + dolibarr_del_const($db, 'TICKET_ADDON_PDF', $conf->entity); |
|
| 83 | + } |
|
| 82 | 84 | } |
| 83 | 85 | } |
| 84 | 86 | |
@@ -97,9 +99,7 @@ discard block |
||
| 97 | 99 | { |
| 98 | 100 | $ret = addDocumentModel($value, $type, $label, $scandir); |
| 99 | 101 | } |
| 100 | -} |
|
| 101 | - |
|
| 102 | -elseif ($action == 'setmod') { |
|
| 102 | +} elseif ($action == 'setmod') { |
|
| 103 | 103 | // TODO Verifier si module numerotation choisi peut etre active |
| 104 | 104 | // par appel methode canBeActivated |
| 105 | 105 | |
@@ -399,16 +399,23 @@ discard block |
||
| 399 | 399 | $module = new $classname($db); |
| 400 | 400 | |
| 401 | 401 | $modulequalified = 1; |
| 402 | - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; |
|
| 403 | - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; |
|
| 402 | + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { |
|
| 403 | + $modulequalified = 0; |
|
| 404 | + } |
|
| 405 | + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { |
|
| 406 | + $modulequalified = 0; |
|
| 407 | + } |
|
| 404 | 408 | |
| 405 | 409 | if ($modulequalified) |
| 406 | 410 | { |
| 407 | 411 | print '<tr class="oddeven"><td width="100">'; |
| 408 | 412 | print (empty($module->name) ? $name : $module->name); |
| 409 | 413 | print "</td><td>\n"; |
| 410 | - if (method_exists($module, 'info')) print $module->info($langs); |
|
| 411 | - else print $module->description; |
|
| 414 | + if (method_exists($module, 'info')) { |
|
| 415 | + print $module->info($langs); |
|
| 416 | + } else { |
|
| 417 | + print $module->description; |
|
| 418 | + } |
|
| 412 | 419 | print '</td>'; |
| 413 | 420 | |
| 414 | 421 | // Active |
@@ -201,8 +201,7 @@ discard block |
||
| 201 | 201 | if ($result <= 0) { |
| 202 | 202 | throw new RestException(500, 'Error generating document'); |
| 203 | 203 | } |
| 204 | - } |
|
| 205 | - elseif ($modulepart == 'commande' || $modulepart == 'order') |
|
| 204 | + } elseif ($modulepart == 'commande' || $modulepart == 'order') |
|
| 206 | 205 | { |
| 207 | 206 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
| 208 | 207 | $this->order = new Commande($this->db); |
@@ -215,8 +214,7 @@ discard block |
||
| 215 | 214 | if ($result <= 0) { |
| 216 | 215 | throw new RestException(500, 'Error generating document'); |
| 217 | 216 | } |
| 218 | - } |
|
| 219 | - elseif ($modulepart == 'propal' || $modulepart == 'proposal') |
|
| 217 | + } elseif ($modulepart == 'propal' || $modulepart == 'proposal') |
|
| 220 | 218 | { |
| 221 | 219 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
| 222 | 220 | $this->propal = new Propal($this->db); |
@@ -293,8 +291,7 @@ discard block |
||
| 293 | 291 | } |
| 294 | 292 | |
| 295 | 293 | $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; |
| 296 | - } |
|
| 297 | - elseif ($modulepart == 'user') |
|
| 294 | + } elseif ($modulepart == 'user') |
|
| 298 | 295 | { |
| 299 | 296 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
| 300 | 297 | |
@@ -310,8 +307,7 @@ discard block |
||
| 310 | 307 | } |
| 311 | 308 | |
| 312 | 309 | $upload_dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id; |
| 313 | - } |
|
| 314 | - elseif ($modulepart == 'adherent' || $modulepart == 'member') |
|
| 310 | + } elseif ($modulepart == 'adherent' || $modulepart == 'member') |
|
| 315 | 311 | { |
| 316 | 312 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
| 317 | 313 | |
@@ -326,8 +322,7 @@ discard block |
||
| 326 | 322 | } |
| 327 | 323 | |
| 328 | 324 | $upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member'); |
| 329 | - } |
|
| 330 | - elseif ($modulepart == 'propal' || $modulepart == 'proposal') |
|
| 325 | + } elseif ($modulepart == 'propal' || $modulepart == 'proposal') |
|
| 331 | 326 | { |
| 332 | 327 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
| 333 | 328 | |
@@ -342,8 +337,7 @@ discard block |
||
| 342 | 337 | } |
| 343 | 338 | |
| 344 | 339 | $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); |
| 345 | - } |
|
| 346 | - elseif ($modulepart == 'commande' || $modulepart == 'order') |
|
| 340 | + } elseif ($modulepart == 'commande' || $modulepart == 'order') |
|
| 347 | 341 | { |
| 348 | 342 | require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
| 349 | 343 | |
@@ -358,8 +352,7 @@ discard block |
||
| 358 | 352 | } |
| 359 | 353 | |
| 360 | 354 | $upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande'); |
| 361 | - } |
|
| 362 | - elseif ($modulepart == 'shipment' || $modulepart == 'expedition') |
|
| 355 | + } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') |
|
| 363 | 356 | { |
| 364 | 357 | require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
| 365 | 358 | |
@@ -374,8 +367,7 @@ discard block |
||
| 374 | 367 | } |
| 375 | 368 | |
| 376 | 369 | $upload_dir = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); |
| 377 | - } |
|
| 378 | - elseif ($modulepart == 'facture' || $modulepart == 'invoice') |
|
| 370 | + } elseif ($modulepart == 'facture' || $modulepart == 'invoice') |
|
| 379 | 371 | { |
| 380 | 372 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 381 | 373 | |
@@ -390,8 +382,7 @@ discard block |
||
| 390 | 382 | } |
| 391 | 383 | |
| 392 | 384 | $upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); |
| 393 | - } |
|
| 394 | - elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') |
|
| 385 | + } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') |
|
| 395 | 386 | { |
| 396 | 387 | $modulepart = 'supplier_invoice'; |
| 397 | 388 | |
@@ -408,8 +399,7 @@ discard block |
||
| 408 | 399 | } |
| 409 | 400 | |
| 410 | 401 | $upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref); |
| 411 | - } |
|
| 412 | - elseif ($modulepart == 'produit' || $modulepart == 'product') |
|
| 402 | + } elseif ($modulepart == 'produit' || $modulepart == 'product') |
|
| 413 | 403 | { |
| 414 | 404 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 415 | 405 | |
@@ -426,8 +416,7 @@ discard block |
||
| 426 | 416 | } |
| 427 | 417 | |
| 428 | 418 | $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); |
| 429 | - } |
|
| 430 | - elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') |
|
| 419 | + } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') |
|
| 431 | 420 | { |
| 432 | 421 | require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
| 433 | 422 | |
@@ -442,8 +431,7 @@ discard block |
||
| 442 | 431 | } |
| 443 | 432 | |
| 444 | 433 | $upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref); |
| 445 | - } |
|
| 446 | - elseif ($modulepart == 'expensereport') |
|
| 434 | + } elseif ($modulepart == 'expensereport') |
|
| 447 | 435 | { |
| 448 | 436 | require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
| 449 | 437 | |
@@ -458,8 +446,7 @@ discard block |
||
| 458 | 446 | } |
| 459 | 447 | |
| 460 | 448 | $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); |
| 461 | - } |
|
| 462 | - elseif ($modulepart == 'categorie' || $modulepart == 'category') |
|
| 449 | + } elseif ($modulepart == 'categorie' || $modulepart == 'category') |
|
| 463 | 450 | { |
| 464 | 451 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 465 | 452 | |
@@ -571,15 +558,21 @@ discard block |
||
| 571 | 558 | } |
| 572 | 559 | |
| 573 | 560 | $newfilecontent = ''; |
| 574 | - if (empty($fileencoding)) $newfilecontent = $filecontent; |
|
| 575 | - if ($fileencoding == 'base64') $newfilecontent = base64_decode($filecontent); |
|
| 561 | + if (empty($fileencoding)) { |
|
| 562 | + $newfilecontent = $filecontent; |
|
| 563 | + } |
|
| 564 | + if ($fileencoding == 'base64') { |
|
| 565 | + $newfilecontent = base64_decode($filecontent); |
|
| 566 | + } |
|
| 576 | 567 | |
| 577 | 568 | $original_file = dol_sanitizeFileName($filename); |
| 578 | 569 | |
| 579 | 570 | // Define $uploadir |
| 580 | 571 | $object = null; |
| 581 | 572 | $entity = DolibarrApiAccess::$user->entity; |
| 582 | - if (empty($entity)) $entity = 1; |
|
| 573 | + if (empty($entity)) { |
|
| 574 | + $entity = 1; |
|
| 575 | + } |
|
| 583 | 576 | |
| 584 | 577 | if ($ref) |
| 585 | 578 | { |
@@ -591,20 +584,17 @@ discard block |
||
| 591 | 584 | |
| 592 | 585 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
| 593 | 586 | $object = new Facture($this->db); |
| 594 | - } |
|
| 595 | - elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') |
|
| 587 | + } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') |
|
| 596 | 588 | { |
| 597 | 589 | $modulepart = 'supplier_invoice'; |
| 598 | 590 | |
| 599 | 591 | require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
| 600 | 592 | $object = new FactureFournisseur($this->db); |
| 601 | - } |
|
| 602 | - elseif ($modulepart == 'project') |
|
| 593 | + } elseif ($modulepart == 'project') |
|
| 603 | 594 | { |
| 604 | 595 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
| 605 | 596 | $object = new Project($this->db); |
| 606 | - } |
|
| 607 | - elseif ($modulepart == 'task' || $modulepart == 'project_task') |
|
| 597 | + } elseif ($modulepart == 'task' || $modulepart == 'project_task') |
|
| 608 | 598 | { |
| 609 | 599 | $modulepart = 'project_task'; |
| 610 | 600 | |
@@ -625,24 +615,20 @@ discard block |
||
| 625 | 615 | } else { |
| 626 | 616 | throw new RestException(500, 'Error while fetching Task '.$ref); |
| 627 | 617 | } |
| 628 | - } |
|
| 629 | - elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') |
|
| 618 | + } elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') |
|
| 630 | 619 | { |
| 631 | 620 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
| 632 | 621 | $object = new Product($this->db); |
| 633 | - } |
|
| 634 | - elseif ($modulepart == 'expensereport') |
|
| 622 | + } elseif ($modulepart == 'expensereport') |
|
| 635 | 623 | { |
| 636 | 624 | require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
| 637 | 625 | $object = new ExpenseReport($this->db); |
| 638 | - } |
|
| 639 | - elseif ($modulepart == 'adherent' || $modulepart == 'member') |
|
| 626 | + } elseif ($modulepart == 'adherent' || $modulepart == 'member') |
|
| 640 | 627 | { |
| 641 | 628 | $modulepart = 'adherent'; |
| 642 | 629 | require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
| 643 | 630 | $object = new Adherent($this->db); |
| 644 | - } |
|
| 645 | - elseif ($modulepart == 'proposal' || $modulepart == 'propal' || $modulepart == 'propale') |
|
| 631 | + } elseif ($modulepart == 'proposal' || $modulepart == 'propal' || $modulepart == 'propale') |
|
| 646 | 632 | { |
| 647 | 633 | $modulepart = 'propale'; |
| 648 | 634 | require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
@@ -659,8 +645,7 @@ discard block |
||
| 659 | 645 | if ($result == 0) |
| 660 | 646 | { |
| 661 | 647 | throw new RestException(404, "Object with ref '".$ref."' was not found."); |
| 662 | - } |
|
| 663 | - elseif ($result < 0) |
|
| 648 | + } elseif ($result < 0) |
|
| 664 | 649 | { |
| 665 | 650 | throw new RestException(500, 'Error while fetching object: '.$object->error); |
| 666 | 651 | } |
@@ -686,8 +671,12 @@ discard block |
||
| 686 | 671 | throw new RestException(500, 'This value of modulepart ('.$modulepart.') does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); |
| 687 | 672 | } |
| 688 | 673 | } else { |
| 689 | - if ($modulepart == 'invoice') $modulepart = 'facture'; |
|
| 690 | - if ($modulepart == 'member') $modulepart = 'adherent'; |
|
| 674 | + if ($modulepart == 'invoice') { |
|
| 675 | + $modulepart = 'facture'; |
|
| 676 | + } |
|
| 677 | + if ($modulepart == 'member') { |
|
| 678 | + $modulepart = 'adherent'; |
|
| 679 | + } |
|
| 691 | 680 | |
| 692 | 681 | $relativefile = $subdir; |
| 693 | 682 | $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); |
@@ -825,8 +814,9 @@ discard block |
||
| 825 | 814 | // phpcs:enable |
| 826 | 815 | $result = array(); |
| 827 | 816 | foreach (Documents::$DOCUMENT_FIELDS as $field) { |
| 828 | - if (!isset($data[$field])) |
|
| 829 | - throw new RestException(400, "$field field missing"); |
|
| 817 | + if (!isset($data[$field])) { |
|
| 818 | + throw new RestException(400, "$field field missing"); |
|
| 819 | + } |
|
| 830 | 820 | $result[$field] = $data[$field]; |
| 831 | 821 | } |
| 832 | 822 | return $result; |