diff --git a/.travis.yml b/.travis.yml index d5583ef6ff2..3a996915ca7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -347,7 +347,7 @@ script: mysql -e 'DROP DATABASE IF EXISTS travis;' mysql -e 'CREATE DATABASE IF NOT EXISTS travis;' mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;' - mysql -e 'FLUSH PRIVILEGES;' + mysql -e 'FLUSH PRIVILEGES;' mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql fi if [ "$DB" = 'postgresql' ]; then @@ -362,7 +362,7 @@ script: #echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis fi echo - + - | echo "Upgrading Dolibarr" # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. diff --git a/ChangeLog b/ChangeLog index c6b3ee2d89b..d028491db42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,7 +30,7 @@ Following changes may create regressions for some external modules, but were nec ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. The unit were not saved correctly in database making calculation on shipments wrong. -Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version. +Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version. Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored. FIX: #11702 @@ -92,6 +92,9 @@ FIX: Update of leave request when CSRF with token is on FIX: Var not enough sanitized FIX: wrong test FIX: XSS +FIX: Payment from POS ware not recorded. +FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with + VAT that includes a deposit without vat. ***** ChangeLog for 10.0.2 compared to 10.0.1 ***** FIX: #10460 compatibility with MariaDB 10.4 diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 4cf2401d51b..0460f31af30 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -88,11 +88,11 @@ if ($action == 'setlistsorttodo') { if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setlistsortdone') { @@ -100,11 +100,11 @@ if ($action == 'setlistsortdone') { $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setmanagezero') { @@ -112,11 +112,11 @@ if ($action == 'setmanagezero') { $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setdisabledirectinput') { @@ -124,11 +124,11 @@ if ($action == 'setdisabledirectinput') { $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setenabledraftexport') { @@ -136,11 +136,11 @@ if ($action == 'setenabledraftexport') { $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); if (! $res > 0) $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } if ($action == 'setenablesubsidiarylist') { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 96520c4756c..c15ace96ffc 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -180,8 +180,6 @@ if ($massaction == 'ventil') { } $msg.=''; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} else { - // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 77a97b86322..1ec89dfc9cc 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -161,8 +161,6 @@ if ($massaction == 'ventil') { } $msg.=''; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} else { - // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 6e709835f42..7063f7fd53e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -996,7 +996,7 @@ if (empty($action) || $action == 'view') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { - print ''; + print ''; } else { if ($in_bookkeeping == 'notyet') print ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 6cefc893b39..c61cdda4d48 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -306,49 +306,49 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - // get compte id and label - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->date_creation = $now; - $bookkeeping->doc_type = 'expense_report'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; + // get compte id and label + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->date_creation = $now; + $bookkeeping->doc_type = 'expense_report'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = $val["fk_expensereportdet"]; + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; - $accountingaccount->fetch($k, null, true); - $bookkeeping->label_compte = $accountingaccount->label; + $accountingaccount->fetch($k, null, true); + $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; - $bookkeeping->montant = $mt; - $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; - $bookkeeping->debit = ($mt > 0) ? $mt : 0; - $bookkeeping->credit = ($mt <= 0) ? $mt : 0; - $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; - $bookkeeping->fk_user_author = $user->id; - $bookkeeping->entity = $conf->entity; + $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; + $bookkeeping->montant = $mt; + $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; + $bookkeeping->debit = ($mt > 0) ? $mt : 0; + $bookkeeping->credit = ($mt <= 0) ? $mt : 0; + $bookkeeping->code_journal = $journal; + $bookkeeping->journal_label = $journal_label; + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->entity = $conf->entity; - $totaldebit += $bookkeeping->debit; - $totalcredit += $bookkeeping->credit; + $totaldebit += $bookkeeping->debit; + $totalcredit += $bookkeeping->credit; - $result = $bookkeeping->create($user); - if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { - $error++; - $errorforline++; - //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + $result = $bookkeeping->create($user); + if ($result < 0) { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists + { + $error++; + $errorforline++; + //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + } + else + { + $error++; + $errorforline++; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } } - else - { - $error++; - $errorforline++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); - } - } } } } @@ -438,48 +438,48 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print "\n"; foreach ($taber as $key => $val) { - $date = dol_print_date($val["date"], 'day'); + $date = dol_print_date($val["date"], 'day'); - $userstatic->id = $tabuser[$key]['id']; - $userstatic->name = $tabuser[$key]['name']; + $userstatic->id = $tabuser[$key]['id']; + $userstatic->name = $tabuser[$key]['name']; - // Fees - foreach ($tabht[$key] as $k => $mt) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch(null, $k, true); - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; + // Fees + foreach ($tabht[$key] as $k => $mt) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(null, $k, true); + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } } - } - // VAT - foreach ($tabtva[$key] as $k => $mt) { - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; + // VAT + foreach ($tabtva[$key] as $k => $mt) { + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } } - } - // Third party - foreach ($tabttc[$key] as $k => $mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($userstatic->name) . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"'; - } - print "\n"; + // Third party + foreach ($tabttc[$key] as $k => $mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($userstatic->name) . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"'; + } + print "\n"; } } @@ -638,29 +638,29 @@ if (empty($action) || $action == 'view') { if ($numtax == 2) $arrayofvat = $tablocaltax2; foreach ($arrayofvat[$key] as $k => $mt) { - if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $expensereportstatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("VATAccountNotDefined").''; + if ($mt) { + print ''; + print ""; + print "" . $date . ""; + print "" . $expensereportstatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("VATAccountNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); + print ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:''); - print ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - } } } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ddf456c85f0..a3728c7f6f9 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -294,7 +294,61 @@ if ($action == 'writebookkeeping') { if (! $errorforline) { foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->date_lim_reglement = $val["datereg"]; + $bookkeeping->doc_ref = $val["refsologest"]; + $bookkeeping->date_creation = $now; + $bookkeeping->doc_type = 'supplier_invoice'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add + $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $bookkeeping->label_compte = $accountingaccount->label; + + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount"); + $bookkeeping->montant = $mt; + $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; + $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; + $bookkeeping->credit = ($mt > 0) ? $mt : 0; + $bookkeeping->code_journal = $journal; + $bookkeeping->journal_label = $journal_label; + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->entity = $conf->entity; + + $totaldebit += $bookkeeping->debit; + $totalcredit += $bookkeeping->credit; + + $result = $bookkeeping->create($user); + if ($result < 0) { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists + { + $error++; + $errorforline++; + $errorforinvoice[$key]='alreadyjournalized'; + //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + } + else + { + $error++; + $errorforline++; + $errorforinvoice[$key]='other'; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } + } + } + } + + // Product / Service + if (! $errorforline) + { + foreach ($tabht[$key] as $k => $mt) { + // get compte id and label + if ($accountingaccount->fetch(null, $k, true)) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -302,20 +356,17 @@ if ($action == 'writebookkeeping') { $bookkeeping->date_creation = $now; $bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add + $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; - $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; - $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $accountingaccount->label; - - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label; $bookkeeping->montant = $mt; - $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; - $bookkeeping->debit = ($mt <= 0) ? -$mt : 0; - $bookkeeping->credit = ($mt > 0) ? $mt : 0; + $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; + $bookkeeping->debit = ($mt > 0) ? $mt : 0; + $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; $bookkeeping->journal_label = $journal_label; $bookkeeping->fk_user_author = $user->id; @@ -341,62 +392,7 @@ if ($action == 'writebookkeeping') { setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); } } - //} - } - } - - // Product / Service - if (! $errorforline) - { - foreach ($tabht[$key] as $k => $mt) { - //if ($mt) { - // get compte id and label - if ($accountingaccount->fetch(null, $k, true)) { - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->date_lim_reglement = $val["datereg"]; - $bookkeeping->doc_ref = $val["refsologest"]; - $bookkeeping->date_creation = $now; - $bookkeeping->doc_type = 'supplier_invoice'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add - $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label; - $bookkeeping->montant = $mt; - $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; - $bookkeeping->debit = ($mt > 0) ? $mt : 0; - $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; - $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; - $bookkeeping->fk_user_author = $user->id; - $bookkeeping->entity = $conf->entity; - - $totaldebit += $bookkeeping->debit; - $totalcredit += $bookkeeping->credit; - - $result = $bookkeeping->create($user); - if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { - $error++; - $errorforline++; - $errorforinvoice[$key]='alreadyjournalized'; - //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else - { - $error++; - $errorforline++; - $errorforinvoice[$key]='other'; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); - } - } - } - //} + } } } @@ -865,34 +861,32 @@ if (empty($action) || $action == 'view') { // Third party foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; - } - else print $accountoshow; - print ''; - // Subledger account - print ""; - $accountoshow = length_accounta($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; - print ''; - print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . ""; - print ''. ($mt < 0 ? price(- $mt) : '') . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; + } + else print $accountoshow; + print ''; + // Subledger account + print ""; + $accountoshow = length_accounta($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } + else print $accountoshow; + print ''; + print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . ""; + print ''. ($mt < 0 ? price(- $mt) : '') . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print ""; } // Product / Service @@ -900,30 +894,28 @@ if (empty($action) || $action == 'view') { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ProductAccountNotDefined").''; - } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - $companystatic->id = $tabcompany[$key]['id']; - $companystatic->name = $tabcompany[$key]['name']; - print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ProductAccountNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // VAT diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index ed56065df0a..367fa2eb817 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -124,7 +124,7 @@ if ($in_bookkeeping == 'already') if ($in_bookkeeping == 'notyet') { $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; -// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account + // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account } $sql .= " ORDER BY f.datef"; //print $sql; @@ -305,7 +305,61 @@ if ($action == 'writebookkeeping') { if (! $errorforline) { foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { + $bookkeeping = new BookKeeping($db); + $bookkeeping->doc_date = $val["date"]; + $bookkeeping->date_lim_reglement = $val["datereg"]; + $bookkeeping->doc_ref = $val["ref"]; + $bookkeeping->date_creation = $now; + $bookkeeping->doc_type = 'customer_invoice'; + $bookkeeping->fk_doc = $key; + $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add + $bookkeeping->thirdparty_code = $companystatic->code_client; + $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; + $bookkeeping->subledger_label = $tabcompany[$key]['name']; + $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + + $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $bookkeeping->label_compte = $accountingaccount->label; + + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); + $bookkeeping->montant = $mt; + $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; + $bookkeeping->debit = ($mt >= 0) ? $mt : 0; + $bookkeeping->credit = ($mt < 0) ? -$mt : 0; + $bookkeeping->code_journal = $journal; + $bookkeeping->journal_label = $journal_label; + $bookkeeping->fk_user_author = $user->id; + $bookkeeping->entity = $conf->entity; + + $totaldebit += $bookkeeping->debit; + $totalcredit += $bookkeeping->credit; + + $result = $bookkeeping->create($user); + if ($result < 0) { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists + { + $error++; + $errorforline++; + $errorforinvoice[$key]='alreadyjournalized'; + //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); + } + else + { + $error++; + $errorforline++; + $errorforinvoice[$key]='other'; + setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + } + } + } + } + + // Product / Service + if (! $errorforline) + { + foreach ($tabht[$key] as $k => $mt) { + // get compte id and label + if ($accountingaccount->fetch(null, $k, true)) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->date_lim_reglement = $val["datereg"]; @@ -315,18 +369,15 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->thirdparty_code = $companystatic->code_client; - $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; - $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - - $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $bookkeeping->subledger_account = ''; + $bookkeeping->subledger_label = ''; + $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $accountingaccount->label; - - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount"); + $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; $bookkeeping->montant = $mt; - $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt >= 0) ? $mt : 0; - $bookkeeping->credit = ($mt < 0) ? -$mt : 0; + $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; + $bookkeeping->debit = ($mt < 0) ? -$mt : 0; + $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $journal; $bookkeeping->journal_label = $journal_label; $bookkeeping->fk_user_author = $user->id; @@ -352,62 +403,7 @@ if ($action == 'writebookkeeping') { setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); } } - //} - } - } - - // Product / Service - if (! $errorforline) - { - foreach ($tabht[$key] as $k => $mt) { - //if ($mt) { - // get compte id and label - if ($accountingaccount->fetch(null, $k, true)) { - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->date_lim_reglement = $val["datereg"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->date_creation = $now; - $bookkeeping->doc_type = 'customer_invoice'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add - $bookkeeping->thirdparty_code = $companystatic->code_client; - $bookkeeping->subledger_account = ''; - $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; - $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label; - $bookkeeping->montant = $mt; - $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt < 0) ? -$mt : 0; - $bookkeeping->credit = ($mt >= 0) ? $mt : 0; - $bookkeeping->code_journal = $journal; - $bookkeeping->journal_label = $journal_label; - $bookkeeping->fk_user_author = $user->id; - $bookkeeping->entity = $conf->entity; - - $totaldebit += $bookkeeping->debit; - $totalcredit += $bookkeeping->credit; - - $result = $bookkeeping->create($user); - if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { - $error++; - $errorforline++; - $errorforinvoice[$key]='alreadyjournalized'; - //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); - } - else - { - $error++; - $errorforline++; - $errorforinvoice[$key]='other'; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); - } - } - } - //} + } } } @@ -801,34 +797,32 @@ if (empty($action) || $action == 'view') { // Third party foreach ($tabttc[$key] as $k => $mt) { - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("MainAccountForCustomersNotDefined").''; - } - else print $accountoshow; - print ''; - // Subledger account - print ""; - $accountoshow = length_accounta($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - } - else print $accountoshow; - print ''; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("MainAccountForCustomersNotDefined").''; + } + else print $accountoshow; + print ''; + // Subledger account + print ""; + $accountoshow = length_accounta($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ThirdpartyAccountNotDefined").''; + } + else print $accountoshow; + print ''; + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // Product / Service @@ -837,30 +831,28 @@ if (empty($action) || $action == 'view') { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch(null, $k, true); - //if ($mt) { - print ''; - print ""; - print "" . $date . ""; - print "" . $invoicestatic->getNomUrl(1) . ""; - // Account - print ""; - $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') - { - print ''.$langs->trans("ProductNotDefined").''; - } - else print $accountoshow; - print ""; - // Subledger account - print ""; - print ''; - $companystatic->id = $tabcompany[$key]['id']; - $companystatic->name = $tabcompany[$key]['name']; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . ""; - print '' . ($mt < 0 ? price(- $mt) : '') . ""; - print '' . ($mt >= 0 ? price($mt) : '') . ""; - print ""; - //} + print ''; + print ""; + print "" . $date . ""; + print "" . $invoicestatic->getNomUrl(1) . ""; + // Account + print ""; + $accountoshow = length_accountg($k); + if (($accountoshow == "") || $accountoshow == 'NotDefined') + { + print ''.$langs->trans("ProductNotDefined").''; + } + else print $accountoshow; + print ""; + // Subledger account + print ""; + print ''; + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . ""; + print '' . ($mt < 0 ? price(- $mt) : '') . ""; + print '' . ($mt >= 0 ? price($mt) : '') . ""; + print ""; } // VAT diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index fc453a94250..f43749f6958 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -184,8 +184,6 @@ if ($massaction == 'ventil') { } $msg.=''; $msg.= '
' . $langs->trans("EndProcessing") . '
'; - //} else { - // setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings'); } } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 87190bef2fe..9c6f657d5e0 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf)) $contact = $GLOBALS['objcanvas']->control->object; -?> +echo "\n"; +echo $this->control->tpl['showhead']; - -control->tpl['showhead']; ?> - -control->tpl['error'], $this->control->tpl['errors']); -?> - -control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?> -control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?> +if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; +if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?> @@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
-control->tpl['showend']; ?> +control->tpl['showend']; -societe_id)) { ?> -
+if (empty($user->societe_id)) { + echo '
'; -rights->adherent->creer) { ?> -">trans('Modify'); ?> - + if ($user->rights->adherent->creer) { + echo ''.$langs->trans('Modify').''; + } -control->tpl['user_id'] && $user->rights->user->user->creer) { ?> -">trans("CreateDolibarrLogin"); ?> - + if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { + echo ''.$langs->trans("CreateDolibarrLogin").''; + } -rights->adherent->supprimer) { ?> -">trans('Delete'); ?> - + if ($user->rights->adherent->supprimer) { + echo ''.$langs->trans('Delete').''; + } -

-
'; +} echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionsdone']; -?> - +echo "\n"; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4fddc9875e4..6820521a6a4 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -882,18 +882,18 @@ else $object->country_code=$tmparray['code']; $object->country=$tmparray['label']; } - - if (!empty($socid)) { -$object = new Societe($db); -if ($socid > 0) $object->fetch($socid); -if (! ($object->id > 0)) -{ - $langs->load("errors"); - print($langs->trans('ErrorRecordNotFound')); - exit; -} - } + if (!empty($socid)) { + $object = new Societe($db); + if ($socid > 0) $object->fetch($socid); + + if (! ($object->id > 0)) + { + $langs->load("errors"); + print($langs->trans('ErrorRecordNotFound')); + exit; + } + } $adht = new AdherentType($db); @@ -1661,14 +1661,14 @@ if (! ($object->id > 0)) else { if ($object->need_subscription == 0) - { - print $langs->trans("SubscriptionNotNeeded"); + { + print $langs->trans("SubscriptionNotNeeded"); } - elseif (! $adht->subscription) + elseif (! $adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } + } else { print $langs->trans("SubscriptionNotReceived"); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 94216db5f8c..acf62a97068 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2470,7 +2470,7 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** + /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 94df4b10ba0..b4bdb119b29 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -88,8 +88,8 @@ class AdherentType extends CommonObject /** @var array Array of members */ public $members=array(); - - public $multilangs=array(); + + public $multilangs=array(); /** @@ -129,9 +129,9 @@ class AdherentType extends CommonObject $this->description = $obj->description; $this->email = $obj->email; } - $this->multilangs["$obj->lang"]["label"] = $obj->label; - $this->multilangs["$obj->lang"]["description"] = $obj->description; - $this->multilangs["$obj->lang"]["email"] = $obj->email; + $this->multilangs["$obj->lang"]["label"] = $obj->label; + $this->multilangs["$obj->lang"]["description"] = $obj->description; + $this->multilangs["$obj->lang"]["email"] = $obj->email; } return 1; } @@ -141,7 +141,7 @@ class AdherentType extends CommonObject return -1; } } - + /** * Update or add a translation for a product * @@ -248,7 +248,7 @@ class AdherentType extends CommonObject return 1; } - + /** * Delete a language for this product * @@ -361,7 +361,7 @@ class AdherentType extends CommonObject */ public function update($user, $notrigger = 0) { - global $langs, $conf, $hookmanager; + global $langs, $conf, $hookmanager; $error=0; @@ -383,16 +383,16 @@ class AdherentType extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->description = $this->db->escape($this->note); + $this->description = $this->db->escape($this->note); - // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) { - if ($this->setMultiLangs($user) < 0) { - $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; - return -2; - } + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) { + if ($this->setMultiLangs($user) < 0) { + $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; + return -2; } - + } + $action='update'; // Actions on extra fields @@ -474,8 +474,8 @@ class AdherentType extends CommonObject */ public function fetch($rowid) { - global $langs, $conf; - + global $langs, $conf; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -498,11 +498,11 @@ class AdherentType extends CommonObject $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; $this->vote = $obj->vote; - - // multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) { - $this->getMultiLangs(); - } + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) { + $this->getMultiLangs(); + } } return 1; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 8e2ec3ba730..accf7de07b6 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf)) exit; } -?> - - - -\n"; global $user; @@ -39,22 +35,20 @@ $langs->load("members"); $total=0; foreach($linkedObjectBlock as $key => $objectlink) { -?> - - trans("Subscription"); ?> - getNomUrl(1); ?> - - dateh, 'day'); ?> - '; + echo ''.$langs->trans("Subscription").''; + echo ''.$objectlink->getNomUrl(1).''; + echo ''; + echo ''.dol_print_date($objectlink->dateh, 'day').''; + echo ''; if ($user->rights->adherent->lire) { $total = $total + $objectlink->amount; echo price($objectlink->amount); - } ?> - - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> - -'; + echo ''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''; } -?> - +echo "\n"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 2848ed4119e..94978e7f8a9 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -523,14 +523,14 @@ if ($rowid > 0) { $sql.= natural_search("d.email", $search_email); } - if ($filter == 'uptodate') - { - $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; - } - if ($filter == 'outofdate') - { - $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; - } + if ($filter == 'uptodate') + { + $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; + } + if ($filter == 'outofdate') + { + $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; + } $sql.= " ".$db->order($sortfield, $sortorder); diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 5122bebcecf..ac9a269bf29 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -295,7 +295,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) print ''; print ''; print ''; print ''."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Address print ''."\n"; // Code print ''."\n"; +print ''."\n"; // Note print '"; } else diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index b6c9a5dec9a..57031a9822f 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -96,29 +96,29 @@ elseif ($action == 'updateengine') $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object($resql); + while ($i < $num) + { + $obj = $db->fetch_object($resql); - if (GETPOST('coder'.$obj->rowid, 'alpha')) - { - $coder = GETPOST('coder'.$obj->rowid, 'alpha'); - $code_id = $obj->rowid; + if (GETPOST('coder'.$obj->rowid, 'alpha')) + { + $coder = GETPOST('coder'.$obj->rowid, 'alpha'); + $code_id = $obj->rowid; - $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; - $sqlp.= " SET coder = '" . $coder."'"; - $sqlp.= " WHERE rowid = ". $code_id; - $sqlp.= " AND entity = ".$conf->entity; + $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; + $sqlp.= " SET coder = '" . $coder."'"; + $sqlp.= " WHERE rowid = ". $code_id; + $sqlp.= " AND entity = ".$conf->entity; - $upsql=$db->query($sqlp); - if (! $upsql) dol_print_error($db); - } + $upsql=$db->query($sqlp); + if (! $upsql) dol_print_error($db); + } - $i++; - } + $i++; + } } } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 5bf01de1053..26ea1b12a29 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -430,7 +430,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 5bb2dbe79ed..10955b5e8bd 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -470,7 +470,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index e6ea9a2cb17..912995d7817 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -409,7 +409,7 @@ print ''."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Addresse diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 37559c3d4ab..795a38c867d 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -163,7 +163,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp); // Add logic to show/hide buttons if ($conf->use_javascript_ajax) { -?> + ?> -trans("OtherSetup"), '', 'title_setup'); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 0aa97dd36e6..7f123c0f367 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -406,7 +406,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index b39f0a8d143..974fba8fa1d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -563,27 +563,27 @@ $elementList = array(); $sourceList=array(); if ($id == 11) { - $elementList = array( - '' => '', - 'societe' => $langs->trans('ThirdParty'), -// 'proposal' => $langs->trans('Proposal'), -// 'order' => $langs->trans('Order'), -// 'invoice' => $langs->trans('Bill'), - 'supplier_proposal' => $langs->trans('SupplierProposal'), - 'order_supplier' => $langs->trans('SupplierOrder'), - 'invoice_supplier' => $langs->trans('SupplierBill'), -// 'intervention' => $langs->trans('InterventionCard'), -// 'contract' => $langs->trans('Contract'), - 'project' => $langs->trans('Project'), - 'project_task' => $langs->trans('Task'), - 'agenda' => $langs->trans('Agenda'), - 'dolresource' => $langs->trans('Resource'), - // old deprecated - 'propal' => $langs->trans('Proposal'), - 'commande' => $langs->trans('Order'), - 'facture' => $langs->trans('Bill'), - 'fichinter' => $langs->trans('InterventionCard'), - 'contrat' => $langs->trans('Contract') + $elementList = array( + '' => '', + 'societe' => $langs->trans('ThirdParty'), + // 'proposal' => $langs->trans('Proposal'), + // 'order' => $langs->trans('Order'), + // 'invoice' => $langs->trans('Bill'), + 'supplier_proposal' => $langs->trans('SupplierProposal'), + 'order_supplier' => $langs->trans('SupplierOrder'), + 'invoice_supplier' => $langs->trans('SupplierBill'), + // 'intervention' => $langs->trans('InterventionCard'), + // 'contract' => $langs->trans('Contract'), + 'project' => $langs->trans('Project'), + 'project_task' => $langs->trans('Task'), + 'agenda' => $langs->trans('Agenda'), + 'dolresource' => $langs->trans('Resource'), + // old deprecated + 'propal' => $langs->trans('Proposal'), + 'commande' => $langs->trans('Order'), + 'facture' => $langs->trans('Bill'), + 'fichinter' => $langs->trans('InterventionCard'), + 'contrat' => $langs->trans('Contract'), ); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); @@ -601,13 +601,13 @@ $localtax_typeList = array(); if ($id == 10) { $localtax_typeList = array( - "0" => $langs->trans("No"), - "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), - "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), - "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), - "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), - "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), - "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), + "0" => $langs->trans("No"), + "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), + "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), + "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), + "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), + "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), + "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), ); } @@ -648,8 +648,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 ) - ) - { + ) { $ok=0; $fieldnamekey=$listfield[$f]; // We take translate key of field @@ -1574,18 +1573,18 @@ if ($id) $class="center"; } elseif ($fieldlist[$field]=='localtax1_type') { - if ($obj->localtax1 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax1 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='localtax2_type') { - if ($obj->localtax2 != 0) - $valuetoshow=$localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; - $align="center"; + if ($obj->localtax2 != 0) + $valuetoshow=$localtax_typeList[$valuetoshow]; + else + $valuetoshow = ''; + $align="center"; } elseif ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index c6262e84a79..4f1fad15343 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -423,17 +423,20 @@ class PrestaShopWebservice */ public function delete($options) { - if (isset($options['url'])) + if (isset($options['url'])) { $url = $options['url']; - elseif (isset($options['resource']) && isset($options['id'])) + } elseif (isset($options['resource']) && isset($options['id'])) { if (is_array($options['id'])) $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; else - $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; - if (isset($options['id_shop'])) - $url .= '&id_shop='.$options['id_shop']; - if (isset($options['id_group_shop'])) - $url .= '&id_group_shop='.$options['id_group_shop']; + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + } + if (isset($options['id_shop'])) { + $url .= '&id_shop='.$options['id_shop']; + } + if (isset($options['id_group_shop'])) { + $url .= '&id_group_shop='.$options['id_group_shop']; + } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); self::checkStatusCode($request['status_code']);// check the response validity return true; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index e65eb2bbb0a..22029b2c691 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -32,8 +32,8 @@ class Dolistore * beginning of pagination * @var int */ + public $start; - public $start; /** * end of pagination * @var int diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 255fdb68a0d..daa0c896809 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -513,7 +513,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $noparam=array(); foreach($arrayoftypes as $key => $value) { - if ($value['noparam']) $noparam[]=$key; + if ($value['noparam']) $noparam[]=$key; } print '})'; print ''."\n"; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 29ef6d40a1e..7cc2e7dff44 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index e3adeaca890..4bb2bf1c964 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -79,7 +79,7 @@ if ($action == 'add' || GETPOST("modify")) if ($_POST["modify"]) { // Supprime boite box_external_rss de definition des boites -/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; + /* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; $sql.= " SET name = '".$boxlabel."'"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; @@ -89,7 +89,7 @@ if ($action == 'add' || GETPOST("modify")) dol_print_error($db,"sql=$sql"); exit; } -*/ + */ } else { diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index f9f051dc272..876f4b90abb 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -207,8 +207,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') } } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); -$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); if (!$res > 0) { $error++; @@ -220,33 +219,31 @@ $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') { - $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); - $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + if (!$res > 0) { + $error++; + } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') { - $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); - $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', - $conf->entity); + $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); + $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + if (!$res > 0) { + $error++; + } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 58ea3dcdbaa..2d3f986e6a1 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -300,8 +300,14 @@ print ''; print '
'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) -{ +if ($conf->global->MAIN_FEATURES_LEVEL < 2) { + dol_fiche_end(); + // End of page + llxFooter(); + $db->close(); + exit; +} + /* * Documents models for Holidays */ @@ -317,8 +323,8 @@ $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { - $i = 0; - $num_rows=$db->num_rows($resql); + $i = 0; + $num_rows=$db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); @@ -416,7 +422,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') @@ -518,7 +524,7 @@ print ''; print ''; print ''; -} + dol_fiche_end(); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index cba9481849d..8d1f7d3279e 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -478,7 +478,7 @@ if (function_exists("ldap_connect")) } } else - { + { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 99cd481095b..794020cfc95 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -139,7 +139,7 @@ if ($action == 'set') if ($action == 'del') { - $ret = delDocumentModel($value, $type); + $ret = delDocumentModel($value, $type); if ($ret > 0) { if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0dbdf90b53b..7ac91d51c8d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -45,11 +45,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; // Load translation files required by the page $langs->loadLangs(array("errors","admin","mails","languages")); -$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$id = GETPOST('id', 'int'); -$rowid = GETPOST('rowid', 'alpha'); +$id = GETPOST('id', 'int'); +$rowid = GETPOST('rowid', 'alpha'); $search_label=GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)' $search_type_template=GETPOST('search_type_template', 'alpha'); $search_lang=GETPOST('search_lang', 'alpha'); @@ -327,7 +327,7 @@ if (empty($reshook)) $i++; } $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; -//print $sql;exit; + //print $sql;exit; dol_syslog("actionmodify", LOG_DEBUG); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 88ad0acf097..8bdfb978219 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -923,19 +923,17 @@ if ($mode == 'marketplace')  
- -
- + '; + print ''; - '; - print '
'; + print ''; + print '
'; - ?> + ?>
'.$langs->trans('Language').''; - print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); + print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index e48f122c4b0..bfde50618cc 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -114,7 +114,7 @@ print '
'.$langs // Name print '
'; -print '
'; @@ -156,7 +156,7 @@ print '
'; -print '
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 3caa3418af5..beccc9e9d5a 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -268,17 +268,17 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Active if (in_array($name, $def)) { - print ''."\n"; - if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") - { - print 'scandir.'&label='.urlencode($module->name).'&type=action">'; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; - } - else - { - print img_picto($langs->trans("Enabled"), 'switch_on'); - } + print ''."\n"; + if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") + { + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + } + else + { + print img_picto($langs->trans("Enabled"), 'switch_on'); + } print "
'.$langs->trans( // Name print '
'; -print '
'; print ''."\n"; - print ''."\n"; + print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; print '
'.$langs->trans("Day").''.$langs->trans("Value").'
'; - print '
'; + print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; + print '
'; + print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; + print '
'; + print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); + print ''; print '
'; print '
'; print ''; - print '     '; - print ''; print '
'; print '
'; print ''; } -else -{ - /* - * Show parameters - */ - - print '
'; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Day").''.$langs->trans("Value").'
'.$langs->trans("Monday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_MONDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_MONDAY) . '
'.$langs->trans("Tuesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_TUESDAY) . '
'.$langs->trans("Wednesday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_WEDNESDAY) . '
'.$langs->trans("Thursday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_THURSDAY) . '
'.$langs->trans("Friday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_FRIDAY) . '
'.$langs->trans("Saturday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SATURDAY) . '
'.$langs->trans("Sunday").'' . (empty($conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY)?'':$conf->global->MAIN_INFO_OPENINGHOURS_SUNDAY) . '
'; - print "
"; - - print ''; - - // Actions buttons - print '
'; - print ''; - print '
'; -} llxFooter(); diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index db9efb0e5c7..a0f817a40c1 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = $langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 07d448c5d11..27564d6b4e0 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 833d6c25d22..1f37a36ec4f 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -262,11 +262,11 @@ else if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE)) { - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; } else { - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; } print '
'; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 42daea12861..51bf959bb72 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -113,12 +113,12 @@ print ''.$langs->trans("DeStockOnBill").''; print ''; if (! empty($conf->facture->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); + } } else { @@ -133,12 +133,12 @@ print ''.$langs->trans("DeStockOnValidateOrder").''; print ''; if (! empty($conf->commande->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); + } } else { @@ -155,12 +155,12 @@ print ''.$langs->trans("DeStockOnShipment").''; print ''; if (! empty($conf->expedition->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); + } } else { @@ -175,12 +175,12 @@ print ''.$langs->trans("DeStockOnShipmentOnClosing").''; print ''; if (! empty($conf->expedition->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); + } } else { @@ -215,12 +215,12 @@ print ''.$langs->trans("ReStockOnBill").''; print ''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); + } } else { @@ -236,12 +236,12 @@ print ''.$langs->trans("ReStockOnValidateOrder").''; print ''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); + } } else { @@ -254,29 +254,29 @@ if (!empty($conf->reception->enabled)) { print ''; print ''.$langs->trans("StockOnReception").''; - print ''; + print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); + } print "\n\n"; $found++; -print ''; + print ''; print ''.$langs->trans("StockOnReceptionOnClosing").''; - print ''; + print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); + } print "\n\n"; $found++; } @@ -284,15 +284,15 @@ else { print ''; print ''.$langs->trans("ReStockOnDispatchOrder").''; - print ''; + print ''; if (! empty($conf->fournisseur->enabled)) { -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); -} + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); + } } else { @@ -338,28 +338,28 @@ if($conf->invoice->enabled) { print ''; print ''.$langs->trans("StockMustBeEnoughForInvoice").''; - print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); -} - print "\n"; - print "\n"; + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); + } + print "\n"; + print "\n"; } if($conf->order->enabled) { print ''; print ''.$langs->trans("StockMustBeEnoughForOrder").''; - print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); + } print "\n"; print "\n"; } @@ -368,13 +368,13 @@ if($conf->expedition->enabled) { print ''; print ''.$langs->trans("StockMustBeEnoughForShipment").''; - print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); + } print "\n"; print "\n"; } @@ -383,27 +383,30 @@ print ''; print '
'; $virtualdiffersfromphysical=0; -if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) - || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) - ) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. +if ( + ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) + || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) +) { + $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. +} if ($virtualdiffersfromphysical) { -print ''; -print ''; + print '
'; + print ''; print "\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''; print ''; - print '\n"; print "\n"; print '
".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UseVirtualStockByDefault").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); -} + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); + } print "
'; @@ -504,7 +507,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT); } print ''; - print ''; } @@ -512,8 +514,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. if ($conf->global->PRODUIT_SOUSPRODUITS) { - - print ''; print ''.$langs->trans("IndependantSubProductStock").''; print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 6369efb1361..c2a7a5d4077 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -413,8 +413,8 @@ foreach ($dirmodels as $reldir) print "\n"; require_once $dir.$file; $module = new $classname($db, $specimenthirdparty); - if (method_exists($module, 'info')) print $module->info($langs); - else print $module->description; + if (method_exists($module, 'info')) print $module->info($langs); + else print $module->description; print "\n"; // Active diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index bd2cb10a3ad..30a85f2af3b 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 01836dd4a72..01fc5ff5fc1 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -189,8 +189,8 @@ else if ($base == 4) { // Sqlite by PDO or by Sqlite3 - print '
'; - print ''; + print '
'; + print '
'; print ''; print ''; print ''; diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index d08eb564f17..928b193b1ee 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -94,10 +94,10 @@ if ($db->type == 'pgsql') { // Check option standard_conforming_strings is on $paramarray=$db->getServerParametersValues('standard_conforming_strings'); -// if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) -// { -// $langs->load("errors"); -// } + // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) + // { + // $langs->load("errors"); + // } } print '
'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 109b2a748fb..f1759ec6c06 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -111,13 +111,15 @@ jQuery(document).ready(function() { } }); - -}); -\n"; print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); @@ -127,24 +129,17 @@ print $langs->trans("BackupDesc", DOL_DATA_ROOT); print ''; print '
'; -?> +print "\n"; +print ''; +print ''; +print ''; +print '
1'; - - - -
1 - -trans("BackupDesc3", $dolibarr_main_db_name).'
'; //print $langs->trans("BackupDescY").'
'; print '
'; -?> -
- -'; print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); @@ -155,275 +150,296 @@ print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; print ''; print '
'; print ''; print '
'.$langs->trans("TableName").''.$langs->trans("NbOfRecord").'
'; -?> - - - - -
+print ''; +print ''; +print ' - '; +print ''; +print ''; +print '
'; -
-
trans("ExportMethod"); ?> - -
- -
-
-
- -
- -
- -
- -
-
+print '
'; +print '
'.$langs->trans("ExportMethod").''; +if (in_array($type, array('mysql', 'mysqli'))) { + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print '
'; +} elseif (in_array($type, array('pgsql'))) { + print '
'; + print ''; + print '
'; +} else { + print 'No method available with database '.$label; +} +print '
'; +print '
'; -
+print ''; -
- -
trans("MySqlExportParameters"); ?> +print '
'; +if (in_array($type, array('mysql', 'mysqli'))) { + print "\n"; + print '
'.$langs->trans("MySqlExportParameters").''; -
trans("FullPathToMysqldumpCommand"); - if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) - { - $fullpathofmysqldump=$db->getPathOfDump(); - } - else - { - $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; - } - ?>
-
+ print '
'.$langs->trans("FullPathToMysqldumpCommand"); + if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) + { + $fullpathofmysqldump=$db->getPathOfDump(); + } + else + { + $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; + } + print '
'; + print '
'; -
-
trans("ExportOptions"); ?> -
+ print '
'; + print '
'.$langs->trans("ExportOptions").''; + print '
'; + print ''; + print ''; -
+ print '
'; - global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> -
-
- + if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { + print '
'; + print ''; + print ''; + print '
'; + } - + print ''; -
- -
+ print ''; + print '
'; + print ''; + print '
'; -
-
id="checkbox_dump_drop" />
-
+ print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; -
-

+ print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
-
+ print '
'; + print ''; + print "\n"; + print '
'; + print ''.$langs->trans("MySqlExportParameters").''; + print '
'; + print ''.$langs->trans("ExportOptions").''; + print '
'; + print ''; + print ''; - -
trans("MySqlExportParameters"); ?> -
- trans("ExportOptions"); ?> -
+ print '
'; + if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { + print '
'; + print ''; + print ''; + print '
'; + } + print '
'; -
- global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> -
-
- -
+ print '
'; + print '
'.$langs->trans('ExportStructure').''; + print ''; + print ''; + print '
'; + print '
'; -
-
trans('ExportStructure') ?> id="checkbox_dump_drop" />
-
+ print '
'; + print '
'; + print ''.$langs->trans("Datas").''; -
-
- trans("Datas"); ?> + print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print ''; + print ''; + print '
'; -
+ print '
'; + print '
'; +} -
- +if (in_array($type, array('pgsql'))) { + print "\n"; + print '
'.$langs->trans("PostgreSqlExportParameters").''; - '.$langs->trans("FullPathToPostgreSQLdumpCommand"); + if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) { + $fullpathofpgdump=$db->getPathOfDump(); + } + else + { + $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; + } + print '
'; + print '
'; - if (in_array($type, array('pgsql'))) - { - ?> -
trans("PostgreSqlExportParameters"); ?> + print '
'; + print '
'; + print ''.$langs->trans("ExportOptions").''; + print ''; + print ''; + print '
'; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; +} +print ''; -
trans("FullPathToPostgreSQLdumpCommand"); - if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) - { - $fullpathofpgdump=$db->getPathOfDump(); - } - else - { - $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; - } - ?>
-
+print '
'; -
-
trans("ExportOptions"); ?> - -
- -
- -
-
- -
-

- -
- - - - -
- - - -
-
- -->'; +print '
'; +print ''; +print '
'; $prefix='dump'; $ext='.sql'; -if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } -//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } -if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; } +if (in_array($type, array('mysql', 'mysqli'))) { + $prefix='mysqldump'; + $ext='sql'; +} +//if ($label == 'PostgreSQL') { +// $prefix='pg_dump'; +// $ext='dump'; +//} +if (in_array($type, array('pgsql'))) { + $prefix='pg_dump'; + $ext='sql'; +} $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; -echo $file; -?>" />
-
- -'; +print '
'; +print '
'; // Define compressions array $compression=array(); -if (in_array($type, array('mysql', 'mysqli'))) -{ - $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); - $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); - // $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function - $compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); +if (in_array($type, array('mysql', 'mysqli'))) { + $compression['none'] = array( + 'function' => '', + 'id' => 'radio_compression_none', + 'label' => $langs->trans("None") + ); + $compression['gz'] = array( + 'function' => 'gzopen', + 'id' => 'radio_compression_gzip', + 'label' => $langs->trans("Gzip") + ); + // Not open source format. Must implement dol_compress function + // $compression['zip']= array( + // 'function' => 'dol_compress', + // 'id' => 'radio_compression_zip', + // 'label' => $langs->trans("FormatZip") + // ); + $compression['bz'] = array( + 'function' => 'bzopen', + 'id' => 'radio_compression_bzip', + 'label' => $langs->trans("Bzip2") + ); } else { - $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); - $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); + $compression['none'] = array( + 'function' => '', + 'id' => 'radio_compression_none', + 'label' => $langs->trans("Default") + ); + $compression['gz'] = array( + 'function' => 'gzopen', + 'id' => 'radio_compression_gzip', + 'label' => $langs->trans("Gzip") + ); } // Show compression choices @@ -434,13 +450,14 @@ print $langs->trans("Compression").':   '; foreach($compression as $key => $val) { - if (! $val['function'] || function_exists($val['function'])) // Enabled export format - { + if (! $val['function'] || function_exists($val['function'])) { + // Enabled export format print ''; print ' '; } - else // Disabled export format + else { + // Disabled export format print ''; print ' '; print ' ('.$langs->trans("NotAvailable").')'; @@ -451,20 +468,18 @@ foreach($compression as $key => $val) print ''; print "\n"; -?> +print " \n"; +print '
'; +print '
'; +print ''; +print ''; +print '
'; +print '
'; -
-
- " id="buttonGo"> - -
-
- -'.$langs->trans("RunCommandSummary").':
'."\n"; + print '
'.$langs->trans("RunCommandSummary").':
'."\n"; print '
'."\n"; print '
'; @@ -491,71 +506,51 @@ if (! empty($_SESSION["commandbackuptorun"])) $_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackupresult"]=''; } -?> -
+print "
\n"; -
'; - -?> - -
+print " \n"; -
-
+print '
'; +print '
'; -admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; -?> +print '
'; +print '
'; +print ''; +print ''; -
-
- - +print "
\n"; +print "\n"; -
- +print '
'; +print ''; +print ''; - - - +print '
2'; -
2 - -trans("BackupDesc2", DOL_DATA_ROOT).'
'; print $langs->trans("BackupDescX").'

'; -?> - -
- -'; print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); -?> -
-'.$langs->trans("FileNameToGenerate").'
'; $prefix='documents'; $ext='zip'; - $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; -echo $file; -?>" />
-
+print '
'; +print '
'; -'; print "\n"; @@ -584,32 +579,26 @@ foreach($filecompression as $key => $val) print '
'; print "\n"; -?> -
-
" id="buttonGo" />
-
-
+print '
'; +print '
'; +print '
'; +print '
'; +print '
'; - +print ''; -
-
+print '
'; +print '
'; -admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); print '
'; -?> +print '
'; +print '
'; -
-
- -
- - -'; +print ''; // End of page llxFooter(); diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index a5d52eb2929..c6c31fe7f45 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -99,21 +99,21 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'

'; + ?>
/>
- + ?>
/>
- trans("RestoreDesc3", $dolibarr_main_db_name).'

'; -
- trans('RestoreMySQL') ?> -
- '; + print ''.$langs->trans('RestoreMySQL').''; + print '
'; // Parameteres execution $command=$db->getPathOfRestore(); if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command @@ -157,20 +155,18 @@ if (in_array($type, array('mysql', 'mysqli'))) print '
'; print ajax_autoselect('restorecommand'); - if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '
'.$langs->trans("UnHidePassword").''; - //else print '
'.$langs->trans("HidePassword").''; - ?> -
-
-'.$langs->trans("UnHidePassword").''; + } + //else print '
'.$langs->trans("HidePassword").''; + print ''; + print '
'; } elseif (in_array($type, array('pgsql'))) { -?> -
- Restore PostgreSQL -
- '; + print 'Restore PostgreSQL'; + print '
'; // Parameteres execution $command=$db->getPathOfRestore(); if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command @@ -198,20 +194,16 @@ elseif (in_array($type, array('pgsql'))) print ajax_autoselect('restorecommand'); //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '
'.$langs->trans("UnHidePassword").''; //else print '
'.$langs->trans("HidePassword").''; - ?> -
-
-'; + print ''; } -?> - +print ''; - - +print ''; +print ''; -close(); diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 7db64a8a3ed..1fedf9e40de 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -37,8 +37,8 @@ $confirm=GETPOST('confirm', 'alpha'); // Security check if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } $sortfield = GETPOST("sortfield", 'alpha'); diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index 3c99e3e10b8..f991bb5752e 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -97,9 +97,9 @@ if (! empty($conf->syslog->enabled)) $filelogparam=$filelog; if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) { - $filelogparam =''.$filelog.''; + $filelogparam =''.$filelog.''; } print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam); print '

'; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index ba6c3660bcd..1b4c59505db 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -288,9 +288,9 @@ foreach ($dirmodels as $reldir) } print ''; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.= '
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 190391b462b..bd8ae3d5e92 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index 0f541b93708..0fd34788adf 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -148,7 +148,7 @@ foreach ($modulesdir as $dir) }*/ //$listofapis[]=array('classname'=>$classname, 'fullpath'=>$file_searched); - /* } + /* } }*/ } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index c0e81bc77cb..7660144f7ca 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -262,9 +262,9 @@ class DolibarrApi if ($tmp[$i]==')') $counter--; if ($counter < 0) { - $error="Bad sqlfilters=".$sqlfilters; - dol_syslog($error, LOG_WARNING); - return false; + $error="Bad sqlfilters=".$sqlfilters; + dol_syslog($error, LOG_WARNING); + return false; } $i++; } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 1d4bb6a8cb7..60f5a54eeba 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -383,7 +383,7 @@ class Setup extends DolibarrApi return $list; } - + /** * Get the list of contacts types. * @@ -533,13 +533,15 @@ class Setup extends DolibarrApi if (!empty($multicurrency)) $sql.= " , cr.date_sync, cr.rate "; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t"; if (!empty($multicurrency)) { - $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; - $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; } $sql.= " WHERE t.active = ".$active; if (!empty($multicurrency)) { - $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; - if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; + if (!empty($multicurrency) && $multicurrency != 2) { + $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + } } // Add sql filters @@ -924,7 +926,7 @@ class Setup extends DolibarrApi $sql = "SELECT rowid, code, pos, label, use_default, description"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t"; - $sql.= " WHERE t.active = ".$active; + $sql.= " WHERE t.active = ".$active; // Add sql filters if ($sqlfilters) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 1f0c82e780b..6ce788a5790 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -574,7 +574,7 @@ jQuery(document).ready(function () { if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { -?> + ?> -thirdparty as $key=>$value) { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties - if (! in_array($key, array( + if (! in_array($key, array( 'name','name_alias','ref_ext','address','zip','town','state_code','country_code','idprof1','idprof2','idprof3','idprof4','idprof5','idprof6','phone','fax','email','barcode', 'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur' ))) continue; // Discard if not into a dedicated list @@ -592,7 +592,7 @@ class BlockedLog foreach($tmpobject as $key=>$value) { if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties - if (! in_array($key, array( + if (! in_array($key, array( 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' ))) continue; // Discard if not into a dedicated list if (!is_object($value)) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index b7eb1608e9e..cd654c7a596 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -47,22 +47,20 @@ $colspan = 3; // Columns: total ht + col edit + col delete // Lines for extrafield $objectline = new BOMLine($this->db); -?> - -\n"; + $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { -?> - - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - - -
trans('AddNewLine'); ?>trans("FreeZone"); ?> - - trans('Qty'); ?> - '; + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''; + } + print ''; + print '
'.$langs->trans('AddNewLine').''; + // echo $langs->trans("FreeZone"); + print ''; + print ''.$langs->trans('Qty').''; if ($conf->global->PRODUCT_USE_UNITS) { print ''; @@ -70,76 +68,68 @@ if ($nolinesbefore) { print $langs->trans('Unit'); print ''; } - ?> - textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?> -   - -'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).''; + print ' '; + print ''; } -?> - -global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay++; - echo ''; - } +print ''; +$coldisplay=0; +// Adds a line numbering column +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay++; - ?> - + echo ''; +} - product->enabled) || ! empty($conf->service->enabled)) +$coldisplay++; +print ''; + +// Predefined product/service +if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) +{ + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + + $statustoshow = -1; + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) { - if ($forceall >= 0 && $freelines) echo '
'; - echo ''; - $filtertype=''; - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; - - $statustoshow = -1; - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) - { - // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); - } - else - { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); - } - - echo ''; + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + } + else + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } - $coldisplay++; - ?> - "> - - global->PRODUCT_USE_UNITS) - { - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; - } + echo '
'; +} - $coldisplay++; - ?> - "> - '; +print ''; +if($conf->global->PRODUCT_USE_UNITS) +{ + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; +} - $coldisplay+=$colspan; - ?> - - - - +$coldisplay++; + +print ''; +print ''; +print ''; + + +$coldisplay += $colspan; +print ''; +print ''; +print ''; +print ''; -showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 05b9094d10e..d887b9ab68d 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -49,22 +49,19 @@ $colspan = 3; // Columns: total ht + col edit + col delete // Lines for extrafield $objectline = new BOMLine($this->db); -?> - +print "\n"; - - - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - '; +// Adds a line numbering column +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''.($i+1).''; $coldisplay++; - ?> +} + +$coldisplay++; +?>
@@ -74,72 +71,66 @@ $coldisplay=0; - fk_product > 0) { - $tmpproduct = new Product($object->db); - $tmpproduct->fetch($line->fk_product); - print $tmpproduct->getNomUrl(1); - } - - if (is_object($hookmanager)) - { - $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); - $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); - $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); - } - - ?> - - - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines - { - $coldisplay++; - ?> - - - - info_bits & 2) != 2) { - // I comment this because it shows info even when not required - // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated - // must also not be output for most entities (proposal, intervention, ...) - //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; - print ''; - } - ?> - - - global->PRODUCT_USE_UNITS) - { - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; - } - - $coldisplay++; - ?> - - - - ">
- "> - - - fk_product > 0) { + $tmpproduct = new Product($object->db); + $tmpproduct->fetch($line->fk_product); + print $tmpproduct->getNomUrl(1); +} + +if (is_object($hookmanager)) +{ + $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line); + $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); + $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); +} + +print ''; + +/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines +{ + $coldisplay++; +?> + +'; +if (($line->info_bits & 2) != 2) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + print ''; +} +print ''; + +if ($conf->global->PRODUCT_USE_UNITS) +{ + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; +} + +$coldisplay++; +print ''; +print ''; + +$coldisplay+=$colspan; +print ''; +$coldisplay+=$colspan; +print ''; +print '
'; +print ''; +print ''; +print ''; + if (is_object($objectline)) { print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } -?> - +print "\n"; diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php index 26010a70eb8..721cc5b501f 100644 --- a/htdocs/bom/tpl/objectline_title.tpl.php +++ b/htdocs/bom/tpl/objectline_title.tpl.php @@ -39,9 +39,7 @@ if (empty($object) || ! is_object($object)) print "Error, template page can't be called as URL"; exit; } -?> - -\n"; // Title line print "\n"; @@ -79,6 +77,5 @@ if ($action == 'selectlines') print "\n"; print "\n"; -?> - +print "\n"; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 9582e69f967..f569516e535 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -59,100 +59,93 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; // Lines for extrafield $objectline = new BOMLine($object->db); -?> - - - > - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - -
- db); - $tmpproduct->fetch($line->fk_product); - print $tmpproduct->getNomUrl(1); - ?> - - - qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price - ?> - +$coldisplay=0; +print "\n"; +print ''; +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { + print ''.($i+1).''; + $coldisplay++; +} +print ''; +print '
'; +$coldisplay++; +$tmpproduct = new Product($object->db); +$tmpproduct->fetch($line->fk_product); +print $tmpproduct->getNomUrl(1); +print ''; +print ''; +$coldisplay++; +echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price +print ''; - global->PRODUCT_USE_UNITS) - { - print ''; - $label = $line->getLabelOfUnit('short'); - if ($label !== '') { - print $langs->trans($label); +if($conf->global->PRODUCT_USE_UNITS) +{ + print ''; + $label = $line->getLabelOfUnit('short'); + if ($label !== '') { + print $langs->trans($label); + } + print ''; +} +print ''; +$coldisplay++; +echo $line->efficiency; +print ''; + +if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { + print ''; + $coldisplay++; + if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { + } else { + print 'id.'#line_'.$line->id.'">'.img_edit().''; + } + print ''; + + print ''; + $coldisplay++; + if (($line->fk_prev_id == null ) && empty($disableremove)) { + //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id . '">'; + print img_delete(); + print ''; + } + print ''; + + if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { + print ''; + $coldisplay++; + if ($i > 0) { + print 'id.'">'; + echo img_up('default', 0, 'imgupforline'); + print ''; + } + if ($i < $num-1) { + print 'id.'">'; + echo img_down('default', 0, 'imgdownforline'); + print ''; } print ''; + } else { + print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'>'; + $coldisplay++; } - ?> - - efficiency; - ?> - - '; + $coldisplay=$coldisplay+3; +} - if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { ?> - - info_bits & 2) == 2 || ! empty($disableedit)) { ?> - - id.'#line_'.$line->id; ?>"> - - - - +if ($action == 'selectlines') { + print ''; + print ''; + print ''; +} - - fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation - print 'id . '">'; - print img_delete(); - print ''; - } - ?> - +print ''; - 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> - - 0) { ?> - id; ?>"> - - - - - id; ?>"> - - - - - - browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>> - - - - - - - - - -showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } -?> - +print "\n"; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 8128815ef3b..8a26b12f15b 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -24,16 +24,11 @@ /** * Add area with bookmarks in menu * - * @param DoliDb $aDb Database handler - * @param Translate $aLangs Object lang * @return string */ -function printBookmarksList($aDb, $aLangs) +function printBookmarksList() { - global $conf, $user; - - $db = $aDb; - $langs = $aLangs; + global $conf, $user, $db, $langs; $ret = ''."\n"; @@ -155,16 +150,11 @@ function printBookmarksList($aDb, $aLangs) /** * Add area with bookmarks in top menu * - * @param DoliDb $aDb Database handler - * @param Translate $aLangs Object lang * @return string */ -function printDropdownBookmarksList($aDb, $aLangs) +function printDropdownBookmarksList() { - global $conf, $user; - - $db = $aDb; - $langs = $aLangs; + global $conf, $user, $db, $langs; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; @@ -271,7 +261,7 @@ function printDropdownBookmarksList($aDb, $aLangs) var filter = $(this).val(), count = 0; $("#dropdown-bookmarks-list .bookmark-item").each(function () { - + if ($(this).text().search(new RegExp(filter, "i")) < 0) { $(this).addClass("hidden-search-result"); } else { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index cd3885b77b1..d60b3251f0d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1835,13 +1835,13 @@ class Categorie extends CommonObject } } - // Call trigger - $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); - if ($result < 0) { - $this->error = $this->db->lasterror(); - return -1; - } - // End call triggers + // Call trigger + $result = $this->call_trigger('CATEGORY_SET_MULTILANGS', $user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers return 1; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9741c7083bb..1314463cd2a 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1461,7 +1461,7 @@ class ActionComm extends CommonObject $sql.= " a.fk_contact, a.percent as percentage,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,"; - $sql.= " u.firstname, u.lastname,"; + $sql.= " u.firstname, u.lastname, u.email,"; $sql.= " s.nom as socname,"; $sql.= " c.id as type_id, c.code as type_code, c.libelle"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; @@ -1569,6 +1569,7 @@ class ActionComm extends CommonObject $event['transparency']=(($obj->transparency > 0)?'OPAQUE':'TRANSPARENT'); // OPAQUE (busy) or TRANSPARENT (not busy) $event['punctual']=$obj->punctual; $event['category']=$obj->libelle; // libelle type action + $event['email']=$obj->email; // Define $urlwithroot $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6fdd1e36feb..3854c51e29d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -44,8 +44,9 @@ require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; -if (! empty($conf->propal->enabled)) +if (! empty($conf->propal->enabled)) { require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +} if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; @@ -757,8 +758,8 @@ if (empty($reshook)) $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; + if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; + if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } } // If price per customer diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index fb044b1fafa..b6d91b235ba 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -52,7 +52,7 @@ class Orders extends DolibarrApi } /** - * Get properties of an order object + * Get properties of an order object by id * * Return an array with order informations * @@ -64,26 +64,79 @@ class Orders extends DolibarrApi */ public function get($id, $contact_list = 1) { - if(! DolibarrApiAccess::$user->rights->commande->lire) { - throw new RestException(401); - } + return $this->_fetch($id, '', '', '', $contact_list); + } - $result = $this->commande->fetch($id); + /** + * Get properties of an order object by ref + * + * Return an array with order informations + * + * @param string $ref Ref of object + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return array|mixed data without useless information + * + * @url GET byRef/{ref} + * + * @throws RestException + */ + public function getByRef($ref, $contact_list = 1) + { + return $this->_fetch('', $ref, '', '', $contact_list); + } + + /** + * Get properties of an order object by ref_ext + * + * Return an array with order informations + * + * @param string $ref_ext External reference of object + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return array|mixed data without useless information + * + * @url GET byRefExt/{ref_ext} + * + * @throws RestException + */ + public function getByRefExt($ref_ext, $contact_list = 1) + { + return $this->_fetch('', '', $ref_ext, '', $contact_list); + } + + /** + * Get properties of an order object + * + * Return an array with order informations + * + * @param int $id ID of order + * @param string $ref Ref of object + * @param string $ref_ext External reference of object + * @param string $ref_int Internal reference of other objec + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return array|mixed data without useless information + * + * @throws RestException + */ + private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1) + { + if(! DolibarrApiAccess::$user->rights->commande->lire) { + throw new RestException(401); + } + + $result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int); if( ! $result ) { throw new RestException(404, 'Order not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - // Add external contacts ids - $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list); - $this->commande->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->commande); - } - + if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + // Add external contacts ids + $this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list); + $this->commande->fetchObjectLinked(); + return $this->_cleanObjectDatas($this->commande); + } /** * List orders @@ -437,7 +490,7 @@ class Orders extends DolibarrApi return $this->commande; } - /** + /** * Delete a contact type of given order * * @param int $id Id of order to update diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6fe2104556b..4cc922a8cbf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1995,9 +1995,9 @@ class Commande extends CommonOrder // multilangs if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { - $line = new Product($this->db); - $line->fetch($objp->fk_product); - $line->getMultiLangs(); + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); } $this->lines[$i] = $line; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 82d24ad3646..57e37f9f903 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -164,20 +164,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') + if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 515e14095bd..fa825086c4a 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -127,20 +127,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') + if ($action != 'classify') { //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index f42a9fc5b60..7d8e319c5ae 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -84,20 +84,21 @@ if (! empty($conf->projet->enabled)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 0931067f155..2cb69bd698b 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -97,20 +97,21 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($user->rights->commande->creer) { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 86f98f4f0e9..459940dcc64 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -18,17 +18,12 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) -{ +if (empty($conf) || ! is_object($conf)) { print "Error, template page can't be called as URL"; exit; } -?> - - - -\n"; global $user; global $noMoreLinkedObjectBlockAfter; @@ -41,54 +36,48 @@ $langs->load("orders"); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); -$total=0; $ilink=0; +$total=0; +$ilink=0; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; -?> - - trans("CustomerOrder"); ?> - global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print ' - - getNomUrl(1); ?> - ref_client; ?> - date, 'day'); ?> - rights->commande->lire) { - $total = $total + $objectlink->total_ht; - echo price($objectlink->total_ht); - } ?> - getLibStatut(3); ?> - - element != 'shipping') { - ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> - - - -'; + echo ''.$langs->trans("CustomerOrder"); + if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + print ' '; + echo ''.$objectlink->getNomUrl(1).''; + echo ''.$objectlink->ref_client.''; + echo ''.dol_print_date($objectlink->date, 'day').''; + echo ''; + if ($user->rights->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } + echo ''; + echo ''.$objectlink->getLibStatut(3).''; + echo ''; + // For now, shipments must stay linked to order, so link is not deletable + if($object->element != 'shipping') { + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + } + echo ''; + echo "\n"; } -if (count($linkedObjectBlock) > 1) -{ - ?> - - trans("Total"); ?> - - - - - - - - 1) { + echo ''; + echo ''.$langs->trans("Total").''; + echo ''; + echo ''; + echo ''; + echo ''.price($total).''; + echo ''; + echo ''; + echo "\n"; } -?> - +echo "\n"; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 583d7426757..cbecd9cbc05 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -294,7 +294,18 @@ if ($result && $action == "dl" && ! $error) dol_mkdir($dirfortmpfile); - $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; + $log = $langs->transnoentitiesnoconv("Type"); + $log .= ',' . $langs->transnoentitiesnoconv("Date"); + $log .= ',' . $langs->transnoentitiesnoconv("Ref"); + $log .= ',' . $langs->transnoentitiesnoconv("TotalHT"); + $log .= ',' . $langs->transnoentitiesnoconv("TotalTTC"); + $log .= ',' . $langs->transnoentitiesnoconv("TotalVAT"); + $log .= ',' . $langs->transnoentitiesnoconv("Paid"); + $log .= ',filename,item_id'; + $log .= ',' . $langs->transnoentitiesnoconv("ThirdParty"); + $log .= ',' . $langs->transnoentitiesnoconv("Code"); + $log .= ',' . $langs->transnoentitiesnoconv("Country"); + $log .= ',' . $langs->transnoentitiesnoconv("VATIntra")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); @@ -305,8 +316,20 @@ if ($result && $action == "dl" && ! $error) { foreach ($filesarray as $key => $file) { - if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; + if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); + $log .= $file['item']; + $log .= ',' . dol_print_date($file['date'], 'dayrfc'); + $log .= ',' . $file['ref']; + $log .= ',' . $file['amount_ht']; + $log .= ',' . $file['amount_ttc']; + $log .= ',' . $file['amount_vat']; + $log .= ',' . $file['paid']; + $log .= ',' . $file["name"]; + $log .= ',' . $file['fk']; + $log .= ',' . $file['thirdparty_name']; + $log .= ',' . $file['thirdparty_code']; + $log .= ',' . $file['country_code']; + $log .= ',"' . $file['vatnum'].'"'."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f264bb074b3..cabd2c75fa4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -278,8 +278,11 @@ if (empty($reshook)) $action = ''; } } else { - // Si non avoir, le signe doit etre positif - if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ht < 0) { + // If not a credit note, amount with tax must be positive or nul. + // Note that amount excluding tax can be negative because you can have a invoice of 100 with vat of 20 that + // consumes a credit note of 100 with vat 0 (total with tax is 0 but without tax is -20). + // For some cases, credit notes can have a vat of 0 (for example when selling goods in France). + if (empty($conf->global->FACTURE_ENABLE_NEGATIVE) && $object->total_ttc < 0) { setEventMessages($langs->trans("ErrorInvoiceOfThisTypeMustBePositive"), null, 'errors'); $action = ''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 84835fa9608..0cb6921a6f3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2702,45 +2702,74 @@ class Facture extends CommonInvoice /** - * Add an invoice line into database (linked to product/service or not). - * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel - * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini - * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) - * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) + * Add an invoice line into database (linked to product/service or not). + * Les parametres sont deja cense etre juste et avec valeurs finales a l'appel + * de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini + * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) + * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) * - * @param string $desc Description of line - * @param double $pu_ht Unit price without tax (> 0 even for credit note) - * @param double $qty Quantity - * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') - * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) - * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) - * @param int $fk_product Id of predefined product/service - * @param double $remise_percent Percent of discount on line - * @param int $date_start Date start of service - * @param int $date_end Date end of service - * @param int $ventil Code of dispatching into accountancy - * @param int $info_bits Bits of type of lines - * @param int $fk_remise_except Id discount used - * @param string $price_base_type 'HT' or 'TTC' - * @param double $pu_ttc Unit price with tax (> 0 even for credit note) - * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. - * @param int $rang Position of line - * @param int $special_code Special code (also used by externals modules!) - * @param string $origin 'order', ... - * @param int $origin_id Id of origin object - * @param int $fk_parent_line Id of parent line - * @param int $fk_fournprice Supplier price id (to calculate margin) or '' - * @param int $pa_ht Buying price of line (to calculate margin) or '' - * @param string $label Label of the line (deprecated, do not use) - * @param array $array_options extrafields array - * @param int $situation_percent Situation advance percentage - * @param int $fk_prev_id Previous situation line id reference - * @param string $fk_unit Code of the unit to use. Null to use the default one - * @param double $pu_ht_devise Unit price in currency - * @return int <0 if KO, Id of line if OK + * @param string $desc Description of line + * @param double $pu_ht Unit price without tax (> 0 even for credit note) + * @param double $qty Quantity + * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') + * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside) + * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside) + * @param int $fk_product Id of predefined product/service + * @param double $remise_percent Percent of discount on line + * @param int $date_start Date start of service + * @param int $date_end Date end of service + * @param int $ventil Code of dispatching into accountancy + * @param int $info_bits Bits of type of lines + * @param int $fk_remise_except Id discount used + * @param string $price_base_type 'HT' or 'TTC' + * @param double $pu_ttc Unit price with tax (> 0 even for credit note) + * @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used. + * @param int $rang Position of line + * @param int $special_code Special code (also used by externals modules!) + * @param string $origin 'order', ... + * @param int $origin_id Id of origin object + * @param int $fk_parent_line Id of parent line + * @param int $fk_fournprice Supplier price id (to calculate margin) or '' + * @param int $pa_ht Buying price of line (to calculate margin) or '' + * @param string $label Label of the line (deprecated, do not use) + * @param array $array_options extrafields array + * @param int $situation_percent Situation advance percentage + * @param int $fk_prev_id Previous situation line id reference + * @param string $fk_unit Code of the unit to use. Null to use the default one + * @param double $pu_ht_devise Unit price in currency + * @return int <0 if KO, Id of line if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) - { + public function addline( + $desc, + $pu_ht, + $qty, + $txtva, + $txlocaltax1 = 0, + $txlocaltax2 = 0, + $fk_product = 0, + $remise_percent = 0, + $date_start = '', + $date_end = '', + $ventil = 0, + $info_bits = 0, + $fk_remise_except = '', + $price_base_type = 'HT', + $pu_ttc = 0, + $type = self::TYPE_STANDARD, + $rang = -1, + $special_code = 0, + $origin = '', + $origin_id = 0, + $fk_parent_line = 0, + $fk_fournprice = null, + $pa_ht = 0, + $label = '', + $array_options = 0, + $situation_percent = 100, + $fk_prev_id = 0, + $fk_unit = null, + $pu_ht_devise = 0 + ) { // Deprecation warning if ($label) { dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 46cd0e281a5..d26d8954cc4 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -114,7 +114,7 @@ if ($object->id) $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); $morehtmlref.=''; - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 6fe136cc3bb..cf6af3c5926 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -672,7 +672,7 @@ class Contact extends CommonObject if ($this->birthday_alert) { //check existing - $sql_check = "SELECT * FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; + $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $result_check = $this->db->query($sql_check); if (! $result_check || ($this->db->num_rows($result_check)<1)) { diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index f1f42266735..d6a2ba77f05 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -155,8 +155,8 @@ $type='directory'; // This test if file exists should be useless. We keep it to find bug more easily if (! dol_is_dir($upload_dir)) { -// dol_mkdir($upload_dir); -/* $langs->load("install"); + //dol_mkdir($upload_dir); + /*$langs->load("install"); dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir)); exit;*/ } diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index d37374e45a5..200c6208896 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -73,7 +73,7 @@ if ($boxorder && $zone != '' && $userid > 0) $langs->load("boxes"); if (! GETPOST('closing')) { - setEventMessages($langs->trans("BoxAdded"), null); + setEventMessages($langs->trans("BoxAdded"), null); } } } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index a66b775155c..23c4cc368cf 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -144,7 +144,8 @@ class box_produits extends ModeleBoxes 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $objp->label, ); - + $price = ''; + $price_base_type = ''; if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) { $price_base_type=$langs->trans($objp->price_base_type); $price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index eb53e327e93..d834fcfe943 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -219,9 +219,9 @@ abstract class CommonInvoice extends CommonObject } /** - * Renvoie tableau des ids de facture avoir issus de la facture + * Returns array of credit note ids from the invoice * - * @return array Tableau d'id de factures avoirs + * @return array Array of credit note ids */ public function getListIdAvoirFromInvoice() { @@ -251,10 +251,10 @@ abstract class CommonInvoice extends CommonObject } /** - * Renvoie l'id de la facture qui la remplace + * Returns the id of the invoice that replaces it * - * @param string $option filtre sur statut ('', 'validated', ...) - * @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon + * @param string $option status filter ('', 'validated', ...) + * @return int <0 si KO, 0 if no invoice replaces it, id of invoice otherwise */ public function getIdReplacingInvoice($option = '') { @@ -264,10 +264,10 @@ abstract class CommonInvoice extends CommonObject $sql.= ' AND type < 2'; if ($option == 'validated') $sql.= ' AND fk_statut = 1'; // PROTECTION BAD DATA - // Au cas ou base corrompue et qu'il y a une facture de remplacement validee - // et une autre non, on donne priorite a la validee. - // Ne devrait pas arriver (sauf si acces concurrentiel et que 2 personnes - // ont cree en meme temps une facture de remplacement pour la meme facture) + // In case the database is corrupted and there is a valid replectement invoice + // and another no, priority is given to the valid one. + // Should not happen (unless concurrent access and 2 people have created a + // replacement invoice for the same invoice at the same time) $sql.= ' ORDER BY fk_statut DESC'; $resql=$this->db->query($sql); @@ -276,12 +276,12 @@ abstract class CommonInvoice extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj) { - // Si il y en a + // If there is any return $obj->rowid; } else { - // Si aucune facture ne remplace + // If no invoice replaces it return 0; } } @@ -544,8 +544,8 @@ abstract class CommonInvoice extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoi une date limite de reglement de facture en fonction des - * conditions de reglements de la facture et date de facturation. + * Returns an invoice payment deadline based on the invoice settlement + * conditions and billing date. * * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return integer Date limite de reglement si ok, <0 si ko @@ -589,14 +589,14 @@ abstract class CommonInvoice extends CommonObject /* Definition de la date limite */ - // 0 : ajout du nombre de jours + // 0 : adding the number of days if ($cdr_type == 0) { $datelim = $this->date + ($cdr_nbjour * 3600 * 24); $datelim += ($cdr_decalage * 3600 * 24); } - // 1 : application de la regle "fin de mois" + // 1 : application of the "end of the month" rule elseif ($cdr_type == 1) { $datelim = $this->date + ($cdr_nbjour * 3600 * 24); @@ -612,13 +612,13 @@ abstract class CommonInvoice extends CommonObject { $mois += 1; } - // On se deplace au debut du mois suivant, et on retire un jour + // We move at the beginning of the next month, and we take a day off $datelim=dol_mktime(12, 0, 0, $mois, 1, $annee); $datelim -= (3600 * 24); $datelim += ($cdr_decalage * 3600 * 24); } - // 2 : application de la règle, le N du mois courant ou suivant + // 2 : application of the rule, the N of the current or next month elseif ($cdr_type == 2 && !empty($cdr_decalage)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -733,7 +733,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine public $total_ttc; /** - * Liste d'options cumulables: + * List of cumulative options: * Bit 0: 0 si TVA normal - 1 si TVA NPR * Bit 1: 0 si ligne normal - 1 si bit discount (link to line into llx_remise_except) * @var int diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index ab1448bc412..71c0566f352 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -91,13 +91,15 @@ class DiscountAbsolute public $fk_facture; /** - * @var int ID credit note having caused the discount + * @var int ID credit note or deposit used to create the discount */ public $fk_facture_source; + public $ref_facture_source; // Ref credit note or deposit used to create the discount + public $type_facture_source; - public $ref_facture_source; // Ref credit note having caused the discount - - public $ref_invoice_supplier_source; + public $fk_invoice_supplier_source; + public $ref_invoice_supplier_source; // Ref credit note or deposit used to create the discount + public $type_invoice_supplier_source; /** * Constructor @@ -135,11 +137,12 @@ class DiscountAbsolute $sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,"; $sql.= " sr.datec,"; - $sql.= " f.ref as ref_facture_source, fsup.ref as ref_invoice_supplier_source"; + $sql.= " f.ref as ref_facture_source, f.type as type_facture_source,"; + $sql.= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid"; - $sql.= " WHERE sr.entity IN (".getEntity('invoice').")"; + $sql.= " WHERE sr.entity IN (".getEntity('invoice').")"; if ($rowid) $sql.= " AND sr.rowid=".$rowid; if ($fk_facture_source) $sql.= " AND sr.fk_facture_source=".$fk_facture_source; if ($fk_invoice_supplier_source) $sql.= " AND sr.fk_invoice_supplier_source=".$fk_invoice_supplier_source; @@ -168,12 +171,14 @@ class DiscountAbsolute $this->fk_user = $obj->fk_user; $this->fk_facture_line = $obj->fk_facture_line; $this->fk_facture = $obj->fk_facture; - $this->fk_facture_source = $obj->fk_facture_source; // Id avoir source - $this->ref_facture_source = $obj->ref_facture_source; // Ref avoir source + $this->fk_facture_source = $obj->fk_facture_source; // Id credit note or deposit source + $this->ref_facture_source = $obj->ref_facture_source; // Ref credit note or deposit source + $this->type_facture_source = $obj->type_facture_source; // Type credit note or deposit source $this->fk_invoice_supplier_line = $obj->fk_invoice_supplier_line; $this->fk_invoice_supplier = $obj->fk_invoice_supplier; - $this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id avoir source - $this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref avoir source + $this->fk_invoice_supplier_source = $obj->fk_invoice_supplier_source; // Id credit note or deposit source + $this->ref_invoice_supplier_source = $obj->ref_invoice_supplier_source; // Ref credit note or deposit source + $this->type_invoice_supplier_source = $obj->type_invoice_supplier_source; // Type credit note or deposit source $this->description = $obj->description; $this->datec = $this->db->jdate($obj->datec); @@ -688,7 +693,7 @@ class DiscountAbsolute if ($option == 'invoice') { $facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source; $link=! empty($this->discount_type)?'/fourn/facture/card.php':'/compta/facture/card.php'; - $label=$langs->trans("ShowDiscount").': '.$this->ref_facture_source; + $label=$langs->trans("ShowSourceInvoice").': '.$this->ref_facture_source; $link = ''; $linkend=''; $ref=! empty($this->discount_type)?$this->ref_invoice_supplier_source:$this->ref_facture_source; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e6a6a077cf8..61558434105 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7129,8 +7129,8 @@ class Form // Left part of banner if ($morehtmlleft) { - if ($conf->browser->layout == 'phone') $ret.='
'.$morehtmlleft.'
'; // class="center" to have photo in middle - else $ret.='
'.$morehtmlleft.'
'; + if ($conf->browser->layout == 'phone') $ret.='
'.$morehtmlleft.'
'; // class="center" to have photo in middle + else $ret.='
'.$morehtmlleft.'
'; } //if ($conf->browser->layout == 'phone') $ret.='
'; diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 42fec36ef6a..0277630ae78 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -77,23 +77,23 @@ class FormCron extends Form $out.=''; } } else { - $out=''; - if ($selected=='command') { - $selected_attr=' selected '; - } else { - $selected_attr=''; - } - $out.= ''; + if ($selected=='command') { + $selected_attr=' selected '; + } else { + $selected_attr=''; + } + $out.= ''; - if ($selected=='method') { - $selected_attr=' selected '; - } else { - $selected_attr=''; - } - $out.= ''; + if ($selected=='method') { + $selected_attr=' selected '; + } else { + $selected_attr=''; + } + $out.= ''; - $out.=''; + $out.=''; } return $out; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index b845f799bb6..cd6f64c3242 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -496,17 +496,31 @@ class SMTPs return $_retVal; } } + + // Default authentication method is LOGIN + if (empty($conf->global->MAIL_SMTP_AUTH_TYPE)) $conf->global->MAIL_SMTP_AUTH_TYPE = 'LOGIN'; + // Send Authentication to Server // Check for errors along the way - $this->socket_send_str('AUTH LOGIN', '334'); - - // User name will not return any error, server will take anything we give it. - $this->socket_send_str(base64_encode($this->_smtpsID), '334'); - - // The error here just means the ID/password combo doesn't work. - // There is not a method to determine which is the problem, ID or password - if ( ! $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235') ) - $this->_setErr(130, 'Invalid Authentication Credentials.'); + switch ($conf->global->MAIL_SMTP_AUTH_TYPE) { + case 'PLAIN': + $this->socket_send_str('AUTH PLAIN', '334'); + // The error here just means the ID/password combo doesn't work. + $_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235'); + break; + case 'LOGIN': + default: + $this->socket_send_str('AUTH LOGIN', '334'); + // User name will not return any error, server will take anything we give it. + $this->socket_send_str(base64_encode($this->_smtpsID), '334'); + // The error here just means the ID/password combo doesn't work. + // There is not a method to determine which is the problem, ID or password + $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235'); + break; + } + if (! $_retVal) { + $this->_setErr(130, 'Invalid Authentication Credentials.'); + } } else { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index cb4e7ef9e5a..3b381bc5796 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -1004,7 +1004,7 @@ class Utils if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n"); - $sql='SELECT * FROM '.$table; + $sql='SELECT * FROM '.$table; // Here SELECT * is allowed because we don't have definition of columns to take $result = $db->query($sql); while($row = $db->fetch_row($result)) { diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 9e26e1583a6..2f6dbf16943 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -318,7 +318,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') else { //issue the CKEditor Callback -SendCKEditorResults( + SendCKEditorResults( $CKEcallback, $sFileUrl, ($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful') diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 17f847b9a37..b66f2abcd8b 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -401,11 +401,11 @@ EOF; */ function SendCKEditorResults($callback, $sFileUrl, $customMsg = '') { - echo ''; + echo ''; } diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c35318dc7ae..54c0f02abde 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1039,16 +1039,16 @@ function price2numjs(amount) { if (amount == '') return ''; transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { - $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); - } - if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { - $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); - } - if ($thousand == 'Space') $thousand=' '; - print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript + $dec = ','; + $thousand = ' '; + if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { + $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); + } + if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { + $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); + } + if ($thousand == 'Space') $thousand=' '; + print "var dec='" . dol_escape_js($dec) . "'; var thousand='" . dol_escape_js($thousand) . "';\n"; // Set var in javascript ?> var main_max_dec_shown = global->MAIN_MAX_DECIMALS_SHOWN); ?>; diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 6c7f3e2c35c..cb8a80bbd78 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -140,5 +140,5 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H time_js_next_test += time_auto_update; console.log('Updated time_js_next_test. New value is '+time_js_next_test); } -id=$obj->id; print ''.$staticaction->getNomUrl(1, 34).''; - // print ''.dol_trunc($obj->label,22).''; + // print ''.dol_trunc($obj->label,22).''; print ''; if ($obj->rowid > 0) @@ -414,10 +414,10 @@ function agenda_prepare_head() if ($conf->global->MAIN_FEATURES_LEVEL > 0) { - $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; - $head[$h][1] = $langs->trans("Reminders"); - $head[$h][2] = 'reminders'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; + $head[$h][1] = $langs->trans("Reminders"); + $head[$h][2] = 'reminders'; + $h++; } $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 2230bfac5a1..91e0b719734 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -47,13 +47,13 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; -// if ($conf->global->MAIN_FEATURES_LEVEL >= 1) -// { + // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) + // { $head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id; $head[$h][1] = $langs->trans("PlannedTransactions"); $head[$h][2] = 'cash'; $h++; -// } + // } $head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id; $head[$h][1] = $langs->trans("IOMonthlyReporting"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 1730d51383d..f1fd6ed220f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -624,7 +624,7 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask if (empty($arrayreplacementisregex)) { - $content = make_substitutions($content, $arrayreplacement, null); + $content = make_substitutions($content, $arrayreplacement, null); } else { @@ -1044,8 +1044,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable $checkvirusarray=dolCheckVirus($src_file); if (count($checkvirusarray)) { - dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING); - return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray); + dol_syslog('Files.lib::dol_move_uploaded_file File "'.$src_file.'" (target name "'.$dest_file.'") KO with antivirus: errors='.join(',', $checkvirusarray), LOG_WARNING); + return 'ErrorFileIsInfectedWithAVirus: '.join(',', $checkvirusarray); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index caa0915b91a..b36733a91f2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -45,9 +45,9 @@ include_once DOL_DOCUMENT_ROOT .'/core/lib/json.lib.php'; * * @param string $type Type of database (mysql, pgsql...) * @param string $host Address of database server - * @param string $user Nom de l'utilisateur autorise - * @param string $pass Mot de passe - * @param string $name Nom de la database + * @param string $user Authorized username + * @param string $pass Password + * @param string $name Name of database * @param int $port Port of database server * @return DoliDB A DoliDB instance */ @@ -464,36 +464,36 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti $maxloop=20; $loopnb=0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. { - $loopnb++; $newout = ''; + $loopnb++; $newout = ''; - if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; } - elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; } - elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; } - elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } - elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } - elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); } - elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } - elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } - elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); } - elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID') - { - $newout = $mysoc->country_id; - } - elseif ($reg[1] == 'USER_ID' || $reg[1] == 'USERID') - { - $newout = $user->id; - } - elseif ($reg[1] == 'USER_SUPERVISOR_ID' || $reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID') - { - $newout = $user->fk_user; - } - elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') - { - $newout = $conf->entity; - } - else $newout = ''; // Key not found, we replace with empty string - //var_dump('__'.$reg[1].'__ -> '.$newout); - $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); + if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; } + elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; } + elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; } + elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } + elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } + elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); } + elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; } + elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; } + elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); } + elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID') + { + $newout = $mysoc->country_id; + } + elseif ($reg[1] == 'USER_ID' || $reg[1] == 'USERID') + { + $newout = $user->id; + } + elseif ($reg[1] == 'USER_SUPERVISOR_ID' || $reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID') + { + $newout = $user->fk_user; + } + elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') + { + $newout = $conf->entity; + } + else $newout = ''; // Key not found, we replace with empty string + //var_dump('__'.$reg[1].'__ -> '.$newout); + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); } } @@ -876,7 +876,7 @@ function dol_string_unaccent($str) else { // See http://www.ascii-code.com/ -$string = strtr( + $string = strtr( $str, "\xC0\xC1\xC2\xC3\xC4\xC5\xC7 \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 @@ -3418,7 +3418,7 @@ function img_edit_remove($titlealt = 'default', $other = '') * Show logo editer/modifier fiche * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param integer $float Si il faut y mettre le style "float: right" + * @param integer $float If you have to put the style "float: right" * @param string $other Add more attributes on img * @return string Return tag img */ @@ -3435,7 +3435,7 @@ function img_edit($titlealt = 'default', $float = 0, $other = '') * Show logo view card * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param integer $float Si il faut y mettre le style "float: right" + * @param integer $float If you have to put the style "float: right" * @param string $other Add more attributes on img * @return string Return tag img */ @@ -3793,10 +3793,9 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss /** - * Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remontee des bugs. - * On doit appeler cette fonction quand une erreur technique bloquante est rencontree. - * Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant - * renvoyer leur erreur par l'intermediaire de leur propriete "error". + * Displays error message system with all the information to facilitate the diagnosis and the escalation of the bugs. + * This function must be called when a blocking technical error is encountered. + * However, one must try to call it only within php pages, classes must return their error through their property "error". * * @param DoliDB $db Database handler * @param mixed $error String or array of errors strings to show @@ -3857,7 +3856,7 @@ function dol_print_error($db = '', $error = '', $errors = null) if (! empty($conf->modules)) { - $out.="".$langs->trans("Modules").": ".join(', ', $conf->modules)."
\n"; + $out.="".$langs->trans("Modules").": ".join(', ', $conf->modules)."
\n"; } if (is_object($db)) @@ -5895,7 +5894,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, // Add SIGNATURE into substitutionarray first, so, when we will make the substitution, // this will include signature content first and then replace var found into content of signature $signature = $user->signature; -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__USER_SIGNATURE__' => (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : '') ) ); @@ -5905,7 +5904,7 @@ $substitutionarray=array_merge($substitutionarray, array( $substitutionarray['__SIGNATURE__'] = (string) (($signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($signature), 30) : $signature) : ''); } -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_LASTNAME__' => (string) $user->lastname, @@ -5918,7 +5917,7 @@ $substitutionarray=array_merge($substitutionarray, array( } if ((empty($exclude) || ! in_array('mycompany', $exclude)) && is_object($mysoc)) { -$substitutionarray=array_merge($substitutionarray, array( + $substitutionarray=array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, @@ -6416,11 +6415,11 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1) } elseif ($nameorder == 2 || $nameorder == 3) { - $ret.=$firstname; - if (empty($ret) && $nameorder == 3) - { - $ret.=$lastname; - } + $ret.=$firstname; + if (empty($ret) && $nameorder == 3) + { + $ret.=$lastname; + } } else { @@ -7956,7 +7955,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield if (!isset($dictvalues[$tablename])) { $dictvalues[$tablename] = array(); - $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; + $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; // Here select * is allowed as it is generic code and we don't have list of fields if ($checkentity) $sql.= ' AND entity IN (0,'.getEntity($tablename).')'; $resql = $db->query($sql); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 6543b659a88..7780c7d3b12 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -505,14 +505,7 @@ function dolAddEmailTrackId($email, $trackingid) function isValidMailDomain($mail) { list($user, $domain) = explode("@", $mail, 2); - if (checkdnsrr($domain, "MX")) - { - return true; - } - else - { - return false; - } + return checkdnsrr($domain, "MX"); } /** diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 5eb45b261a0..8c97bbb348f 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -317,19 +317,19 @@ function utf162utf8($utf16) switch(true) { case ((0x7F & $bytes) == $bytes): - // this case should never be reached, because we are in ASCII range - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // this case should never be reached, because we are in ASCII range + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr($bytes); case (0x07FF & $bytes) == $bytes: - // return a 2-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 2-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: - // return a 3-byte UTF-8 character - // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + // return a 3-byte UTF-8 character + // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d6dc59d1dcc..106ce8336a8 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -780,171 +780,171 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec //if ($lines[$i]->fk_task_parent == $parent) //{ - // If we want all or we have a role on task, we show it - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + // If we want all or we have a role on task, we show it + if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + { + //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); + + // Break on a new project + if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { - //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); - - // Break on a new project - if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) + $lastprojectid=$lines[$i]->fk_project; + if ($preselectedday) { - $lastprojectid=$lines[$i]->fk_project; - if ($preselectedday) - { - $projectstatic->id = $lines[$i]->fk_project; - } + $projectstatic->id = $lines[$i]->fk_project; } - - if (empty($workloadforid[$projectstatic->id])) - { - if ($preselectedday) - { - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week - $workloadforid[$projectstatic->id]=1; - } - } - - $projectstatic->id=$lines[$i]->fk_project; - $projectstatic->ref=$lines[$i]->project_ref; - $projectstatic->title=$lines[$i]->project_label; - $projectstatic->public=$lines[$i]->public; - - $taskstatic->id=$lines[$i]->task_id; - $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); - $taskstatic->label=$lines[$i]->task_label; - $taskstatic->date_start=$lines[$i]->date_start; - $taskstatic->date_end=$lines[$i]->date_end; - - $thirdpartystatic->id=$lines[$i]->socid; - $thirdpartystatic->name=$lines[$i]->thirdparty_name; - $thirdpartystatic->email=$lines[$i]->thirdparty_email; - - if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) - { - print ''."\n"; - print ''; - print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - if ($projectstatic->title) - { - print ' - '; - print $projectstatic->title; - } - print ''; - print ''; - } - - if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; - - print ''."\n"; - - // User - /* - print ''; - print $fuser->getNomUrl(1, 'withproject', 'time'); - print ''; - */ - - // Project - print ""; - if ($oldprojectforbreak == -1) - { - print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); - print '
'.$projectstatic->title; - } - print ""; - - // Thirdparty - print ''; - if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); - print ''; - - // Ref - print ''; - print ''; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print $taskstatic->getNomUrl(1, 'withproject', 'time'); - // Label task - print '
'; - for ($k = 0 ; $k < $level ; $k++) print "   "; - print $taskstatic->label; - //print "
"; - //for ($k = 0 ; $k < $level ; $k++) print "   "; - //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); - print "\n"; - - // Date - print ''; - print dol_print_date($lines[$i]->timespent_datehour, 'day'); - print ''; - - $disabledproject=1;$disabledtask=1; - //print "x".$lines[$i]->fk_project; - //var_dump($lines[$i]); - //var_dump($projectsrole[$lines[$i]->fk_project]); - // If at least one role for project - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) - { - $disabledproject=0; - $disabledtask=0; - } - // If $restricteditformytask is on and I have no role on task, i disable edit - if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) - { - $disabledtask=1; - } - - // Hour - print ''; - print dol_print_date($lines[$i]->timespent_datehour, 'hour'); - print ''; - - $cssonholiday=''; - if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; - elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; - elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; - - // Duration - print ''; - - $dayWorkLoad = $lines[$i]->timespent_duration; - $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; - - $alreadyspent=''; - if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); - - print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); - - $modeinput='hours'; - - print ''; - - print ''; - - // Note - print ''; - print ''; - print ''; - - // Warning - print ''; - /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); - else if ($disabledtask) - { - $titleassigntask = $langs->trans("AssignTaskToMe"); - if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); - - print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); - }*/ - print ''; - - print "\n"; } + + if (empty($workloadforid[$projectstatic->id])) + { + if ($preselectedday) + { + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $workloadforid[$projectstatic->id]=1; + } + } + + $projectstatic->id=$lines[$i]->fk_project; + $projectstatic->ref=$lines[$i]->project_ref; + $projectstatic->title=$lines[$i]->project_label; + $projectstatic->public=$lines[$i]->public; + + $taskstatic->id=$lines[$i]->task_id; + $taskstatic->ref=($lines[$i]->task_ref?$lines[$i]->task_ref:$lines[$i]->task_id); + $taskstatic->label=$lines[$i]->task_label; + $taskstatic->date_start=$lines[$i]->date_start; + $taskstatic->date_end=$lines[$i]->date_end; + + $thirdpartystatic->id=$lines[$i]->socid; + $thirdpartystatic->name=$lines[$i]->thirdparty_name; + $thirdpartystatic->email=$lines[$i]->thirdparty_email; + + if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) + { + print ''."\n"; + print ''; + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + if ($projectstatic->title) + { + print ' - '; + print $projectstatic->title; + } + print ''; + print ''; + } + + if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id; + + print ''."\n"; + + // User + /* + print ''; + print $fuser->getNomUrl(1, 'withproject', 'time'); + print ''; + */ + + // Project + print ""; + if ($oldprojectforbreak == -1) + { + print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); + print '
'.$projectstatic->title; + } + print ""; + + // Thirdparty + print ''; + if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project', 10); + print ''; + + // Ref + print ''; + print ''; + for ($k = 0 ; $k < $level ; $k++) print "   "; + print $taskstatic->getNomUrl(1, 'withproject', 'time'); + // Label task + print '
'; + for ($k = 0 ; $k < $level ; $k++) print "   "; + print $taskstatic->label; + //print "
"; + //for ($k = 0 ; $k < $level ; $k++) print "   "; + //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); + print "\n"; + + // Date + print ''; + print dol_print_date($lines[$i]->timespent_datehour, 'day'); + print ''; + + $disabledproject=1;$disabledtask=1; + //print "x".$lines[$i]->fk_project; + //var_dump($lines[$i]); + //var_dump($projectsrole[$lines[$i]->fk_project]); + // If at least one role for project + if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) + { + $disabledproject=0; + $disabledtask=0; + } + // If $restricteditformytask is on and I have no role on task, i disable edit + if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) + { + $disabledtask=1; + } + + // Hour + print ''; + print dol_print_date($lines[$i]->timespent_datehour, 'hour'); + print ''; + + $cssonholiday=''; + if (! $isavailable[$preselectedday]['morning'] && ! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayallday '; + elseif (! $isavailable[$preselectedday]['morning']) $cssonholiday.='onholidaymorning '; + elseif (! $isavailable[$preselectedday]['afternoon']) $cssonholiday.='onholidayafternoon '; + + // Duration + print ''; + + $dayWorkLoad = $lines[$i]->timespent_duration; + $totalforeachline[$preselectedday]+=$lines[$i]->timespent_duration; + + $alreadyspent=''; + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); + + print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); + + $modeinput='hours'; + + print ''; + + print ''; + + // Note + print ''; + print ''; + print ''; + + // Warning + print ''; + /*if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("UserIsNotContactOfProject")); + else if ($disabledtask) + { + $titleassigntask = $langs->trans("AssignTaskToMe"); + if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser", '...'); + + print $form->textwithpicto('',$langs->trans("TaskIsNotAssignedToUser", $titleassigntask)); + }*/ + print ''; + + print "\n"; + } //} //else //{ diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index af27cea4292..15ca4de37e0 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -105,18 +105,18 @@ function reception_admin_prepare_head() if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFields"); - $head[$h][2] = 'attributes_reception'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes_reception'; + $h++; } if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFieldsLines"); - $head[$h][2] = 'attributeslines_reception'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $head[$h][2] = 'attributeslines_reception'; + $h++; } diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index a4ddb68dbd3..b45eaa4b7a9 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -180,7 +180,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) if (! empty($location)) fwrite($calfileh, "LOCATION:".$encoding.$location."\n"); if ($fulldayevent) fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n"); - + // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2 if ($fulldayevent) fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n"); @@ -320,7 +320,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fwrite($fichier, $form); $form=''."\n". -// 'fr'."\n". + // 'fr'."\n". 'Dolibarr'."\n". ''.$date.''."\n". 'Dolibarr'."\n"; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index bf58ebb6e8e..ae8b33793d2 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -149,7 +149,7 @@ class pdf_sponge extends ModelePDFFactures $this->description = $langs->trans('PDFSpongeDescription'); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - // Dimensiont page + // Dimension page $this->type = 'pdf'; $formatarray=pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -423,7 +423,7 @@ class pdf_sponge extends ModelePDFFactures } } - // Affiche notes + // Display notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { @@ -462,7 +462,7 @@ class pdf_sponge extends ModelePDFFactures { $pdf->rollbackTransaction(true); - // prepar pages to receive notes + // prepare pages to receive notes while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; @@ -496,7 +496,7 @@ class pdf_sponge extends ModelePDFFactures } - // apply note frame to previus pages + // apply note frame to previous pages $i = $pageposbeforenote; while ($i < $pageposafternote) { $pdf->setPage($i); @@ -557,17 +557,17 @@ class pdf_sponge extends ModelePDFFactures $height_note=0; } - // Use new auto collum system + // Use new auto column system $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref); - // Simulation de tableau pour connaitre la hauteur de la ligne de titre - $pdf->startTransaction(); - $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); - $pdf->rollbackTransaction(true); + // Table simulation to know the height of the title line + $pdf->startTransaction(); + $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); + $pdf->rollbackTransaction(true); - $iniY = $tab_top + $this->tabTitleHeight + 2; - $curY = $tab_top + $this->tabTitleHeight + 2; - $nexY = $tab_top + $this->tabTitleHeight + 2; + $iniY = $tab_top + $this->tabTitleHeight + 2; + $curY = $tab_top + $this->tabTitleHeight + 2; + $nexY = $tab_top + $this->tabTitleHeight + 2; // Loop on each lines $pageposbeforeprintlines=$pdf->getPage(); @@ -842,19 +842,19 @@ class pdf_sponge extends ModelePDFFactures $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - // Affiche zone infos + // Display infos area $posy=$this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs); - // Affiche zone totaux + // Display total zone $posy=$this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); - // Affiche zone versements + // Display payment area if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { $posy=$this->drawPaymentsTable($pdf, $object, $posy, $outputlangs); } - // Pied de page + // Pagefoot $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); @@ -1125,7 +1125,7 @@ class pdf_sponge extends ModelePDFFactures // Show payment mode CHQ if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') { - // Si mode reglement non force ou si force a CHQ + // If payment mode not forced or forced to CHQ if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); @@ -1213,7 +1213,7 @@ class pdf_sponge extends ModelePDFFactures $tab2_hl = 4; $pdf->SetFont('', '', $default_font_size - 1); - // Tableau total + // Total table $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) // To work with US executive format { @@ -1226,7 +1226,7 @@ class pdf_sponge extends ModelePDFFactures - // pourcentage global d'avancement + // overall percentage of advancement $percent = 0; $i=0; foreach ($object->lines as $line) @@ -1305,7 +1305,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->setY($posy); } - // Display curent total + // Display current total $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); @@ -1313,7 +1313,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($col2x, $posy); $facSign = ''; if($i>1){ - $facSign = $object->total_ht>=0?'+':''; // gestion d'un cas particulier client + $facSign = $object->total_ht>=0?'+':''; // management of a particular customer case } if($fac->type === facture::TYPE_CREDIT_NOTE){ diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 3528b4eae3e..3ef5fd0c7ac 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; /** - * Classe du modele de numerotation de reference de facture Mars + * Class to manage invoice numbering rules Mars */ class mod_facture_mars extends ModeleNumRefFactures { @@ -159,7 +159,7 @@ class mod_facture_mars extends ModeleNumRefFactures elseif ($invoice->type == 3) $prefix=$this->prefixdeposit; else $prefix=$this->prefixinvoice; - // D'abord on recupere la valeur max + // First we get the max value $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql.= " FROM ".MAIN_DB_PREFIX."facture"; diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 44efad2ef92..bb8f94d43a1 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -74,7 +74,7 @@ class mod_facture_mercure extends ModeleNumRefFactures $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Invoice"), $langs->transnoentities("Invoice")); $tooltip.=$langs->trans("GenericMaskCodes5"); - // Parametrage du prefix + // Setting the prefix $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).''; @@ -82,17 +82,17 @@ class mod_facture_mercure extends ModeleNumRefFactures $texte.= ''; - // Parametrage du prefix des replacement + // Prefix setting of replacement invoices $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte.= ''; - // Parametrage du prefix des avoirs + // Prefix setting of credit note $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte.= ''; - // Parametrage du prefix des acomptes + // Prefix setting of deposit $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; $texte.= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte.= ''; diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 0727e4df4e2..d5196867b67 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -26,7 +26,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php'; /** * \class mod_facture_terre - * \brief Classe du modele de numerotation de reference de facture Terre + * \brief Class of numbering module Terre for invoices */ class mod_facture_terre extends ModeleNumRefFactures { @@ -189,7 +189,7 @@ class mod_facture_terre extends ModeleNumRefFactures if ($invoice->type == 2) $prefix=$this->prefixcreditnote; elseif ($invoice->type == 3) $prefix=$this->prefixdeposit; else $prefix=$this->prefixinvoice; - // D'abord on recupere la valeur max + // First we get the max value $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql.= " FROM ".MAIN_DB_PREFIX."facture"; diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index a2bd576bdcd..ba65eeeca9c 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -23,13 +23,13 @@ /** * \file htdocs/core/modules/facture/modules_facture.php * \ingroup facture - * \brief Fichier contenant la classe mere de generation des factures en PDF - * et la classe mere de numerotation des factures + * \brief File that contains parent class for invoices models + * and parent class for invoices numbering models */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit /** @@ -66,7 +66,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator } /** - * Classe mere des modeles de numerotation des references de facture + * Parent class of invoice reference numbering templates */ abstract class ModeleNumRefFactures { diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 5b116aa8d93..4ed16dc69a3 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -182,7 +182,9 @@ class modExpenseReport extends DolibarrModules $this->export_permission[$r]=array(array("expensereport","export")); $this->export_fields_array[$r]=array( 'd.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove', - 'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic', + 'd.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC', + 'd.fk_statut'=>'Status','d.paid'=>'Paid', + 'd.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','d.detail_cancel'=>'MOTIF_CANCEL','d.detail_refuse'=>'MOTIF_REFUS', 'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate', 'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref', 'user_rib.iban_prefix' => 'IBAN', 'user_rib.bic' => 'BIC', 'user_rib.code_banque' => 'BankCode', 'user_rib.bank' => 'BankName', 'user_rib.proprio' => 'BankAccountOwner', @@ -190,7 +192,9 @@ class modExpenseReport extends DolibarrModules ); $this->export_TypeFields_array[$r]=array( 'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date', - 'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric','d.note_private'=>'Text','d.note_public'=>'Text', + 'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric', + 'd.fk_statut'=>"Numeric",'d.paid'=>'Numeric', + 'd.note_private'=>'Text','d.note_public'=>'Text','d.detail_cancel'=>'Text','d.detail_refuse'=>'Text', 'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric', 'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text', 'user_rib.iban_prefix' => 'Text', 'user_rib.bic' => 'Text', 'user_rib.code_banque' => 'Text', 'user_rib.bank' => 'Text', 'user_rib.proprio' => 'Text', diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index a3e3e539468..1db0db2e6f5 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -390,7 +390,7 @@ class modProduct extends DolibarrModules 'p.length' => "Length", 'p.length_units' => "LengthUnit", 'p.width' => "Width", - 'p.width_units' => "VolumeUnits", + 'p.width_units' => "WidthUnits", 'p.height' => "Height", 'p.height_units' => "HeightUnit", 'p.surface' => "Surface", diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index a1c14d65c90..780a9078f2b 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -360,7 +360,7 @@ class modService extends DolibarrModules 'p.length' => "Length", 'p.length_units' => "LengthUnit", 'p.width' => "Width", - 'p.width_units' => "VolumeUnits", + 'p.width_units' => "WidthUnits", 'p.height' => "Height", 'p.height_units' => "HeightUnit", 'p.surface' => "Surface", diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 6be5e3904ab..93d1b37c690 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -177,13 +177,13 @@ class InterfaceLogevents extends DolibarrTriggers } // If not found -/* + /* else { dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action."); return 0; } -*/ + */ // Add more information into desc from the context property if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit']; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 5676bb82cfb..e72da40d6b0 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -251,7 +251,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'BILL_UNVALIDATE') { - // Load translation files required by the page + // Load translation files required by the page $langs->loadLangs(array("agenda","other","bills")); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref); @@ -808,9 +808,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref); if ($object->oldcopy->fk_user_assign > 0) { - $tmpuser=new User($this->db); - $tmpuser->fetch($object->oldcopy->fk_user_assign); - $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); + $tmpuser=new User($this->db); + $tmpuser->fetch($object->oldcopy->fk_user_assign); + $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); } else { diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 301d565c2ba..b9dbd340d88 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -181,7 +181,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'CONTACT_MODIFY': case 'CONTACT_DELETE': case 'CONTACT_ENABLEDISABLE': - + break; // Products // case 'PRODUCT_CREATE': // case 'PRODUCT_MODIFY': @@ -221,7 +221,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers case 'LINEORDER_INSERT': case 'LINEORDER_UPDATE': case 'LINEORDER_DELETE': - + break; // Supplier orders // case 'ORDER_SUPPLIER_CREATE': // case 'ORDER_SUPPLIER_CLONE': diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 14ee77f0146..d83e6f4e258 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -561,8 +561,15 @@ if ($num > 0) } if ($user->rights->cron->execute) { - if (!empty($obj->status)) print 'global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY).($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").''; - else print ''.img_picto($langs->trans('JobDisabled'), "playdisabled").''; + if (!empty($obj->status)) { + print 'global->CRON_KEY)?'':'&securitykey='.$conf->global->CRON_KEY); + print ($sortfield?'&sortfield='.$sortfield:''); + print ($sortorder?'&sortorder='.$sortorder:''); + print $param."\" title=\"".dol_escape_htmltag($langs->trans('CronExecute'))."\">".img_picto($langs->trans('CronExecute'), "play").''; + } else { + print ''.img_picto($langs->trans('JobDisabled'), "playdisabled").''; + } } else { print ''.img_picto($langs->trans('NotEnoughPermissions'), "playdisabled").''; } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 4db968b13b4..d3f37771dd7 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -500,7 +500,7 @@ if (! empty($id) && $action == 'edit') print ''; - dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'invoicing'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic'); print ''; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 527b9062c2e..70fabfcdc29 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -58,12 +58,16 @@ class Don extends CommonObject public $ismultientitymanaged = 1; /** - * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + * @var string String with name of icon for object don. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'generic'; public $date; public $amount; + + /** + * @var string Thirdparty name + */ public $societe; /** @@ -71,18 +75,29 @@ class Don extends CommonObject */ public $address; + /** + * @var string Zipcode + */ public $zip; + + /** + * @var string Town + */ public $town; + + /** + * @var string Email + */ public $email; public $public; /** - * @var int ID + * @var int project ID */ public $fk_project; /** - * @var int ID + * @var int type payment ID */ public $fk_typepayment; @@ -90,7 +105,14 @@ class Don extends CommonObject public $date_valid; public $modepaymentid = 0; + /** + * @var array Array of status label + */ public $labelstatut; + + /** + * @var array Array of status label short + */ public $labelstatutshort; /** diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php deleted file mode 100644 index d3f2518a53c..00000000000 --- a/htdocs/expensereport/export_csv.php +++ /dev/null @@ -1,195 +0,0 @@ - - * Copyright (C) 2018 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/expensereport/index.php - * \ingroup expensereport - * \brief Page list of expenses - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; - -// Load translation files required by the page -$langs->loadlangs(array('users', 'trips')); - -if(!$user->rights->expensereport->export_csv) { - accessforbidden(); - exit(); -} - -// Security check -$socid = $_GET["socid"]?$_GET["socid"]:''; -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'expensereport', '', ''); - -$req = "SELECT * FROM ".MAIN_DB_PREFIX."rights_def WHERE id = '178'"; -$result = $db->query($req); -$num = $db->num_rows($result); - -if($num < 1) { - $insert = "INSERT INTO ".MAIN_DB_PREFIX."rights_def ("; - $insert.= "`id` ,"; - $insert.= "`libelle` ,"; - $insert.= "`module` ,"; - $insert.= "`entity` ,"; - $insert.= "`perms` ,"; - $insert.= "`subperms` ,"; - $insert.= "`type` ,"; - $insert.= "`bydefault`"; - $insert.= ")"; - $insert.= "VALUES ("; - $insert.= "'178', 'Exporter les notes de frais au format CSV', 'expensereport', '1', 'export_csv', NULL , 'r', '0'"; - $insert.= ")"; - - $req = $db->query($insert); -} - - -/* - * View - */ - -llxHeader(); - -print load_fiche_titre($langs->trans("ExportTripCSV")); - -print '
'; - -print '
'; -print ''; -print '

Choisir le mois à exporter : '; - -$year = date('Y', time()); -$month = date('m', time()); - -print ' '; - -print ' '; - -print ''; -print '

'; -print ''."\n"; - -// Si c'est une action -if (isset($_POST['action'])) -{ - if($_POST['action'] == 'export') - { - $dateselected = $_POST['annee'].'-'.$_POST['mois']; - - //var_dump($conf->expensereport->dir_output.'/export/'); - if (!file_exists($conf->expensereport->dir_output.'/export/')) - { - dol_mkdir($conf->expensereport->dir_output.'/export/'); - } - - $dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv'; - $outputlangs = $langs; - $outputlangs->charset_output = 'UTF-8'; - - $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; - $sql.= ' AND d.entity IN ('.getEntity('expensereport').')'; - $sql.= " ORDER BY d.rowid"; - - $result = $db->query($sql); - $num = $db->num_rows($result); - if ($num) - { - $open = fopen($dir, "w+"); - - $ligne = "ID, Référence, ----, Date paiement, Montant HT, TVA, Montant TTC\n"; - for ($i = 0; $i < $num; $i++) - { - $ligne.= "----, ----, ----, ----, ----, ----, ----\n"; - $objet = $db->fetch_object($result); - $objet->total_ht = number_format($objet->total_ht, 2); - $objet->total_tva = number_format($objet->total_tva, 2); - $objet->total_ttc = number_format($objet->total_ttc, 2); - $objet->ref = trim($objet->ref); - $ligne.= "{$objet->rowid}, {$objet->ref}, ----, {$objet->total_ht}, {$objet->total_tva}, {$objet->total_ttc}\n"; - - $ligne.= "--->, Ligne, Type, Description, ----, ----, ----\n"; - - - $sql2 = "SELECT de.rowid, t.label as libelle, de.comments, de.total_ht, de.total_tva, de.total_ttc"; - $sql2.= " FROM ".MAIN_DB_PREFIX."expensereport_det as de,"; - $sql2.= " ".MAIN_DB_PREFIX."c_type_fees as t"; - $sql2.= " WHERE de.fk_c_type_fees = t.id"; - $sql2.= " AND de.fk_expensereport = '".$objet->rowid."'"; - $sql2.= " ORDER BY de.date"; - - $result2 = $db->query($sql2); - $num2 = $db->num_rows($result2); - - if($num2) { - for ($a = 0; $a < $num2; $a++) - { - $objet2 = $db->fetch_object($result2); - $objet2->total_ht = number_format($objet2->total_ht, 2); - $objet2->total_tva = number_format($objet2->total_tva, 2); - $objet2->total_ttc = number_format($objet2->total_ttc, 2); - $objet2->comments = str_replace(',', ';', $objet2->comments); - $objet2->comments = str_replace("\r\n", ' ', $objet2->comments); - $objet2->comments = str_replace("\n", ' ', $objet2->comments); - - $ligne.= "--->, {$objet2->rowid}, {$objet2->libelle}, {$objet2->comments}, {$objet2->total_ht}, {$objet2->total_tva}, {$objet2->total_ttc}\n"; - } - } - } - - $ligne = $outputlangs->convToOutputCharset($ligne); - - fwrite($open, $ligne); - fclose($open); - - print 'Télécharger le fichier expensereport-'.$dateselected.'.csv'; - } else { - print ''.$langs->trans('NoTripsToExportCSV').''; - } - } -} - -print '
'; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/install/lib/repair.lib.php b/htdocs/install/lib/repair.lib.php index 98eac2437fa..dc6544fc2be 100644 --- a/htdocs/install/lib/repair.lib.php +++ b/htdocs/install/lib/repair.lib.php @@ -72,7 +72,7 @@ function checkLinkedElements($sourcetype, $targettype) $out = $langs->trans('SourceType').': '.$sourcetype.' => '.$langs->trans('TargetType').': '.$targettype.' '; - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX .'element_element'; + $sql = 'SELECT rowid, fk_source, fk_target FROM '.MAIN_DB_PREFIX .'element_element'; $sql.= ' WHERE sourcetype="'.$sourcetype.'" AND targettype="'.$targettype.'"'; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 484ad5f7867..0acd25ec536 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -151,7 +151,7 @@ ErrorBillNotFound=Invoice %s does not exist ErrorInvoiceAlreadyReplaced=Error, you tried to validate an invoice to replace invoice %s. But this one has already been replaced by invoice %s. ErrorDiscountAlreadyUsed=Error, discount already used ErrorInvoiceAvoirMustBeNegative=Error, correct invoice must have a negative amount -ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have a positive amount +ErrorInvoiceOfThisTypeMustBePositive=Error, this type of invoice must have an amount excluding tax positive (or null) ErrorCantCancelIfReplacementInvoiceNotValidated=Error, can't cancel an invoice that has been replaced by another invoice that is still in draft status ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or another is already used so discount series cannot be removed. BillFrom=From @@ -295,7 +295,8 @@ AddGlobalDiscount=Create absolute discount EditGlobalDiscounts=Edit absolute discounts AddCreditNote=Create credit note ShowDiscount=Show discount -ShowReduc=Show the deduction +ShowReduc=Show the discount +ShowSourceInvoice=Show the source invoice RelativeDiscount=Relative discount GlobalDiscount=Global discount CreditNote=Credit note diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 34590a924be..6e9b6d66f32 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -252,6 +252,7 @@ ThirdPartyCreatedByEmailCollector=Third party created by email collector from em ContactCreatedByEmailCollector=Contact/address created by email collector from email MSGID %s ProjectCreatedByEmailCollector=Project created by email collector from email MSGID %s TicketCreatedByEmailCollector=Ticket created by email collector from email MSGID %s +OpeningHoursFormatDesc=Use a - to separate opening and closing hours.
Use a space to enter different ranges.
Example: 8-12 14-18 ##### Export ##### ExportsArea=Exports area diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4fc94feb1f4..f522ad29fa8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1625,16 +1625,16 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (!empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)){ // Add search dropdown - $toprightmenu.= top_menu_search($user, $langs); + $toprightmenu.= top_menu_search(); } if (!empty($conf->global->MAIN_USE_TOP_MENU_BOOKMARK_DROPDOWN)) { // Add bookmark dropdown - $toprightmenu .= top_menu_bookmark($user, $langs); + $toprightmenu .= top_menu_bookmark(); } // Add user dropdown - $toprightmenu.= top_menu_user($user, $langs); + $toprightmenu.= top_menu_user(); $toprightmenu.=''; @@ -1747,11 +1747,9 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead /** * Build the tooltip on user login * - * @param user $user User object - * @param Translate $langs Language object * @return string HTML content */ -function top_menu_user(User $user, Translate $langs) +function top_menu_user() { global $langs, $conf, $db, $hookmanager, $user; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -1916,15 +1914,13 @@ function top_menu_user(User $user, Translate $langs) /** * Build the tooltip on top menu bookmark * - * @param user $user User object - * @param Translate $langs Language object * @return string HTML content */ -function top_menu_bookmark(User $user, Translate $langs) +function top_menu_bookmark() { - global $langs, $conf, $db, $hookmanager, $user; - global $menumanager; - $html = ''; + global $langs, $conf, $db, $user; + + $html = ''; // Define $bookmarks if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) @@ -1938,7 +1934,7 @@ function top_menu_bookmark(User $user, Translate $langs) '; @@ -1984,15 +1980,13 @@ function top_menu_bookmark(User $user, Translate $langs) /** * Build the tooltip on top menu tsearch * - * @param user $user User object - * @param Translate $langs Language object * @return string HTML content */ -function top_menu_search(User $user, Translate $langs) +function top_menu_search() { - global $langs, $conf, $db, $hookmanager, $user; - global $menumanager; - $html = ''; + global $langs, $conf, $db, $user; + + $html = ''; $usedbyinclude=1; $arrayresult=null; @@ -2003,7 +1997,7 @@ function top_menu_search(User $user, Translate $langs) // Menu with all bookmarks foreach ($arrayresult as $keyItem => $item) { - if(empty($defaultAction)){ + if (empty($defaultAction)) { $defaultAction= $item['url']; } $buttonList.='
'; print ''."\n"; - /*$listofstatus=array_keys($listofoppstatus); - foreach ($listofstatus as $status) - { - $labelstatus = ''; - - $code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code'); - if ($code) $labelstatus = $langs->trans("OppStatus".$code); - if (empty($labelstatus)) $labelstatus=$listofopplabel[$status]; - - //$labelstatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')'; - //$labelstatus .= ' - '.price2num($listofoppstatus[$status]).'%'; - - $dataseries[]=array($labelstatus, (isset($valsamount[$status])?(float) $valsamount[$status]:0)); - if (! $conf->use_javascript_ajax) - { - - print ''; - print ''; - print ''; - print "\n"; - } - }*/ - if ($conf->use_javascript_ajax) + if ($conf->use_javascript_ajax) { print ''; } - //if ($totalinprocess != $total) print "
'.$langs->trans("Statistics").'
'.$labelstatus.''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'
'; @@ -149,11 +105,10 @@ if ($conf->use_javascript_ajax) $dolgraph->setWidth('100%'); $dolgraph->SetHeight(180); $dolgraph->draw('idgraphstatus'); - print $dolgraph->show($totaloppnb?0:1); + print $dolgraph->show($totalnb?0:1); print '
"; print ""; @@ -209,6 +164,10 @@ if ($resql) print ''; $i++; } + } else { + print ''; + print '' . $langs->trans("None") . ''; + print ''; } print ""; print "
"; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 48c633126ce..786ed7220b5 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -267,7 +267,7 @@ class Opensurveysondage extends CommonObject $this->db->free($resql); } else - { + { $this->error="Error ".$this->db->lasterror(); $ret=-1; } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 202c236abc2..30bdae7787c 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -85,8 +85,14 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count { foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]) + ); + } } } $object->fields = dol_sort_array($object->fields, 'position'); diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 299f78c1a7d..ea3f8b5e663 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -97,7 +97,8 @@ if ($_POST) { * View */ -$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_pricerules"; +$sql = "SELECT rowid, level, fk_level, var_percent, var_min_percent"; +$sql.= " FROM ".MAIN_DB_PREFIX."product_pricerules"; $query = $db->query($sql); $rules = array(); @@ -168,10 +169,10 @@ $genPriceOptions = function ($level) use ($price_options) { echo $langs->trans('SellingPrice').' '.$i; // Label of price $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; - if (! empty($conf->global->$keyforlabel)) { - print ' - '.$langs->trans($conf->global->$keyforlabel); - } - ?> + if (! empty($conf->global->$keyforlabel)) { + print ' - '.$langs->trans($conf->global->$keyforlabel); + } + ?> diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 5fd289c5514..d6f636bf4c9 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -483,7 +483,7 @@ foreach ($dirmodels as $reldir) } print ''; - // Info + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); if ($module->type == 'pdf') diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index 03e57a0c859..b12a0d41370 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -113,7 +113,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -121,7 +121,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 473b717c916..594fd6c1b9b 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 0b33d722837..d51e1541278 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -85,7 +85,7 @@ dol_fiche_head(''); trans("SellingPrice"); ?> -price_base_type; ?> + price_base_type; ?> trans("MinPrice"); ?> @@ -93,7 +93,7 @@ dol_fiche_head(''); trans("VATRate"); ?> -tva_tx; ?> + tva_tx; ?> diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index c789853868a..a0fc691d75d 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -57,7 +57,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> -photos; ?> + photos; ?> diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0af901b5abf..5ee8c502009 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -540,6 +540,17 @@ if (empty($reshook)) } } + if (GETPOST('clone_prices')) { + $result = $object->clone_price($originalId, $id); + + if ($result < 1) { + $db->rollback(); + setEventMessages($langs->trans('ErrorProductClone'), null, 'errors'); + header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $originalId); + exit(); + } + } + // $object->clone_fournisseurs($originalId, $id); $db->commit(); @@ -1453,13 +1464,13 @@ else print ''; if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Brut Length - print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print 'x'; - print 'x'; - print ' '; - print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); - print ''; + // Brut Length + print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print 'x'; + print 'x'; + print ' '; + print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); + print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { @@ -1997,8 +2008,10 @@ $formquestionclone=array( array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true), ); +if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + $formquestionclone[] = array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("CustomerPrices").')', 'value' => 0); +} if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) { $formquestionclone[]=array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1); @@ -2104,7 +2117,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $html .= ''; } else - { + { $html .= ''; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 81e2659d918..d6066b1a03a 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2019 Cedric Ancelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,15 +60,11 @@ class Products extends DolibarrApi } /** - * Get properties of a product object (from its ID, Ref, Ref_ext or Barcode) + * Get properties of a product object by id * * Return an array with product information. - * TODO implement getting a product by ref or by $ref_ext * * @param int $id ID of product - * @param string $ref Ref of element - * @param string $ref_ext Ref ext of element - * @param string $barcode Barcode of element * @param int $includestockdata Load also information about stock (slower) * @return array|mixed Data without useless information * @@ -75,32 +72,72 @@ class Products extends DolibarrApi * @throws 403 * @throws 404 */ - public function get($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0) + public function get($id, $includestockdata = 0) { - if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) { - throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode'); - } + return $this->_fetch($id, '', '', '', $includestockdata); + } - $id = (empty($id)?0:$id); + /** + * Get properties of a product object by ref + * + * Return an array with product information. + * + * @param string $ref Ref of element + * @param int $includestockdata Load also information about stock (slower) + * + * @return array|mixed Data without useless information + * + * @url GET byRef/{ref} + * + * @throws 401 + * @throws 403 + * @throws 404 + */ + public function getByRef($ref, $includestockdata = 0) + { + return $this->_fetch('', $ref, '', '', $includestockdata); + } - if(! DolibarrApiAccess::$user->rights->produit->lire) { - throw new RestException(403); - } + /** + * Get properties of a product object by ref_ext + * + * Return an array with product information. + * + * @param string $ref_ext Ref_ext of element + * @param int $includestockdata Load also information about stock (slower) + * + * @return array|mixed Data without useless information + * + * @url GET byRefExt/{ref_ext} + * + * @throws 401 + * @throws 403 + * @throws 404 + */ + public function getByRefExt($ref_ext, $includestockdata = 0) + { + return $this->_fetch('', '', $ref_ext, '', $includestockdata); + } - $result = $this->product->fetch($id, $ref, $ref_ext, $barcode); - if(! $result ) { - throw new RestException(404, 'Product not found'); - } - - if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - if ($includestockdata) { - $this->product->load_stock(); - } - - return $this->_cleanObjectDatas($this->product); + /** + * Get properties of a product object by barcode + * + * Return an array with product information. + * + * @param string $barcode Barcode of element + * @param int $includestockdata Load also information about stock (slower) + * + * @return array|mixed Data without useless information + * + * @url GET byBarcode/{barcode} + * + * @throws 401 + * @throws 403 + * @throws 404 + */ + public function getByBarcode($barcode, $includestockdata = 0) + { + return $this->_fetch('', '', '', $barcode, $includestockdata); } /** @@ -246,7 +283,7 @@ class Products extends DolibarrApi } $this->product->$field = $value; } - + $updatetype = false; if ($this->product->type != $oldproduct->type && ($this->product->isProduct() || $this->product->isService())) { $updatetype = true; @@ -696,4 +733,48 @@ class Products extends DolibarrApi } return $product; } + + /** + * Get properties of a product object + * + * Return an array with product information. + * + * @param int $id ID of product + * @param string $ref Ref of element + * @param string $ref_ext Ref ext of element + * @param string $barcode Barcode of element + * @param int $includestockdata Load also information about stock (slower) + * @return array|mixed Data without useless information + * + * @throws 401 + * @throws 403 + * @throws 404 + */ + private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0) + { + if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) { + throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode'); + } + + $id = (empty($id)?0:$id); + + if(! DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(403); + } + + $result = $this->product->fetch($id, $ref, $ref_ext, $barcode); + if(! $result ) { + throw new RestException(404, 'Product not found'); + } + + if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if ($includestockdata) { + $this->product->load_stock(); + } + + return $this->_cleanObjectDatas($this->product); + } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d7ab4e99c78..5492f760407 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1603,85 +1603,85 @@ class Product extends CommonObject $price_base_type = $this->price_base_type; // If price per segment - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) + if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($thirdparty_buyer->price_level)) { - $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; - $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; - $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; - $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; - if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } + $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; + $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; + $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; + $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; + if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility + { + if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) $tva_tx=$this->multiprices_tva_tx[$thirdparty_buyer->price_level]; + if (isset($this->multiprices_recuperableonly[$thirdparty_buyer->price_level])) $tva_npr=$this->multiprices_recuperableonly[$thirdparty_buyer->price_level]; + if (empty($tva_tx)) $tva_npr=0; + } + } // If price per customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - $prodcustprice = new Productcustomerprice($db); + $prodcustprice = new Productcustomerprice($db); - $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); + $filter = array('t.fk_product' => $this->id,'t.fk_soc' => $thirdparty_buyer->id); - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = $prodcustprice->lines[0]->tva_tx; - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; - $tva_npr = $prodcustprice->lines[0]->recuperableonly; - if (empty($tva_tx)) $tva_npr=0; - } - } + $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); + if ($result) { + if (count($prodcustprice->lines) > 0) { + $pu_ht = price($prodcustprice->lines[0]->price); + $pu_ttc = price($prodcustprice->lines[0]->price_ttc); + $price_base_type = $prodcustprice->lines[0]->price_base_type; + $tva_tx = $prodcustprice->lines[0]->tva_tx; + if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; + $tva_npr = $prodcustprice->lines[0]->recuperableonly; + if (empty($tva_tx)) $tva_npr=0; } + } + } // If price per quantity - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { - if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[0]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[0] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } // If price per quantity and customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) + elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { - if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + if ($this->prices_by_qty[$thirdparty_buyer->price_level]) // yes, this product has some prices per quantity + { + // Search price into product_price_by_qty from $this->id + foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) + { + if ($priceforthequantityarray['rowid'] != $pqp) continue; + // We found the price + if ($priceforthequantityarray['price_base_type'] == 'HT') { - // Search price into product_price_by_qty from $this->id - foreach($this->prices_by_qty_list[$thirdparty_buyer->price_level] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - break; - } + $pu_ht = $priceforthequantityarray['unitprice']; } + else + { + $pu_ttc = $priceforthequantityarray['unitprice']; + } + break; } + } + } return array('pu_ht'=>$pu_ht, 'pu_ttc'=>$pu_ttc, 'price_min'=>$price_min, 'price_base_type'=>$price_base_type, 'tva_tx'=>$tva_tx, 'tva_npr'=>$tva_npr); } @@ -3725,21 +3725,80 @@ class Product extends CommonObject */ public function clone_price($fromId, $toId) { - // phpcs:enable + global $conf, $user; + + $now = dol_now(); + $this->db->begin(); - // les prix - $sql = "INSERT ".MAIN_DB_PREFIX."product_price ("; - $sql.= " fk_product, date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell)"; - $sql.= " SELECT ".$toId . ", date_price, price, tva_tx, localtax1_tx, localtax2_tx, fk_user_author, tosell"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_price "; - $sql.= " WHERE fk_product = ". $fromId; + // prices + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_price ("; + $sql .= " entity"; + $sql .= ", fk_product"; + $sql .= ", date_price"; + $sql .= ", price_level"; + $sql .= ", price"; + $sql .= ", price_ttc"; + $sql .= ", price_min"; + $sql .= ", price_min_ttc"; + $sql .= ", price_base_type"; + $sql .= ", default_vat_code"; + $sql .= ", tva_tx"; + $sql .= ", recuperableonly"; + $sql .= ", localtax1_tx"; + $sql .= ", localtax1_type"; + $sql .= ", localtax2_tx"; + $sql .= ", localtax2_type"; + $sql .= ", fk_user_author"; + $sql .= ", tosell"; + $sql .= ", price_by_qty"; + $sql .= ", fk_price_expression"; + $sql .= ", fk_multicurrency"; + $sql .= ", multicurrency_code"; + $sql .= ", multicurrency_tx"; + $sql .= ", multicurrency_price"; + $sql .= ", multicurrency_price_ttc"; + $sql .= ")"; + $sql .= " SELECT"; + $sql .= " entity"; + $sql .= ", " . $toId; + $sql .= ", '" . $this->db->idate($now) . "'"; + $sql .= ", price_level"; + $sql .= ", price"; + $sql .= ", price_ttc"; + $sql .= ", price_min"; + $sql .= ", price_min_ttc"; + $sql .= ", price_base_type"; + $sql .= ", default_vat_code"; + $sql .= ", tva_tx"; + $sql .= ", recuperableonly"; + $sql .= ", localtax1_tx"; + $sql .= ", localtax1_type"; + $sql .= ", localtax2_tx"; + $sql .= ", localtax2_type"; + $sql .= ", " . $user->id; + $sql .= ", tosell"; + $sql .= ", price_by_qty"; + $sql .= ", fk_price_expression"; + $sql .= ", fk_multicurrency"; + $sql .= ", multicurrency_code"; + $sql .= ", multicurrency_tx"; + $sql .= ", multicurrency_price"; + $sql .= ", multicurrency_price_ttc"; + $sql .= " FROM " . MAIN_DB_PREFIX . "product_price"; + $sql .= " WHERE fk_product = ". $fromId; + $sql .= " ORDER BY date_price DESC"; + if ($conf->global->PRODUIT_MULTIPRICES_LIMIT>0) { + $sql .= " LIMIT " . $conf->global->PRODUIT_MULTIPRICES_LIMIT; + } - dol_syslog(get_class($this).'::clone_price', LOG_DEBUG); - if (! $this->db->query($sql)) { + dol_syslog(__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { $this->db->rollback(); return -1; } + $this->db->commit(); return 1; } @@ -4293,14 +4352,14 @@ class Product extends CommonObject { switch ($type) { - case 0: + case 0: return $this->LibStatut($this->status, $mode, $type); - case 1: + case 1: return $this->LibStatut($this->status_buy, $mode, $type); - case 2: + case 2: return $this->LibStatut($this->status_batch, $mode, $type); - default: - //Simulate previous behavior but should return an error string + default: + //Simulate previous behavior but should return an error string return $this->LibStatut($this->status_buy, $mode, $type); } } diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index f94a383f666..ced76050e31 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -6,45 +6,45 @@ require_once DOL_DOCUMENT_ROOT.'/product/inventory/class/inventory.class.php'; $get = GETPOST('get', 'alpha'); $put = GETPOST('put', 'alpha'); - switch ($put) - { - case 'qty': - if (empty($user->rights->stock->creer)) { echo -1; exit; } +switch ($put) +{ + case 'qty': + if (empty($user->rights->stock->creer)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->qty_view+=GETPOST('qty'); - $res = $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->qty_view+=GETPOST('qty'); + $res = $det->update($user); - echo $det->qty_view; - } - else - { - echo -2; - } + echo $det->qty_view; + } + else + { + echo -2; + } - break; + break; - case 'pmp': - if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } + case 'pmp': + if (empty($user->rights->stock->creer) || empty($user->rights->stock->changePMP)) { echo -1; exit; } - $fk_det_inventory = GETPOST('fk_det_inventory'); + $fk_det_inventory = GETPOST('fk_det_inventory'); - $det = new InventoryLine($db); - if( $det->fetch($fk_det_inventory)) - { - $det->new_pmp=price2num(GETPOST('pmp')); - $det->update($user); + $det = new InventoryLine($db); + if( $det->fetch($fk_det_inventory)) + { + $det->new_pmp=price2num(GETPOST('pmp')); + $det->update($user); - echo $det->new_pmp; - } - else - { - echo -2; - } + echo $det->new_pmp; + } + else + { + echo -2; + } - break; - } + break; +} diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 139fd681ee0..e8e332d95b5 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -475,10 +475,10 @@ if (empty($reshook)) { $priceid = GETPOST('priceid', 'int'); if (!empty($rowid)) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; - $sql .= " WHERE fk_product_price = " . $priceid; + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; + $sql .= " WHERE fk_product_price = " . $priceid; - $result = $db->query($sql); + $result = $db->query($sql); } else { setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors'); } @@ -755,17 +755,17 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // TVA - print '' . $langs->trans("DefaultTaxRate") . ''; + // TVA + print '' . $langs->trans("DefaultTaxRate") . ''; - $positiverates=''; - if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); - if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); - if (empty($positiverates)) $positiverates='0'; - echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); - //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); - print ''; + $positiverates=''; + if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax1_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax1_tx[$soc->price_level]); + if (price2num($object->multiprices_localtax2_type[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_localtax2_tx[$soc->price_level]); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($object->default_vat_code?' ('.$object->default_vat_code.')':''), '%', $object->tva_npr); + //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); + print ''; } else { @@ -791,10 +791,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUI { if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { - // We show only vat for level 1 - print '' . $langs->trans("DefaultTaxRate") . ''; - print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; - print ''; + // We show only vat for level 1 + print '' . $langs->trans("DefaultTaxRate") . ''; + print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; + print ''; } else { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 94a379c4e90..94012c1b9cf 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -68,8 +68,8 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || ! empty($ref)) { $ret = $object->fetch($id, $ref); -// if ($ret > 0) -// $ret = $object->fetch_thirdparty(); + // if ($ret > 0) + // $ret = $object->fetch_thirdparty(); if ($ret <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2b92a759ffa..24d8e89e03b 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -947,8 +947,8 @@ class MouvementStock extends CommonObject $result=dol_include_once('/'.$origintype.'/class/'.$origintype.'.class.php'); if ($result) { - $classname = ucfirst($origintype); - $origin = new $classname($this->db); + $classname = ucfirst($origintype); + $origin = new $classname($this->db); } } break; diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 24d2af3a358..5324ef80243 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -195,7 +195,7 @@ if ($action == 'createmovements') if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) // If product does not need lot/serial { // Remove stock - $result1=$product->correct_stock( + $result1=$product->correct_stock( $user, $id_sw, $qty, @@ -211,7 +211,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock( + $result2=$product->correct_stock( $user, $id_tw, $qty, @@ -243,7 +243,7 @@ if ($action == 'createmovements') } // Remove stock - $result1=$product->correct_stock_batch( + $result1=$product->correct_stock_batch( $user, $id_sw, $qty, @@ -262,7 +262,7 @@ if ($action == 'createmovements') } // Add stock - $result2=$product->correct_stock_batch( + $result2=$product->correct_stock_batch( $user, $id_tw, $qty, diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ac00062cc6e..ef307842017 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -202,7 +202,7 @@ if ($action == "correct_stock") $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - $result=$product->correct_stock_batch( + $result=$product->correct_stock_batch( $user, $id, GETPOST("nbpiece", 'int'), @@ -217,7 +217,7 @@ if ($action == "correct_stock") } else { - $result=$product->correct_stock( + $result=$product->correct_stock( $user, $id, GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index dbcd0a2cf61..060bcc57960 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -374,7 +374,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Remove stock - $result1=$object->correct_stock_batch( + $result1=$object->correct_stock_batch( $user, $srcwarehouseid, GETPOST("nbpiece", 'int'), @@ -389,7 +389,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Add stock - $result2=$object->correct_stock_batch( + $result2=$object->correct_stock_batch( $user, GETPOST("id_entrepot_destination", 'int'), GETPOST("nbpiece", 'int'), diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 76a4b0a46f7..00299c94459 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -180,7 +180,7 @@ if (empty($reshook)) { // Creation KO if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); + else setEventMessages($object->error, null, 'errors'); $action='create'; } } @@ -369,7 +369,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { -/*TODO if ($user->rights->stock->lire) + /*TODO if ($user->rights->stock->lire) { print '
'.$langs->trans("Modify").'
'."\n"; } @@ -378,7 +378,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print '
'.$langs->trans('Delete').'
'."\n"; } -*/ + */ } print ''."\n"; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index eedde6dcb31..9596c87c9d3 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -107,10 +107,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } // Load object if id or ref is provided as parameter diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6e7cdbc585b..b992be282d4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -492,7 +492,7 @@ if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alph $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', @@ -511,7 +511,7 @@ print_barre_liste( $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; -print_barre_liste( + print_barre_liste( $texte, $page, 'replenish.php', diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index a17ce086e6c..63b80636d67 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -66,28 +66,28 @@ if (empty($conf) || ! is_object($conf)) { // Warehouse or product print ''; - if ($object->element == 'product') - { - print ''.$langs->trans("Warehouse").''; - print ''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); - print '   '; - print ''; - } - if ($object->element == 'stock') - { - print ''.$langs->trans("Product").''; - print ''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print '   '; - print ''; - } +if ($object->element == 'product') +{ + print ''.$langs->trans("Warehouse").''; + print ''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print '   '; + print ''; +} +if ($object->element == 'stock') +{ + print ''.$langs->trans("Product").''; + print ''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print '   '; + print ''; +} print ''.$langs->trans("NumberOfUnit").''; print ''; print ''; @@ -96,37 +96,37 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''.$langs->trans("UnitPurchaseValue").''; print ''; - if (! empty($conf->projet->enabled)) - { - print ''.$langs->trans('Project').''; - print ''; - $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; - } +if (! empty($conf->projet->enabled)) +{ + print ''.$langs->trans('Project').''; + print ''; + $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; - print ''; - print ''; - print ''; - print ''.$langs->trans("EatByDate").''; - $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); - print ''; - print ''.$langs->trans("SellByDate").''; - $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); - print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); - print ''; - print ''; - } +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans("EatByDate").''; + $eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + print $form->selectDate($eatbyselected, 'eatby', '', '', 1, ""); + print ''; + print ''.$langs->trans("SellByDate").''; + $sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + print $form->selectDate($sellbyselected, 'sellby', '', '', 1, ""); + print ''; + print ''; +} // Label of mouvement of id of inventory $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock", ''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 2f02df78eec..dc814e54790 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -40,18 +40,18 @@ if (empty($conf) || ! is_object($conf)) { $pdluo = new Productbatch($db); - if ($pdluoid > 0) - { - $result=$pdluo->fetch($pdluoid); - if ($result > 0) - { - $pdluoid=$pdluo->id; - } - else - { - dol_print_error($db, $pdluo->error, $pdluo->errors); - } - } +if ($pdluoid > 0) +{ + $result=$pdluo->fetch($pdluoid); + if ($result > 0) + { + $pdluoid=$pdluo->id; + } + else + { + dol_print_error($db, $pdluo->error, $pdluo->errors); + } +} print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic'); @@ -62,28 +62,28 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''; print ''; - if ($pdluoid) - { - print ''; - } +if ($pdluoid) +{ + print ''; +} print ''; // Source warehouse or product print ''; - if ($object->element == 'product') - { - print ''; - print ''; - } - if ($object->element == 'stock') - { - print ''; - print ''; - } +if ($object->element == 'product') +{ + print ''; + print ''; +} +if ($object->element == 'stock') +{ + print ''; + print ''; +} print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && +if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) - { - print ''; - print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; - print ''; +{ + print ''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; + print ''; - print ''; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; +} // Label $valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref)); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index f5db207a42e..e51b2e4b404 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -813,23 +813,23 @@ if (count($tasksarray) > 0) print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; - for ($idw = 0; $idw < 7; $idw++) + for ($idw = 0; $idw < 7; $idw++) { - $cssweekend=''; - if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. - { - $cssweekend='weekend'; - } + $cssweekend=''; + if (($idw + 1) < $numstartworkingday || ($idw + 1) > $numendworkingday) // This is a day is not inside the setup of working days, so we use a week-end css. + { + $cssweekend='weekend'; + } - $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - $cssonholiday=''; - if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; - elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; - elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; + $cssonholiday=''; + if (! $isavailable[$tmpday]['morning'] && ! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayallday '; + elseif (! $isavailable[$tmpday]['morning']) $cssonholiday.='onholidaymorning '; + elseif (! $isavailable[$tmpday]['afternoon']) $cssonholiday.='onholidayafternoon '; - print ''; - } + print ''; + } print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index da2d41512e1..a873b53dbc0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -401,7 +401,7 @@ class Project extends CommonObject $result = 1; } else - { + { $this->db->rollback(); $result = -1; } @@ -1222,7 +1222,7 @@ class Project extends CommonObject // No filter. Use this if user has permission to see all project } - $sql.= $filter; + $sql.= $filter; //print $sql; $resql = $this->db->query($sql); @@ -1722,23 +1722,23 @@ class Project extends CommonObject $num = $this->db->num_rows($resql); $i = 0; // Loop on each record found, so each couple (project id, task id) - while ($i < $num) + while ($i < $num) { - $obj=$this->db->fetch_object($resql); - $day=$this->db->jdate($obj->task_date); // task_date is date without hours - if (empty($daylareadyfound[$day])) - { - $this->weekWorkLoad[$day] = $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; - } - else - { - $this->weekWorkLoad[$day] += $obj->task_duration; - $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; - } - $daylareadyfound[$day]=1; - $i++; - } + $obj=$this->db->fetch_object($resql); + $day=$this->db->jdate($obj->task_date); // task_date is date without hours + if (empty($daylareadyfound[$day])) + { + $this->weekWorkLoad[$day] = $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; + } + else + { + $this->weekWorkLoad[$day] += $obj->task_duration; + $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; + } + $daylareadyfound[$day]=1; + $i++; + } $this->db->free($resql); return 1; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e35b4b4bdad..1bd044bc985 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -852,15 +852,15 @@ class Task extends CommonObject $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; $sql.=" s.rowid, s.nom, s.email,"; - $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; - if (!empty($extrafields->attributes['projet']['label'])) - { - foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); - } - if (!empty($extrafields->attributes['projet_task']['label'])) - { - foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); - } + $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; + if (!empty($extrafields->attributes['projet']['label'])) + { + foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); + } + if (!empty($extrafields->attributes['projet_task']['label'])) + { + foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); + } } $sql.= " ORDER BY p.ref, t.rang, t.dateo"; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3a2886229a0..44b803571ba 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -863,8 +863,8 @@ foreach ($listofreferent as $key => $value) if (canApplySubtotalOn($tablename)) { - // Sort - $elementarray = sortElementsByClientName($elementarray); + // Sort + $elementarray = sortElementsByClientName($elementarray); } $num=count($elementarray); @@ -1077,9 +1077,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ht_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; @@ -1124,9 +1124,9 @@ foreach ($listofreferent as $key => $value) if ($othermessage) print $othermessage; if (isset($total_ttc_by_line)) { - if (! $qualifiedfortotal) print ''; - print price($total_ttc_by_line); - if (! $qualifiedfortotal) print ''; + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; } if ($warning) print ' '.img_warning($warning); print ''; diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 5c5cd398354..7d75544ef93 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -35,11 +35,11 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $valsamount[$obj->opp_status]=$obj->opp_amount; $totalnb+=$obj->nb; if ($obj->opp_status) $totaloppnb+=$obj->nb; - if (! in_array($obj->code, array('WON', 'LOST'))) + if (! in_array($obj->code, array('WON', 'LOST'))) { - $totalamount+=$obj->opp_amount; - $ponderated_opp_amount+=$obj->ponderated_opp_amount; - } + $totalamount+=$obj->opp_amount; + $ponderated_opp_amount+=$obj->ponderated_opp_amount; + } } $total+=$row[0]; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9a5514ff1cc..8524e940f36 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -143,10 +143,10 @@ $arrayfields=array( // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { - foreach($extrafields->attribute_label as $key => $val) - { + foreach($extrafields->attribute_label as $key => $val) + { if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); - } + } } diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 9353f968116..f8480f8f322 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -108,7 +108,7 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) unset($data1); if ($nocolor) -$px->SetDataColor(array ( + $px->SetDataColor(array ( array ( 220, 220, @@ -130,9 +130,9 @@ $px->SetDataColor(array ( )); $px->SetTitle($langs->trans('OpportunitiesStatusForProjects')); $result=$px->draw($filenamenb, $fileurlnb); - if ($result<0) { - setEventMessages($px->error, null, 'errors'); - } + if ($result<0) { + setEventMessages($px->error, null, 'errors'); + } } else { setEventMessages(null, $mesgs, 'errors'); } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 3d4077790c7..2abfea6e64e 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -645,7 +645,7 @@ elseif ($id > 0 || ! empty($ref)) print '
'; -// Link to create task + // Link to create task $linktocreatetaskParam = array(); $linktocreatetaskUserRight = false; if ($user->rights->projet->all->creer || $user->rights->projet->creer) { @@ -787,8 +787,8 @@ elseif ($id > 0 || ! empty($ref)) print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); if ($object->usage_bill_time) { - print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); } if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 2448088c6b1..b09d8345177 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -356,7 +356,7 @@ if ($id > 0 || ! empty($ref)) /* * Lines of contacts */ -/* + /* // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); foreach($dirtpls as $reldir) @@ -364,7 +364,7 @@ if ($id > 0 || ! empty($ref)) $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } -*/ + */ /* * Add a new contact line diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index d9730946377..78431f983a4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -616,7 +616,7 @@ if ($id > 0 || ! empty($ref)) { if (! $object->hasChildren() && ! $object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 8b95e85f899..15670a2095d 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Pierre Chéné + * Copyright (C) 2019 Cedric Ancelin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,38 +72,26 @@ class Thirdparties extends DolibarrApi * * @throws RestException */ - public function get($id) + public function get($id) { - if(! DolibarrApiAccess::$user->rights->societe->lire) { - throw new RestException(401); - } - if ($id ==0) { - $result = $this->company->initAsSpecimen(); - } else { - $result = $this->company->fetch($id); - } - if( ! $result ) { - throw new RestException(404, 'Thirdparty not found'); - } + return $this->_fetch($id); + } - if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; - } - - $absolute_discount = $this->company->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $this->company->getAvailableDiscounts('', $filtercreditnote); - $this->company->absolute_discount = price2num($absolute_discount, 'MT'); - $this->company->absolute_creditnote = price2num($absolute_creditnote, 'MT'); - - return $this->_cleanObjectDatas($this->company); + /** + * Get properties of a thirdparty object by email. + * + * Return an array with thirdparty informations + * + * @param string $email Sort field + * @return array|mixed data without useless information + * + * @url GET byEmail/{email} + * + * @throws RestException + */ + public function getByEmail($email) + { + return $this->_fetch('', '', '', '', '', '', '', '', '', '', $email); } /** @@ -1674,4 +1663,56 @@ class Thirdparties extends DolibarrApi } return $thirdparty; } + + /** + * Fetch properties of a thirdparty object. + * + * Return an array with thirdparty informations + * + * @param int $rowid Id of third party to load + * @param string $ref Reference of third party, name (Warning, this can return several records) + * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) + * @param string $ref_int Internal reference of third party (not used by dolibarr) + * @param string $idprof1 Prof id 1 of third party (Warning, this can return several records) + * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) + * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) + * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) + * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) + * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) + * @param string $email Email of third party (Warning, this can return several records) + * @param string $ref_alias Name_alias of third party (Warning, this can return several records) + * @return array|mixed data without useless information + * + * @throws RestException + */ + private function _fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '') + { + if(! DolibarrApiAccess::$user->rights->societe->lire) { + throw new RestException(401); + } + + $result = $this->company->fetch($rowid, $ref, $ref_ext, $ref_int, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } else { + $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; + } + + $absolute_discount = $this->company->getAvailableDiscounts('', $filterabsolutediscount); + $absolute_creditnote = $this->company->getAvailableDiscounts('', $filtercreditnote); + $this->company->absolute_discount = price2num($absolute_discount, 'MT'); + $this->company->absolute_creditnote = price2num($absolute_creditnote, 'MT'); + + return $this->_cleanObjectDatas($this->company); + } } diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 3574b4d29a2..69228b5efb5 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -45,18 +45,31 @@ $term = GETPOST('term', 'alpha'); if ($action=="getProducts") { $object = new Categorie($db); $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - echo json_encode($prods); + if ($result) + { + $prods = $object->getObjectsInCateg("product"); + echo json_encode($prods); + } + else + { + echo 'Failed to load category with id='.$category; + } } elseif ($action=="search" && $term != '') { - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; + $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product'; $sql.= ' WHERE entity IN ('.getEntity('product').')'; $sql.= ' AND tosell = 1'; $sql.= natural_search(array('ref','label','barcode'), $term); $resql = $db->query($sql); - $rows = array(); - while ($row = $db->fetch_array($resql)) { - $rows[] = $row; - } - echo json_encode($rows); + if ($resql) + { + $rows = array(); + while ($row = $db->fetch_object($resql)) { + $rows[] = $row; + } + echo json_encode($rows); + } + else { + echo 'Failed to search product : '.$db->lasterror(); + } } diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 91c29d73ac1..db3ddfdfa34 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -132,7 +132,7 @@ table.postablelines tr td { div.paymentbordline { width:50%; - background-color:#666; + background-color:#888; border-radius: 8px; margin-bottom: 4px; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a2c92aa13e4..6a67d9d03f9 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -141,7 +141,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $invoice = new Facture($db); $invoice->fetch($placeid); - if($invoice->total_ttc<0){ + if ($invoice->total_ttc < 0) { $invoice->type= $invoice::TYPE_CREDIT_NOTE; $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE "; $sql.="fk_soc = '".$invoice->socid."' "; @@ -189,8 +189,10 @@ if ($action == 'valid' && $user->rights->facture->creer) $res = $invoice->validate($user); } + $remaintopay = $invoice->getRemainToPay(); + // Add the payment - if ($res > 0) { + if ($res >= 0 && $remaintopay > 0) { $payment = new Paiement($db); $payment->datepaye = $now; $payment->fk_account = $bankaccount; @@ -205,9 +207,9 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->create($user); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); - $remaintopay = $invoice->getRemainToPay(); + $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded if ($remaintopay == 0) { - dol_syslog("Invoice is paid, so we set it to pay"); + dol_syslog("Invoice is paid, so we set it to status Paid"); $result = $invoice->set_paid($user); if ($result > 0) $invoice->paye = 1; } else { @@ -656,7 +658,7 @@ if ($placeid > 0) { //In Phone basic layout hide some content depends situation if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice" && $action!="order") return; - + if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -716,10 +718,12 @@ print '
'.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); - print ''.$langs->trans("Product").''; - print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); - print ''.$langs->trans("WarehouseSource").''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid", 'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot', 'int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); + print ''.$langs->trans("Product").''; + print $form->select_produits(GETPOST('product_id', 'int'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 0, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500'); + print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); @@ -92,35 +92,35 @@ if (empty($conf) || ! is_object($conf)) { print '
'; - if ($pdluoid > 0) - { - // If form was opened for a specific pdluoid, field is disabled - print ''; - print ''; - } - else - { - print ''; - } - print '
'; + if ($pdluoid > 0) + { + // If form was opened for a specific pdluoid, field is disabled + print ''; + print ''; + } + else + { + print ''; + } + print '
'.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled - print '
'.$langs->trans("EatByDate").''; + print $form->selectDate(($d_eatby?$d_eatby:$pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print ''.$langs->trans("SellByDate").''; + print $form->selectDate(($d_sellby?$d_sellby:$pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print '
 
 
 
'; if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { - $soc = new Societe($db); + $constforcompanyid='CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; + $soc = new Societe($db); if ($invoice->socid > 0) $soc->fetch($invoice->socid); - else $soc->fetch($conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}); - print '

'; + else $soc->fetch($conf->global->$constforcompanyid); + print ''; + print '

'; print $langs->trans("Customer").': '.$soc->name; $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; @@ -730,15 +734,13 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep $warehouse->fetch($conf->global->$constantforkey); print '
'.$langs->trans("Warehouse").': '.$warehouse->ref; } - print '

'; // Module Adherent if (! empty($conf->adherent->enabled)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $langs->load("members"); - print '

'; - print $langs->trans("Member").': '; + print '
'.$langs->trans("Member").': '; $adh=new Adherent($db); $result=$adh->fetch('', '', $invoice->socid); if ($result > 0) @@ -763,8 +765,8 @@ if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takep { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } - print '

'; } + print '

'; } if ($action == "search") diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 37258da056c..d3a0f466fc8 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -254,7 +254,7 @@ function LoadProducts(position, issubcat) { idata=0; //product data counter $.getJSON('/takepos/ajax/ajax.php?action=getProducts&category='+currentcat, function(data) { console.log("Call ajax.php (in LoadProducts) to get Products of category "+currentcat+" then loop on result to fill image thumbs"); - + console.log(data); while (ishow < maxproduct) { //console.log("ishow"+ishow+" idata="+idata); console.log(data[idata]); @@ -419,7 +419,7 @@ function New() { function Search2() { console.log("Search2 Call ajax search to replace products"); pageproducts=0; - jQuery(".catwatermark").hide(); + jQuery(".wrapper2 .catwatermark").hide(); $.getJSON('/takepos/ajax/ajax.php?action=search&term='+$('#search').val(), function(data) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined"){ diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index 48e2a8ddb65..416a17f0c0f 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -169,7 +169,7 @@ class BankAccountTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testBankAccountOther * * @param Object $localobject Object contract diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index eb830e1f827..135c77dfa2d 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -173,7 +173,7 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase * @depends testBonPrelevementOther * The depends says test is run only if previous is ok */ -/* public function testBonPrelevementDelete($id) + /* public function testBonPrelevementDelete($id) { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -189,5 +189,5 @@ class BonPrelevementTest extends PHPUnit\Framework\TestCase $this->assertLessThan($result, 0); return $result; } -*/ + */ } diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index b64d3242edb..7c302105aa2 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -166,7 +166,7 @@ class ContratTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testContratOther * * @param Object $localobject Object contract diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 66ef42a9e15..7f440bf067d 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -265,7 +265,7 @@ class ExportTest extends PHPUnit\Framework\TestCase public function testExportPersonalizedWithFilter() { global $conf,$user,$langs,$db; -/* + /* $sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f"; $objexport=new Export($db); @@ -303,7 +303,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, $array_filtervalue, $sql); $expectedresult=1; $this->assertEquals($expectedresult,$result); -*/ + */ return true; } diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index f346909e8b8..b277ba5c1b3 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -214,7 +214,7 @@ class FactureFournisseurTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureFournisseurOther * * @param Object $localobject Supplier invoice diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 34dd42b63f6..4e361895fcc 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -241,7 +241,7 @@ class FactureTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFactureOther * * @param Object $localobject Invoice diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php index 60be4024e69..ba9408441a1 100644 --- a/test/phpunit/FichinterTest.php +++ b/test/phpunit/FichinterTest.php @@ -190,7 +190,7 @@ class FichinterTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testFichinterValid * * @param Object $localobject Object intervention diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index d73d99f7078..776e783a6b0 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -150,11 +150,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testDolCountNbOfLine() { global $conf,$user,$langs,$db; @@ -171,11 +171,11 @@ class FilesLibTest extends PHPUnit\Framework\TestCase return $result; } - /** - * testDolIsFileDir - * - * @return int - */ + /** + * testDolIsFileDir + * + * @return int + */ public function testDolIsFileDir() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index a7fcaba25ce..71474ba1847 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -118,11 +118,11 @@ class ImagesLibTest extends PHPUnit\Framework\TestCase print __METHOD__."\n"; } - /** - * testDolCountNbOfLine - * - * @return int - */ + /** + * testDolCountNbOfLine + * + * @return int + */ public function testgetImageSize() { $file=dirname(__FILE__).'/img250x50.jpg'; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 955024baa91..709c5bbcfb7 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -239,7 +239,7 @@ class PropalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testPropalOther * * @param Propal $localobject Proposal diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index b9658818d48..ea3970e5a4b 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -149,30 +149,30 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase */ public function testRestGetUser() { - global $conf,$user,$langs,$db; + global $conf,$user,$langs,$db; - $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; - //$addheaders=array('Content-Type: application/json'); + $url = $this->api_url.'/users/123456789?api_key='.$this->api_key; + //$addheaders=array('Content-Type: application/json'); - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(404, $object['error']['code']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for unexisting user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(404, $object['error']['code']); - $url = $this->api_url.'/users/1?api_key='.$this->api_key; + $url = $this->api_url.'/users/1?api_key='.$this->api_key; - print __METHOD__." Request GET url=".$url."\n"; - $result=getURLContent($url, 'GET', '', 1, array()); - //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(1, $object['statut']); + print __METHOD__." Request GET url=".$url."\n"; + $result=getURLContent($url, 'GET', '', 1, array()); + //print __METHOD__." Result for existing user user: ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(1, $object['statut']); } /** @@ -183,52 +183,52 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase public function testRestCreateUser() { - // attemp to create without mandatory fields : - $url = $this->api_url.'/users?api_key='.$this->api_key; - $addheaders=array('Content-Type: application/json'); + // attemp to create without mandatory fields : + $url = $this->api_url.'/users?api_key='.$this->api_key; + $addheaders=array('Content-Type: application/json'); - $bodyobj = array( - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); + $bodyobj = array( + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating incomplete user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); - // create regular user - unset($result); - $bodyobj = array( - "login"=>"testRestLogin".mt_rand(), - "lastname"=>"testRestUser", - "password"=>"testRestPassword", - "email"=>"test@restuser.com" - ); - $body = json_encode($bodyobj); - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $resid=json_decode($result['content'], true); - $this->assertNotNull($resid, "Parsing of json result must no be null"); - $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); + // create regular user + unset($result); + $bodyobj = array( + "login"=>"testRestLogin".mt_rand(), + "lastname"=>"testRestUser", + "password"=>"testRestPassword", + "email"=>"test@restuser.com" + ); + $body = json_encode($bodyobj); + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + print __METHOD__." Result code for creating user ".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $resid=json_decode($result['content'], true); + $this->assertNotNull($resid, "Parsing of json result must no be null"); + $this->assertGreaterThan(0, $resid, $object['error']['code'].' '.$object['error']['message']); - // attempt to create duplicated user - print __METHOD__." Request POST url=".$url."\n"; - $result=getURLContent($url, 'POST', $body, 1, $addheaders); - //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; - print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; - $this->assertEquals($result['curl_error_no'], ''); - $object=json_decode($result['content'], true); - $this->assertNotNull($object, "Parsing of json result must no be null"); - $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); + // attempt to create duplicated user + print __METHOD__." Request POST url=".$url."\n"; + $result=getURLContent($url, 'POST', $body, 1, $addheaders); + //print __METHOD__." Result for creating duplicate user".var_export($result, true)."\n"; + print __METHOD__." curl_error_no: ".$result['curl_error_no']."\n"; + $this->assertEquals($result['curl_error_no'], ''); + $object=json_decode($result['content'], true); + $this->assertNotNull($object, "Parsing of json result must no be null"); + $this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']); } } diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index aa91e8d533b..42d7e5842a6 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -231,7 +231,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase return $localobject; } - /** + /** * testSupplierProposalOther * * @param SupplierProposal $localobject Proposal diff --git a/test/phpunit/functional/TakePosFunctionalTest.php b/test/phpunit/functional/TakePosFunctionalTest.php index e33a050cecf..597a893c67b 100644 --- a/test/phpunit/functional/TakePosFunctionalTest.php +++ b/test/phpunit/functional/TakePosFunctionalTest.php @@ -67,14 +67,14 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase ), // Geckodriver does not keep the session at the moment?! // XPath selectors also don't seem to work -// array( -// 'browser' => 'Mozilla Firefox on Linux', -// 'browserName' => 'firefox', -// 'sessionStrategy' => 'shared', -// 'desiredCapabilities' => array( -// 'marionette' => true -// ) -// ) + //array( + // 'browser' => 'Mozilla Firefox on Linux', + // 'browserName' => 'firefox', + // 'sessionStrategy' => 'shared', + // 'desiredCapabilities' => array( + // 'marionette' => true + // ) + //) ); /**