diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 035387834bd..84deea18f00 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,7 +3,7 @@ *Please:* - *only keep the "Fix", "Close" or "New" section* - *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)* -- *replace the bracket enclosed textswith meaningful informations* +- *replace the bracket enclosed texts with meaningful information* # Fix #[*issue_number Short description*] diff --git a/ChangeLog b/ChangeLog index 66bccd31c06..b7a52d28069 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. +* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. + + ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** diff --git a/README.md b/README.md index 7878f6270a7..834cc09236e 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING -Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! +Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index c8aa1407ddb..d46580b98b2 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1307,7 +1307,9 @@ class AccountancyExport /** * Export format : LD Compta version 10 & higher - * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf + * Last review for this format : 08-15-2021 Alexandre Spangaro (aspangaro@open-dsi.fr) + * + * Help : http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf * * @param array $objectLines data * @@ -1470,14 +1472,14 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if (($line->debit - $line->credit) > 0) { + if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if (($line->debit - $line->credit) < 0) { - $nature_piece = 'AC'; + if (($line->amount) < 0) { + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. } else { $nature_piece = 'FC'; } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index aeaa42154d8..0c9b4113c2a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -729,7 +729,10 @@ class BookKeeping extends CommonObject $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; $sql .= " t.date_creation,"; - $sql .= " t.date_export,"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode != "_tmp") { + $sql .= " t.date_export,"; + } $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; @@ -1024,6 +1027,12 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); + } elseif ($key == 't.code_journal' && !empty($value)) { + if (is_array($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + } else { + $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); + } } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } @@ -1622,7 +1631,11 @@ class BookKeeping extends CommonObject global $conf; $sql = "SELECT piece_num, doc_date,code_journal, journal_label, doc_ref, doc_type,"; - $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; + $sql .= " date_creation, tms as date_modification, date_validated as date_validation"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode != "_tmp") { + $sql .= ", date_export"; + } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1699,7 +1712,11 @@ class BookKeeping extends CommonObject $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num,"; - $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; + $sql .= " date_creation, tms as date_modification, date_validated as date_validation"; + // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist + if ($mode != "_tmp") { + $sql .= ", date_export"; + } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index c0c6b45464f..4c1df0fa938 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -47,7 +47,7 @@ $error = 0; */ // Action to update or add a constant -if ($action == 'settemplates') { +if ($action == 'settemplates' && $user->admin) { $db->begin(); if (!$error && is_array($_POST)) { @@ -192,7 +192,8 @@ print "\n"; print ''; print $langs->trans("NotificationEMailFrom").''; print ''; -print ''; +print img_picto('', 'email', 'class="pictofixedwidth"'); +print ''; if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) { print ' '.img_warning($langs->trans("ErrorBadEMail")); } @@ -270,7 +271,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { } $helptext = ''; - form_constantes($constantes, 3, $helptext); + form_constantes($constantes, 3, $helptext, 'EmailTemplate'); + + print '
'; + print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; + if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + } + print '
'; print '
'; } else { @@ -316,15 +324,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''; print ''; -} - -print '
'; -print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; -if (!empty($conf->societe->enabled)) { - print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + print '
'; + print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; + if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + } + print '
'; } -print '
'; print ''; @@ -335,6 +342,7 @@ print '

'; print '
'; print ''; print ''; +print ''; print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', ''); @@ -376,6 +384,12 @@ foreach ($listofnotifiedevents as $notifiedevent) { $elementLabel = $langs->trans('ExpenseReport'); } + $labelfortrigger = 'AmountHT'; + $codehasnotrigger = 0; + if (preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + $codehasnotrigger++; + } + print ''; print ''; print img_picto('', $elementPicto, 'class="pictofixedwidth"'); @@ -384,6 +398,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { print ''.$notifiedevent['code'].''; print ''.$label.''; print ''; + $inputfieldalreadyshown = 0; // Notification with threshold foreach ($conf->global as $key => $val) { if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) { @@ -407,24 +422,35 @@ foreach ($listofnotifiedevents as $notifiedevent) { } print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); print '
'; + + $inputfieldalreadyshown++; } // New entry input fields - $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. - print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); + if (empty($inputfieldalreadyshown) || !$codehasnotrigger) { + $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); + } print ''; print ''; // Notification with threshold + $inputfieldalreadyshown = 0; foreach ($conf->global as $key => $val) { if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) { continue; } - print $langs->trans("AmountHT").' >= '; - print '
'; + if (!$codehasnotrigger) { + print $langs->trans($labelfortrigger).' >= '; + print '
'; + + $inputfieldalreadyshown++; + } } // New entry input fields - print $langs->trans("AmountHT").' >= '; + if (!$codehasnotrigger) { + print $langs->trans($labelfortrigger).' >= '; + } print ''; print ''; @@ -437,7 +463,7 @@ print ''; print '
'; -print '
'; +print '
'; print '
'; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 037ac6866ee..51c76da350b 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -68,6 +68,8 @@ if ($action == 'update') { if (GETPOSTISSET('MAIN_PDF_NO_SENDER_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_SENDER_FRAME", GETPOST("MAIN_PDF_NO_SENDER_FRAME"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PDF_NO_RECIPENT_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); @@ -92,6 +94,8 @@ if ($action == 'update') { if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity); @@ -275,6 +279,36 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME); } +// Show sender name + +print ''.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME'); +} else { + print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', (!empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) ? $conf->global->MAIN_PDF_HIDE_SENDER_NAME : 0, 1); +} +print ''; + +//Invert sender and recipient + +print ''.$langs->trans("SwapSenderAndRecipientOnPDF").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT'); +} else { + print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1); +} +print ''; + +// Place customer adress to the ISO location + +print ''.$langs->trans("PlaceCustomerAddressToIsoLocation").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION'); +} else { + print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1); +} +print ''; + print ''; print ''; @@ -345,6 +379,18 @@ print '
'; print ''; print ''; +// Use 2 languages into PDF + +print ''; + // Height of logo print ''; } -//Invert sender and recipient +// -print ''; -// Place customer adress to the ISO location - -print ''; - -// Use 2 languages into PDF - -print ''; - // Ref print ''; // Owner diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php deleted file mode 100644 index eee5cac755f..00000000000 --- a/htdocs/cashdesk/admin/cashdesk.php +++ /dev/null @@ -1,191 +0,0 @@ - - * Copyright (C) 2011-2017 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/admin/cashdesk.php - * \ingroup cashdesk - * \brief Setup page for cashdesk module - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - -// If socid provided by ajax company selector -if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) { - $_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); - $_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); - $_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha'); -} - -// Security check -if (!$user->admin) { - accessforbidden(); -} - -// Load translation files required by the page -$langs->loadLangs(array("admin", "cashdesk")); - - -/* - * Actions - */ - -if (GETPOST('action', 'alpha') == 'set') { - $db->begin(); - - if (GETPOST('socid', 'int') < 0) { - $_POST["socid"] = ''; - } - - $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE", (GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", GETPOST('CASHDESK_NO_DECREASE_STOCK', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "CASHDESK_DOLIBAR_RECEIPT_PRINTER", GETPOST('CASHDESK_DOLIBAR_RECEIPT_PRINTER', 'alpha'), 'chaine', 0, '', $conf->entity); - - dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - -/* - * View - */ - -$form = new Form($db); -$formproduct = new FormProduct($db); - -llxHeader('', $langs->trans("CashDeskSetup")); - -$linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("CashDeskSetup").' (SimplePOS)', $linkback, 'title_setup'); -print '
'; - - -// Mode -print '
'; -print ''; -print ''; - -if (!empty($conf->service->enabled)) { - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").''; +//if (! empty($conf->global->MAIN_MULTILANGS)) + //{ +$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0); +print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); +//} else { +// print ''.$langs->trans("MultiLangNotEnabled").''; +//} +print '
'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").''; print ''; @@ -361,38 +407,18 @@ if (!empty($conf->projet->enabled)) { print '
'.$langs->trans("SwapSenderAndRecipientOnPDF").''; +print '
'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_CODE"); +print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT'); + print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_CODE'); } else { - print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1); + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_CODE", $arrval, $conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE); } print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION'); -} else { - print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1); -} -print '
'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").''; -//if (! empty($conf->global->MAIN_MULTILANGS)) -//{ -$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0); -print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); -//} else { -// print ''.$langs->trans("MultiLangNotEnabled").''; -//} -print '
'.$langs->trans("HideRefOnPDF").''; diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index af3e5bf7c41..7dec909ecb6 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -54,15 +54,15 @@ if ($cancel) { if ($action == 'update') { if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) { - dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity); - } + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity); + } if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) { - dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity); - } + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity); + } if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) { - dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity); - } - + dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity); + } + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 09156e08588..1b6fa5bebe7 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -91,15 +91,21 @@ $workflowcodes = array( ), // Automatic classification of order - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'family'=>'classify_order', 'position'=>40, 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'family'=>'classify_order', 'position'=>41, + 'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)), + 'picto'=>'order' + ), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( + 'family'=>'classify_order', + 'position'=>42, 'enabled'=>(!empty($conf->facture->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order', 'warning'=>'' diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index f90385b4209..423c40d9e20 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -79,7 +79,10 @@ $form = new Form($db); $block_static = new BlockedLog($db); $block_static->loadTrackedEvents(); -llxHeader('', $langs->trans("BlockedLogSetup")); +$title = $langs->trans("BlockedLogSetup"); +$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; + +llxHeader('', $title, $help_url); $linkback = ''; if ($withtab) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 265c12dd49c..385101c7468 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -275,8 +275,9 @@ if (GETPOST('withtab', 'alpha')) { } else { $title = $langs->trans("BrowseBlockedLog"); } +$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; -llxHeader('', $langs->trans("BrowseBlockedLog")); +llxHeader('', $title, $help_url); $MAXLINES = 10000; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 2cd7492395d..df21938aec5 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -325,7 +325,7 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 1094eabf0c6..f7795a14f47 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -40,7 +40,7 @@ $action = GETPOST("action", "alpha"); $title = (string) GETPOST("title", "alpha"); $url = (string) GETPOST("url", "alpha"); $urlsource = GETPOST("urlsource", "alpha"); -$target = GETPOST("target", "alpha"); +$target = GETPOST("target", "int"); $userid = GETPOST("userid", "int"); $position = GETPOST("position", "int"); $backtopage = GETPOST('backtopage', 'alpha'); @@ -169,7 +169,7 @@ if ($action == 'create') { // Target print '
'.$langs->trans("BehaviourOnClick").''; $liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow")); - print $form->selectarray('target', $liste, 1); + print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'; - print ''; - print ''; - print "\n"; - - print '\n"; - - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; - print $langs->trans("CashdeskShowServices"); - print ''; - print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1); - print "
'; - - print '
'; -} - - -print ''; -print ''; -print ''; -print "\n"; - -print ''; -print ''; -if (!empty($conf->banque->enabled)) { - print ''; - print ''; - - - print ''; - print ''; - - - print ''; - print ''; -} - -if (!empty($conf->stock->enabled)) { - print ''; // Force warehouse (this is not a default value) - print ''; - - $disabled = $conf->global->CASHDESK_NO_DECREASE_STOCK; - - - print ''; // Force warehouse (this is not a default value) - print ''; -} - -// Use Dolibarr Receipt Printer -if (!empty($conf->receiptprinter->enabled)) { - print '\n"; -} - -print '
'.$langs->trans("Terminal").' 0'.$langs->trans("Value").'
'.$langs->trans("CashDeskThirdPartyForSell").''; -print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client in (1,3) AND s.status = 1)', 1, 0, 0, array(), 0); -print '
'.$langs->trans("CashDeskBankAccountForSell").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1); - print '
'.$langs->trans("CashDeskBankAccountForCheque").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE, 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", 1); - print '
'.$langs->trans("CashDeskBankAccountForCB").''; - $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1); - print '
'.$langs->trans("CashDeskDoNotDecreaseStock").''; - if (empty($conf->productbatch->enabled)) { - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1); - } else { - if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { - $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity); - } - print $langs->trans("Yes").'
'; - print ''.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').''; - } - print '
'.$langs->trans("CashDeskIdWareHouse").''; - if (!$disabled) { - print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled); - print ' ('.$langs->trans("Create").')'; - } else { - print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; - } - print '
'; - print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')'; - print ''; - print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER", $conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER, 1); - print "
'; -print '
'; - -print '
'; - -print "\n"; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/cashdesk/affContenu.php b/htdocs/cashdesk/affContenu.php deleted file mode 100644 index d8e31f3b9c9..00000000000 --- a/htdocs/cashdesk/affContenu.php +++ /dev/null @@ -1,100 +0,0 @@ - - * Copyright (C) 2008-2009 Laurent Destailleur - * Copyright (C) 2009 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/affContenu.php - * \ingroup cashdesk - * \brief Include to show main page for cashdesk module - */ - -require_once 'class/Facturation.class.php'; - -// Si nouvelle vente, reinitialisation des donnees (destruction de l'objet et vidage de la table contenant la liste des articles) -if (GETPOST('id', 'int') == 'NOUV') { - unset($_SESSION['serObjFacturation']); - unset($_SESSION['poscart']); -} - -// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ... -if (isset($_SESSION['serObjFacturation'])) { - $obj_facturation = unserialize($_SESSION['serObjFacturation']); - unset($_SESSION['serObjFacturation']); -} else { - // ... sinon, c'est une nouvelle vente - $obj_facturation = new Facturation(); -} - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -// $obj_facturation contains data for all invoice total + selection of current product - -$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart'] - -$total_ttc = $obj_facturation->amountWithTax(); - -/*var_dump($obj_facturation); -var_dump($_SESSION['poscart']); -var_dump($total_ttc); -exit;*/ - - -// Left area with selected articles (area for article, amount and payments) -print '
'; -print '
'; - -$page = GETPOST('menutpl', 'alpha'); -if (empty($page)) { - $page = 'facturation'; -} - -if (in_array( - $page, - array( - 'deconnexion', - 'index', 'index_verif', 'facturation', 'facturation_verif', 'facturation_dhtml', - 'validation', 'validation_ok', 'validation_ticket', 'validation_verif', - ) -)) { - include $page.'.php'; -} else { - dol_print_error('', 'menu param '.$page.' is not inside allowed list'); -} - -print '
'; -print '
'; - - - -// Right area with selected articles (shopping cart) -print '
'; -print '
'; - -require 'tpl/liste_articles.tpl.php'; - -print '
'; -print '
'; - -$_SESSION['serObjFacturation'] = serialize($obj_facturation); diff --git a/htdocs/cashdesk/affIndex.php b/htdocs/cashdesk/affIndex.php deleted file mode 100644 index a352649feb4..00000000000 --- a/htdocs/cashdesk/affIndex.php +++ /dev/null @@ -1,78 +0,0 @@ - - * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/affIndex.php - * \ingroup cashdesk - * \brief First page of point of sale module - */ -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php'; - -$error = GETPOST('error'); - -// Test if already logged -if ($_SESSION['uid'] <= 0) { - header('Location: index.php'); - exit; -} - -// Load translation files required by the page -$langs->loadLangs(array("companies", "compta", "cashdesk")); - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -$form = new Form($db); - -$arrayofjs = array(); -$arrayofcss = array('/cashdesk/css/style.css'); - -top_htmlhead($head, $langs->trans("CashDesk"), 0, 0, $arrayofjs, $arrayofcss); - -print ''."\n"; - -if (!empty($error)) { - dol_htmloutput_events(); -} - -print '
'."\n"; -print '
'."\n"; -print '
'."\n"; - -print ''."\n"; - -print '
'."\n"; -include_once 'affContenu.php'; -print '
'."\n"; - -include_once 'affPied.php'; - -print '
'."\n"; -print ''."\n"; diff --git a/htdocs/cashdesk/affPied.php b/htdocs/cashdesk/affPied.php deleted file mode 100644 index 6481a0c2aff..00000000000 --- a/htdocs/cashdesk/affPied.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * 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/cashdesk/affPied.php - * \ingroup cashdesk - * \brief Bottom of main page of point of sale module - */ - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - -?> - -
-use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) { - print "\n\n"; - print '' . "\n"; -} - -printCommonFooter('private'); -?> -
diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php deleted file mode 100644 index 23fa4d6d0a1..00000000000 --- a/htdocs/cashdesk/class/Auth.class.php +++ /dev/null @@ -1,144 +0,0 @@ - - * Copyright (C) 2008-2011 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -/** - * Class ot manage authentication for pos module (cashdesk) - */ -class Auth -{ - protected $db; - - private $login; - private $passwd; - - private $reponse; - - public $sqlQuery; - - /** - * Enter description here ... - * - * @param DoliDB $db Database handler - * @return void - */ - public function __construct($db) - { - $this->db = $db; - $this->reponse(null); - } - - /** - * Enter description here ... - * - * @param string $aLogin Login - * @return void - */ - public function login($aLogin) - { - $this->login = $aLogin; - } - - /** - * Enter description here ... - * - * @param string $aPasswd Password - * @return void - */ - public function passwd($aPasswd) - { - $this->passwd = $aPasswd; - } - - /** - * Enter description here ... - * - * @param string $aReponse Response - * @return void - */ - public function reponse($aReponse) - { - $this->reponse = $aReponse; - } - - /** - * Validate login/pass - * - * @param string $aLogin Login - * @param string $aPasswd Password - * @return int 0 or 1 - */ - public function verif($aLogin, $aPasswd) - { - global $conf, $langs; - global $dolibarr_main_authentication, $dolibarr_auto_user; - - $ret = -1; - - $login = ''; - - $test = true; - - // Authentication mode - if (empty($dolibarr_main_authentication)) { - $dolibarr_main_authentication = 'http,dolibarr'; - } - // Authentication mode: forceuser - if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) { - $dolibarr_auto_user = 'auto'; - } - // Set authmode - $authmode = explode(',', $dolibarr_main_authentication); - - // No authentication mode - if (!count($authmode)) { - $langs->load('main'); - dol_print_error('', $langs->trans("ErrorConfigParameterNotDefined", 'dolibarr_main_authentication')); - exit; - } - - $usertotest = $aLogin; - $passwordtotest = $aPasswd; - $entitytotest = $conf->entity; - - // Validation tests user / password - // If ok, the variable will be initialized login - // If error, we will put error message in session under the name dol_loginmesg - $goontestloop = false; - if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) { - $goontestloop = true; - } - if (isset($aLogin) || GETPOST('openid_mode', 'alpha', 1)) { - $goontestloop = true; - } - - if ($test && $goontestloop) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode); - if ($login) { - $this->login($aLogin); - $this->passwd($aPasswd); - $ret = 0; - } else { - $ret = -1; - } - } - - return $ret; - } -} diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php deleted file mode 100644 index 339edce5f03..00000000000 --- a/htdocs/cashdesk/class/Facturation.class.php +++ /dev/null @@ -1,558 +0,0 @@ - - * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2010 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; - - -/** - * Class to manage invoices for pos module (cashdesk) - */ -class Facturation -{ - /** - * Attributs "volatiles" : reinitialises apres chaque traitement d'un article - *

Attributs "volatiles" : reinitialises apres chaque traitement d'un article

- * int $id => 'rowid' du produit dans llx_product - * string $ref => 'ref' du produit dans llx_product - * int $qte => Quantite pour le produit en cours de traitement - * int $stock => Stock theorique pour le produit en cours de traitement - * int $remise_percent => Remise en pourcent sur le produit en cours - * int $montant_remise => Remise en pourcent sur le produit en cours - * int $prix => Prix HT du produit en cours - * int $tva => 'rowid' du taux de tva dans llx_c_tva - */ - - /** - * @var int ID - */ - public $id; - - protected $ref; - protected $qte; - protected $stock; - protected $remise_percent; - protected $montant_remise; - protected $prix; - protected $tva; - - /** - * Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation) - * string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX) - * string $mode_reglement => Mode de reglement (ESP, CB ou CHQ) - * int $montant_encaisse => Montant encaisse en cas de reglement en especes - * int $montant_rendu => Monnaie rendue en cas de reglement en especes - * int $paiement_le => Date de paiement en cas de paiement differe - * - * int $prix_total_ht => Prix total hors taxes - * int $montant_tva => Montant total de la TVA, tous taux confondus - * int $prix_total_ttc => Prix total TTC - */ - protected $num_facture; - protected $mode_reglement; - protected $montant_encaisse; - protected $montant_rendu; - protected $paiement_le; - - protected $prix_total_ht; - protected $montant_tva; - protected $prix_total_ttc; - - - /** - * Constructor - */ - public function __construct() - { - $this->raz(); - $this->razPers(); - } - - - // Data processing methods - - - /** - * Add a product into cart - * - * @return void - */ - public function ajoutArticle() - { - global $conf, $db, $mysoc; - - $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; - - $societe = new Societe($db); - $societe->fetch($thirdpartyid); - - $product = new Product($db); - $product->fetch($this->id); - - - $vatrowid = $this->tva(); - - $tmp = getTaxesFromId($vatrowid); - $txtva = $tmp['rate'].(empty($tmp['code']) ? '' : ' ('.$tmp['code'].')'); - $vat_npr = $tmp['npr']; - - $localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1); - - // Clean vat code - $reg = array(); - $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } - - // Define part of HT, VAT, TTC - $resultarray = calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $vat_npr, $product->type, $mysoc, $localtaxarray); - - // Calculation of total HT without discount - $total_ht = $resultarray[0]; - $total_vat = $resultarray[1]; - $total_ttc = $resultarray[2]; - $total_localtax1 = $resultarray[9]; - $total_localtax2 = $resultarray[10]; - - // Calculation of the discount amount - if ($this->remisePercent()) { - $remise_percent = $this->remisePercent(); - } else { - $remise_percent = 0; - } - $montant_remise_ht = ($resultarray[6] - $resultarray[0]); - $this->amountDiscount($montant_remise_ht); - - $newcartarray = $_SESSION['poscart']; - - $i = 0; - if (!is_null($newcartarray) && !empty($newcartarray)) { - $i = count($newcartarray); - } - - $newcartarray[$i]['id'] = $i; - $newcartarray[$i]['ref'] = $product->ref; - $newcartarray[$i]['label'] = $product->label; - $newcartarray[$i]['price'] = $product->price; - $newcartarray[$i]['price_ttc'] = $product->price_ttc; - - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - if (isset($product->multiprices[$societe->price_level])) { - $newcartarray[$i]['price'] = $product->multiprices[$societe->price_level]; - $newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level]; - } - } - - $newcartarray[$i]['fk_article'] = $this->id; - $newcartarray[$i]['qte'] = $this->qte(); - $newcartarray[$i]['fk_tva'] = $this->tva(); // Vat rowid - $newcartarray[$i]['remise_percent'] = $remise_percent; - $newcartarray[$i]['remise'] = price2num($montant_remise_ht); - $newcartarray[$i]['total_ht'] = price2num($total_ht, 'MT'); - $newcartarray[$i]['total_ttc'] = price2num($total_ttc, 'MT'); - $newcartarray[$i]['total_vat'] = price2num($total_vat, 'MT'); - $newcartarray[$i]['total_localtax1'] = price2num($total_localtax1, 'MT'); - $newcartarray[$i]['total_localtax2'] = price2num($total_localtax2, 'MT'); - $_SESSION['poscart'] = $newcartarray; - - $this->raz(); - } - - /** - * Remove a product from panel - * - * @param int $aArticle Id of line into cart to remove - * @return void - */ - public function supprArticle($aArticle) - { - $poscart = $_SESSION['poscart']; - - $j = 0; - $newposcart = array(); - foreach ($poscart as $key => $val) { - if ($poscart[$key]['id'] != $aArticle) { - $newposcart[$j] = $poscart[$key]; - $newposcart[$j]['id'] = $j; - $j++; - } - } - unset($poscart); - //var_dump($poscart);exit; - $_SESSION['poscart'] = $newposcart; - } - - /** - * Calculation of total HT, total TTC and VAT amounts - * - * @return int Total - */ - public function calculTotaux() - { - global $db; - - $total_ht = 0; - $total_ttc = 0; - $total_vat = 0; - $total_localtax1 = 0; - $total_localtax2 = 0; - - $tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array()); - - $tab_size = count($tab); - for ($i = 0; $i < $tab_size; $i++) { - // Total HT - $remise = $tab[$i]['remise']; - $total_ht += ($tab[$i]['total_ht']); - $total_vat += ($tab[$i]['total_vat']); - $total_ttc += ($tab[$i]['total_ttc']); - $total_localtax1 += ($tab[$i]['total_localtax1']); - $total_localtax2 += ($tab[$i]['total_localtax2']); - } - - $this->prix_total_ttc = $total_ttc; - $this->prix_total_ht = $total_ht; - $this->prix_total_vat = $total_vat; - $this->prix_total_localtax1 = $total_localtax1; - $this->prix_total_localtax2 = $total_localtax2; - - $this->montant_tva = $total_ttc - $total_ht; - //print 'total: '.$this->prix_total_ttc; exit; - } - - /** - * Reset attributes - * - * @return void - */ - public function raz() - { - $this->id('RESET'); - $this->ref('RESET'); - $this->qte('RESET'); - $this->stock('RESET'); - $this->remisePercent('RESET'); - $this->amountDiscount('RESET'); - $this->prix('RESET'); - $this->tva('RESET'); - } - - /** - * Resetting persistent attributes - * - * @return void - */ - private function razPers() - { - $this->numInvoice('RESET'); - $this->getSetPaymentMode('RESET'); - $this->amountCollected('RESET'); - $this->amountReturned('RESET'); - $this->paiementLe('RESET'); - - $this->amountWithoutTax('RESET'); - $this->amountVat('RESET'); - $this->amountWithTax('RESET'); - } - - - // Methods for modifying protected attributes - - /** - * Getter for id - * - * @param int $aId Id - * @return int Id - */ - public function id($aId = null) - { - - if (!$aId) { - return $this->id; - } elseif ($aId == 'RESET') { - $this->id = null; - } else { - $this->id = $aId; - } - } - - /** - * Getter for ref - * - * @param string $aRef Ref - * @return string Ref - */ - public function ref($aRef = null) - { - - if (is_null($aRef)) { - return $this->ref; - } elseif ($aRef == 'RESET') { - $this->ref = null; - } else { - $this->ref = $aRef; - } - } - - /** - * Getter for qte - * - * @param int $aQte Qty - * @return int Qty - */ - public function qte($aQte = null) - { - if (is_null($aQte)) { - return $this->qte; - } elseif ($aQte == 'RESET') { - $this->qte = null; - } else { - $this->qte = $aQte; - } - } - - /** - * Getter for stock - * - * @param string $aStock Stock - * @return string Stock - */ - public function stock($aStock = null) - { - - if (is_null($aStock)) { - return $this->stock; - } elseif ($aStock == 'RESET') { - $this->stock = null; - } else { - $this->stock = $aStock; - } - } - - /** - * Getter for remise_percent - * - * @param string $aRemisePercent Discount - * @return string Discount - */ - public function remisePercent($aRemisePercent = null) - { - - if (is_null($aRemisePercent)) { - return $this->remise_percent; - } elseif ($aRemisePercent == 'RESET') { - $this->remise_percent = null; - } else { - $this->remise_percent = $aRemisePercent; - } - } - - /** - * Getter for montant_remise - * - * @param int $aMontantRemise Amount - * @return string Amount - */ - public function amountDiscount($aMontantRemise = null) - { - - if (is_null($aMontantRemise)) { - return $this->montant_remise; - } elseif ($aMontantRemise == 'RESET') { - $this->montant_remise = null; - } else { - $this->montant_remise = $aMontantRemise; - } - } - - /** - * Getter for prix - * - * @param int $aPrix Price - * @return string Stock - */ - public function prix($aPrix = null) - { - - if (is_null($aPrix)) { - return $this->prix; - } elseif ($aPrix == 'RESET') { - $this->prix = null; - } else { - $this->prix = $aPrix; - } - } - - /** - * Getter for tva - * - * @param int $aTva Vat - * @return int Vat - */ - public function tva($aTva = null) - { - if (is_null($aTva)) { - return $this->tva; - } elseif ($aTva == 'RESET') { - $this->tva = null; - } else { - $this->tva = $aTva; - } - } - - /** - * Get num invoice - * - * @param string $aNumFacture Invoice ref - * @return string Invoice ref - */ - public function numInvoice($aNumFacture = null) - { - if (is_null($aNumFacture)) { - return $this->num_facture; - } elseif ($aNumFacture == 'RESET') { - $this->num_facture = null; - } else { - $this->num_facture = $aNumFacture; - } - } - - /** - * Get payment mode - * - * @param int $aModeReglement Payment mode - * @return int Payment mode - */ - public function getSetPaymentMode($aModeReglement = null) - { - - if (is_null($aModeReglement)) { - return $this->mode_reglement; - } elseif ($aModeReglement == 'RESET') { - $this->mode_reglement = null; - } else { - $this->mode_reglement = $aModeReglement; - } - } - - /** - * Get amount - * - * @param int $aMontantEncaisse Amount - * @return int Amount - */ - public function amountCollected($aMontantEncaisse = null) - { - - if (is_null($aMontantEncaisse)) { - return $this->montant_encaisse; - } elseif ($aMontantEncaisse == 'RESET') { - $this->montant_encaisse = null; - } else { - $this->montant_encaisse = $aMontantEncaisse; - } - } - - /** - * Get amount - * - * @param int $aMontantRendu Amount - * @return int Amount - */ - public function amountReturned($aMontantRendu = null) - { - - if (is_null($aMontantRendu)) { - return $this->montant_rendu; - } elseif ($aMontantRendu == 'RESET') { - $this->montant_rendu = null; - } else { - $this->montant_rendu = $aMontantRendu; - } - } - - /** - * Get payment date - * - * @param integer $aPaiementLe Date - * @return integer Date - */ - public function paiementLe($aPaiementLe = null) - { - if (is_null($aPaiementLe)) { - return $this->paiement_le; - } elseif ($aPaiementLe == 'RESET') { - $this->paiement_le = null; - } else { - $this->paiement_le = $aPaiementLe; - } - } - - /** - * Get total HT - * - * @param int $aTotalHt Total amount - * @return int Total amount - */ - public function amountWithoutTax($aTotalHt = null) - { - if (is_null($aTotalHt)) { - return $this->prix_total_ht; - } elseif ($aTotalHt == 'RESET') { - $this->prix_total_ht = null; - } else { - $this->prix_total_ht = $aTotalHt; - } - } - - /** - * Get amount vat - * - * @param int $aMontantTva Amount vat - * @return int Amount vat - */ - public function amountVat($aMontantTva = null) - { - if (is_null($aMontantTva)) { - return $this->montant_tva; - } elseif ($aMontantTva == 'RESET') { - $this->montant_tva = null; - } else { - $this->montant_tva = $aMontantTva; - } - } - - /** - * Get total TTC - * - * @param int $aTotalTtc Amount ttc - * @return int Amount ttc - */ - public function amountWithTax($aTotalTtc = null) - { - if (is_null($aTotalTtc)) { - return $this->prix_total_ttc; - } elseif ($aTotalTtc == 'RESET') { - $this->prix_total_ttc = null; - } else { - $this->prix_total_ttc = $aTotalTtc; - } - } -} diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css deleted file mode 100644 index b17a63e548e..00000000000 --- a/htdocs/cashdesk/css/style.css +++ /dev/null @@ -1,455 +0,0 @@ -/* Copyright (C) 2007-2008 Jeremie Ollivier - * - * 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 . - */ - -body { - background: #fff; - color: #333; - margin: 0; - padding: 0; -} - -p { - margin: 0; -} - -.conteneur { - background: #fff; - text-align: left; - /*max-width: 770px;*/ - /*margin: 10px auto; - border: 2px solid #000;*/ -} - -.conteneur_img_gauche { - /* background: url("../img/bg_conteneur_gauche.png") top left repeat-y; */ -} - -.conteneur_img_droite { - /* background: url("../img/bg_conteneur_droite.png") top right repeat-y; */ -} - -.contenu { - width: 100%; - text-align: center; - padding-top: 20px; -} - -.logo { - text-align: center; -} -.logopos { - padding-top: 20px; - max-height: 40px; -} - -/* ------------------- Header ------------------- */ -.entete { - height: 15px; - margin: 0; - /* background: url('../img/bg_entete.png') no-repeat left top; */ -} - -.entete span { - display: none; -} - -.principal_login td.label1 { - width: 50%; -} - -/* ------------------- Menu ------------------- */ -.menu_principal { - margin: 0; - font-size: 14px; - height: 84px; - background: #CCCCCC; - background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%); - background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%); - background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%); - background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%); - background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(40,40,40,.3)) ); -} - -.menu_bloc { - margin-left: 12px; -} - -.menu { - margin: 0; - list-style-type: none; - padding: 8px 0 0; -} - -.menu li { - float: left; - padding-right: 10px; -} - -.menu_choix0 { - font-size: 10px; - text-align: right; - font-style: italic; - font-weight: normal; - display: block; - color: #333; - text-decoration: none; - padding-right: 5px; -} - -/* Force values for small screen 570 */ -@media only screen and (max-width: 570px) -{ - .menu_choix0 { - max-width: 180px; - } -} - -.menu_choix0 a { - font-weight: normal; - text-decoration: none; -} -li.menu_choix0 { - float: right; -} - -/* ------------------- Remind of products ------------------- */ -.liste_articles { - min-width: 215px; - float: right; - margin-top: 8px; - margin-right: 20px; - border: 1px dotted #5ca64d; - padding-bottom: 10px; - vertical-align: middle; -} - -p.titre { - margin: 0 0 20px; - text-align: center; - font-weight: bold; - font-size: 1.4em; - color: #5ca64d; - border-bottom: 1px dotted; -} - -.cadre_article { - width: 180px; - text-align: center; - margin: 0 auto 10px; - padding-bottom: 10px; - border-bottom: 1px solid #eee; -} - -.cadre_article p { - color: #5ca64d; -} - -.cadre_article p a { - color: #333; - font-size: 1.1em; - text-decoration: none; - padding-right: 25px; - background: url('../img/basket_delete.png') top right no-repeat; -} - -.cadre_article p a:hover { - color: #6d3f6d; -} - -.cadre_aucun_article { - text-align: center; - font-style: italic; -} - -.cadre_prix_total { - text-align: center; - font-weight: bold; - font-size: 1.4em; - color: #6d3f6d; - padding-top: 10px; - padding-bottom: 10px; - margin-left: 20px; - margin-right: 20px; - border: 1px dotted #6d3f6d; -} - -/* ------------------- Contenu ------------------- */ -.principal_login { - margin: 10px; - padding: 0; - max-width: 800px; - text-align: left; -} - -.formulaire_login { - text-align: center; -} - -.formulaire_login table { - padding-left: 60px; - margin: 0 auto 20px; - background: url('../img/login.png') bottom left no-repeat; -} - -.formulaire_login table tr { - height: 30px; -} - -.texte_login { - padding-left: 2px; - padding-right: 2px; - background: #fff; - border: 1px solid #6d3f6d; -} - -.principal { - float: left; - margin: 0 15px; - padding: 0; - max-width: 900px; -} - -.blocksellfinished { - min-width: 215px; - margin-top: 8px; -} -.titre1 { - font-weight: bold; - color: #ff9900; - margin: 0; - font-size: 1.4em; -} - -.label1 { - color: #333; - font-size: 1.1em; -} - -.cadre_facturation { - border: 2px solid #ddd; - margin-bottom: 15px; -} - -.principal p { - padding-left: 10px; - padding-right: 10px; -} - -.lien1 { - color: #333; - font-size: 1.1em; - text-decoration: underline; -} - -.lien1:hover { - color: #6d3f6d; -} - -/* Formulaires */ -.formulaire1 { - padding: 0; -} - - -/* --------------------- Combo lists ------------------- */ -.select_design { - overflow: auto; -} - -.select_design select { - border: 1px solid #6d3f6d; - font: 12px verdana,arial,helvetica; - background: #fff; -} - -.select_tva select { - width: 60px; - border: 1px solid #6d3f6d; - background: #fff; -} - -.top_liste { - font-style: italic; - text-align: center; - color: #aaa; -} - -/* --------------- Champs texte ---------------- */ -.texte_ref,.texte1,.texte1_off,.texte2,.texte2_off,.textarea_note { - padding-left: 2px; - padding-right: 2px; -} - -.texte_ref,.texte1,.texte2,.textarea_note { - background: #fff; - border: 1px solid #6d3f6d; -} - -.texte1_off,.texte2_off { - color: #000; - border: 1px solid #eee; - background: #eee; -} - -.texte_ref { - min-width: 150px; -} - -.texte1,.texte1_off { - width: 60px; -} - -.texte2,.texte2_off { - width: 140px; -} - -/* ------------------- */ -.textarea_note { - width: 100%; - height: 50px; - padding: 2px 2px; -} - -/* -------------- Buttons for SimplePOS --------------------- */ -.bouton_ajout_article { - margin-top: 10px; - width: 60%; - height: 40px; -} - -.bouton_mode_reglement, .bouton_mode_reglement_disabled { - width: 150px; - height: 40px; -} - -.bouton_validation { /* width: 80px; */ - margin-left: 10px; - margin-top: 20px; - margin-bottom: 10px; -} - -.formulaire2 { - padding: 0; - width: 100%; -} - -.table_resume { - width: 100%; -} - -.table_resume tr { - background: #eee; -} - -.table_resume td { - padding-left: 8px; -} - -.resume_label,.note_label { - min-width: 200px; - font-weight: bold; - font-size: 1.1em; -} - -.note_label { - padding-top: 20px; -} - -/* ------------------- Pied de page ------------------- */ -.pied { - clear: both; - height: 15px; - /* background: url('../img/bg_pied.png') no-repeat bottom left; */ -} - -/* ------------------- Param�tres communs (messages d'erreur, informations, etc...) ------------------- */ -.msg_err1 { - color: #c00; -} - -/* Messages d'erreur */ -.cadre_err1 { - margin-right: 10px; - margin-bottom: 10px; - padding: 10px 10px; - border: 1px solid #c00; - background: #feffac; - color: #c00; -} - -/* Titre */ -.err_titre { - font-weight: bold; - margin: 0 0 10px; - padding: 0; -} - -/* Description */ -.err_desc { - margin: 0; - padding: 0; -} - -/* Messages d'information */ -.cadre_msg1 { - margin-right: 10px; - margin-bottom: 10px; - padding: 10px 10px; - border: 1px solid #070; - background: #e8f8da; - color: #070; -} - -/* Titre */ -.msg_titre { - font-weight: bold; - margin: 0 0 10px; - padding: 0; -} - -/* Description */ -.msg_desc { - margin: 0; - padding: 0; -} - -/* Affichage de la liste des resultats */ -.dhtml_bloc { - margin: 0; - padding: 3px; - font-size: 13px; - font-family: arial, sans-serif; - border: 1px solid #000; - z-index: 1; - width: 455px; - max-height: 500px; - overflow: auto; - position: absolute; - background-color: white; -} - -.dhtml_defaut { - list-style-type: none; - display: block; - height: 16px; - overflow: hidden; -} - -.dhtml_selection { - background-color: #3366cc; - color: white ! important; -} diff --git a/htdocs/cashdesk/css/ticket.css b/htdocs/cashdesk/css/ticket.css deleted file mode 100644 index 248e0f7b9b6..00000000000 --- a/htdocs/cashdesk/css/ticket.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * TPV ticket.css - */ -body { - font-size: 1.5em; - position: relative; -} - -.entete { /* position: relative; */ - -} - -.address { /* float: left; */ - font-size: 12px; -} - -.date_heure { - position: absolute; - top: 0; - right: 0; - font-size: 16px; -} - -.infos { - position: relative; -} - -.liste_articles { - width: 100%; - border-bottom: 1px solid #000; - text-align: center; -} - -.liste_articles tr.titres th { - border-bottom: 1px solid #000; -} - -.liste_articles td.total { - text-align: right; -} - -.totaux { - margin-top: 20px; - width: 30%; - float: right; - text-align: right; -} - -.lien { - position: absolute; - top: 0; - left: 0; - display: none; -} - -@media print { - .lien { - display: none; - } -} - diff --git a/htdocs/cashdesk/deconnexion.php b/htdocs/cashdesk/deconnexion.php deleted file mode 100644 index f7506902ab5..00000000000 --- a/htdocs/cashdesk/deconnexion.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * 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/cashdesk/deconnexion.php - * \ingroup cashdesk - * \brief Manage deconnexion for point of sale module - */ - -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect -if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); -} -if (!defined('NOREQUIREHTML')) { - define('NOREQUIREHTML', '1'); -} -if (!defined('NOREQUIREAJAX')) { - define('NOREQUIREAJAX', '1'); -} -if (!defined('NOREQUIRESOC')) { - define('NOREQUIRESOC', '1'); -} - -require_once '../main.inc.php'; - -// This destroy tag that say "Point of Sale session is on". -unset($_SESSION['uid']); - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - -header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php'); -exit; diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php deleted file mode 100644 index edce8acd781..00000000000 --- a/htdocs/cashdesk/facturation.php +++ /dev/null @@ -1,159 +0,0 @@ - - * Copyright (C) 2008-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2013 Marcos García - * Copyright (C) 2013 Adolfo Segura - * - * 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/cashdesk/facturation.php - * \ingroup cashdesk - * \brief Include to show main page for cashdesk module - */ - - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -$form = new Form($db); - -// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled) -if (GETPOST('filtre', 'alpha')) { - // Avec filtre - $ret = array(); $i = 0; - - $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= ", ps.reel"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'"; - } - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND p.tosell = 1"; - if (!$conf->global->CASHDESK_SERVICES) { - $sql .= " AND p.fk_product_type = 0"; - } - $sql .= " AND ("; - $sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'"; - if (!empty($conf->barcode->enabled)) { - $filtre = GETPOST('filtre', 'alpha'); - - //If the barcode looks like an EAN13 format and the last digit is included in it, - //then whe look for the 12-digit too - //As the twelve-digit string will also hit the 13-digit code, we only look for this one - if (strlen($filtre) == 13) { - $crit_12digit = substr($filtre, 0, 12); - $sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'"; - } else { - $sql .= " OR p.barcode LIKE '%".$db->escape($filtre)."%'"; - } - } - $sql .= ")"; - $sql .= " ORDER BY label"; - - dol_syslog("facturation.php", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - $nbr_enreg = $db->num_rows($resql); - - while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) { - foreach ($tab as $cle => $valeur) { - $ret[$i][$cle] = $valeur; - } - $i++; - } - $db->free($resql); - } else { - dol_print_error($db); - } - $tab_designations = $ret; -} else { - // Sans filtre - $ret = array(); - $i = 0; - - $sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= ", ps.reel"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'"; - } - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND p.tosell = 1"; - if (!$conf->global->CASHDESK_SERVICES) { - $sql .= " AND p.fk_product_type = 0"; - } - $sql .= " ORDER BY p.label"; - - dol_syslog($sql); - $resql = $db->query($sql); - if ($resql) { - $nbr_enreg = $db->num_rows($resql); - - while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) { - foreach ($tab as $cle => $valeur) { - $ret[$i][$cle] = $valeur; - } - $i++; - } - $db->free($resql); - } else { - dol_print_error($db); - } - $tab_designations = $ret; -} - -//$nbr_enreg = count($tab_designations); - -if ($nbr_enreg > 1) { - if ($nbr_enreg > $conf_taille_listes) { - $top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----'; - } else { - $top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----'; - } -} elseif ($nbr_enreg == 1) { - $top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound").' -----'; -} else { - $top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound").' -----'; -} - - -// Recuperation des taux de tva -global $mysoc; - -$ret = array(); -$i = 0; - -// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation -$obj_facturation->getSetPaymentMode('RESET'); -$obj_facturation->amountCollected('RESET'); -$obj_facturation->amountReturned('RESET'); -$obj_facturation->paiementLe('RESET'); - - -// Affichage des templates -require 'tpl/facturation1.tpl.php'; diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php deleted file mode 100644 index 3d0e9ff84ec..00000000000 --- a/htdocs/cashdesk/facturation_dhtml.php +++ /dev/null @@ -1,129 +0,0 @@ - - * Copyright (C) 2008-2009 Laurent Destailleur - * Copyright (C) 2015 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/facturation_dhtml.php - * \ingroup cashdesk - * \brief This page is called each time we press a key in the code search form to show product combo list. - */ - - -if (!defined('NOREQUIRESOC')) { - define('NOREQUIRESOC', '1'); -} -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -if (!defined('NOTOKENRENEWAL')) { - define('NOTOKENRENEWAL', '1'); -} -if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); -} -if (!defined('NOREQUIREHTML')) { - define('NOREQUIREHTML', '1'); -} -if (!defined('NOREQUIREAJAX')) { - define('NOREQUIREAJAX', '1'); -} - -// Change this following line to use the correct relative path (../, ../../, etc) -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -top_httphead('text/html'); - -$search = GETPOST("code", "alpha"); - -// Search from criteria -if (dol_strlen($search) >= 0) { // If search criteria is on char length at least - $sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= ", ps.reel"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'"; - } - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND p.tosell = 1"; - $sql .= " AND p.fk_product_type = 0"; - // Add criteria on ref/label - if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) { - $sql .= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'"; - if (!empty($conf->barcode->enabled)) { - $sql .= " OR p.barcode LIKE '".$db->escape($search)."%'"; - } - $sql .= ")"; - } else { - $sql .= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'"; - if (!empty($conf->barcode->enabled)) { - $sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'"; - } - $sql .= ")"; - } - $sql .= " ORDER BY label"; - - dol_syslog("facturation_dhtml.php", LOG_DEBUG); - $result = $db->query($sql); - - if ($result) { - if ($nbr = $db->num_rows($result)) { - $resultat = '
    '; - - $ret = array(); $i = 0; - while ($tab = $db->fetch_array($result)) { - foreach ($tab as $cle => $valeur) { - $ret[$i][$cle] = $valeur; - } - $i++; - } - $tab = $ret; - - $tab_size = count($tab); - for ($i = 0; $i < $tab_size; $i++) { - $resultat .= ' -
  • '.$tab[$i]['ref'].' - '.$tab[$i]['label'].'
  • - '; - } - - $resultat .= '
'; - - print $resultat; - } else { - $langs->load("cashdesk"); - - print '
    '; - print '
  • '.$langs->trans("NoResults").'
  • '; - print '
'; - } - } -} diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php deleted file mode 100644 index f51cda3e77b..00000000000 --- a/htdocs/cashdesk/facturation_verif.php +++ /dev/null @@ -1,225 +0,0 @@ - - * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2018 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/facturation_verif.php - * \ingroup cashdesk - * \brief facturation_verif.php - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -$action = GETPOST('action', 'aZ09'); - -$obj_facturation = unserialize($_SESSION['serObjFacturation']); -unset($_SESSION['serObjFacturation']); - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -switch ($action) { - default: - if (GETPOST('hdnSource') != 'NULL') { - $sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= ", ps.reel"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; - if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".((int) $conf_fkentrepot); - } - $sql .= " WHERE p.entity IN (".getEntity('product').")"; - - // Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ... - if ($_POST['hdnSource'] == 'LISTE') { - $sql .= " AND p.rowid = ".((int) GETPOST('selProduit', 'int')); - } elseif ($_POST['hdnSource'] == 'REF') { - $sql .= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'"; - } - - $result = $db->query($sql); - if ($result) { - // ... et enregistrement dans l'objet - if ($db->num_rows($result)) { - $ret = array(); - $tab = $db->fetch_array($result); - foreach ($tab as $key => $value) { - $ret[$key] = $value; - } - // Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function - - $productid = $ret['rowid']; - $product = new Product($db); - $product->fetch($productid); - $prod = $product; - - $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; - $societe = new Societe($db); - $societe->fetch($thirdpartyid); - - // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $societe, $product->id); - $tva_npr = get_default_npr($mysoc, $societe, $product->id); - if (empty($tva_tx)) { - $tva_npr = 0; - } - - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - - // multiprix - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($societe->price_level)) { - $pu_ht = $prod->multiprices[$societe->price_level]; - $pu_ttc = $prod->multiprices_ttc[$societe->price_level]; - $price_min = $prod->multiprices_min[$societe->price_level]; - $price_base_type = $prod->multiprices_base_type[$societe->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[$societe->price_level])) { - $tva_tx = $prod->multiprices_tva_tx[$societe->price_level]; - } - if (isset($prod->multiprices_recuperableonly[$societe->price_level])) { - $tva_npr = $prod->multiprices_recuperableonly[$societe->price_level]; - } - } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; - - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $societe->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result >= 0) { - 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; - } - } - } else { - setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); - } - } - - $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); - - // if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ? - if (!empty($price_ht)) { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } elseif ($tmpvat != $tmpprodvat) { - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - if ($price_base_type != 'HT') { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } - } - - $obj_facturation->id($ret['rowid']); - $obj_facturation->ref($ret['ref']); - $obj_facturation->stock($ret['reel']); - //$obj_facturation->prix($ret['price']); - $obj_facturation->prix($pu_ht); - - - $vatrate = $tva_tx; - $obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code) - - // Definition du filtre pour n'afficher que le produit concerne - if (GETPOST('hdnSource') == 'LISTE') { - $filtre = $ret['ref']; - } elseif (GETPOST('hdnSource') == 'REF') { - $filtre = GETPOST('txtRef'); - } - - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode($filtre); - } else { - $obj_facturation->raz(); - - if (GETPOST('hdnSource') == 'REF') { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode(GETPOST('txtRef')); - } else { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; - } - } - } else { - dol_print_error($db); - } - } else { - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; - } - - break; - - case 'change_thirdparty': // We have clicked on button "Modify" a thirdparty - $newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY', 'int'); - if ($newthirdpartyid > 0) { - $_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid; - } - - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; - break; - - case 'ajout_article': - if (!empty($obj_facturation->id)) { // A product was previously selected and stored in session, so we can add it - dol_syslog("facturation_verif save vat ".GETPOST('selTva')); - $obj_facturation->qte(GETPOST('txtQte')); - $obj_facturation->tva(GETPOST('selTva')); // id of vat. Saved so we can use it for next product - $obj_facturation->remisePercent(GETPOST('txtRemise')); - $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] - // We update prixTotalTtc - } - - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; - break; - - case 'suppr_article': - $obj_facturation->supprArticle(GETPOST('suppr_id')); - - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; - break; -} - -// We saved object obj_facturation -$_SESSION['serObjFacturation'] = serialize($obj_facturation); -//var_dump($_SESSION['serObjFacturation']); -header('Location: '.$redirection); -exit; diff --git a/htdocs/cashdesk/img/basket_delete.png b/htdocs/cashdesk/img/basket_delete.png deleted file mode 100644 index 9419d91d9f1..00000000000 Binary files a/htdocs/cashdesk/img/basket_delete.png and /dev/null differ diff --git a/htdocs/cashdesk/img/bg_conteneur_droite.png b/htdocs/cashdesk/img/bg_conteneur_droite.png deleted file mode 100644 index 87d7fcf069a..00000000000 Binary files a/htdocs/cashdesk/img/bg_conteneur_droite.png and /dev/null differ diff --git a/htdocs/cashdesk/img/bg_conteneur_gauche.png b/htdocs/cashdesk/img/bg_conteneur_gauche.png deleted file mode 100644 index a6da5629413..00000000000 Binary files a/htdocs/cashdesk/img/bg_conteneur_gauche.png and /dev/null differ diff --git a/htdocs/cashdesk/img/bg_entete.png b/htdocs/cashdesk/img/bg_entete.png deleted file mode 100644 index 0c7670509bc..00000000000 Binary files a/htdocs/cashdesk/img/bg_entete.png and /dev/null differ diff --git a/htdocs/cashdesk/img/bg_pied.png b/htdocs/cashdesk/img/bg_pied.png deleted file mode 100644 index 36a38a42ced..00000000000 Binary files a/htdocs/cashdesk/img/bg_pied.png and /dev/null differ diff --git a/htdocs/cashdesk/img/calendrier.png b/htdocs/cashdesk/img/calendrier.png deleted file mode 100644 index 7ac67ea96b3..00000000000 Binary files a/htdocs/cashdesk/img/calendrier.png and /dev/null differ diff --git a/htdocs/cashdesk/img/decrypted.png b/htdocs/cashdesk/img/decrypted.png deleted file mode 100644 index 8d2b4696a2b..00000000000 Binary files a/htdocs/cashdesk/img/decrypted.png and /dev/null differ diff --git a/htdocs/cashdesk/img/gescom.png b/htdocs/cashdesk/img/gescom.png deleted file mode 100644 index 0ec1639335e..00000000000 Binary files a/htdocs/cashdesk/img/gescom.png and /dev/null differ diff --git a/htdocs/cashdesk/img/lock.png b/htdocs/cashdesk/img/lock.png deleted file mode 100644 index 55258949069..00000000000 Binary files a/htdocs/cashdesk/img/lock.png and /dev/null differ diff --git a/htdocs/cashdesk/img/login.png b/htdocs/cashdesk/img/login.png deleted file mode 100644 index 600cb67dd0a..00000000000 Binary files a/htdocs/cashdesk/img/login.png and /dev/null differ diff --git a/htdocs/cashdesk/img/new.png b/htdocs/cashdesk/img/new.png deleted file mode 100644 index ed848a86550..00000000000 Binary files a/htdocs/cashdesk/img/new.png and /dev/null differ diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php deleted file mode 100644 index fc67c65ea4c..00000000000 --- a/htdocs/cashdesk/include/environnement.php +++ /dev/null @@ -1,50 +0,0 @@ - - * Copyright (C) 2009-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -// This file initializes more variables to already initialized variables with main.inc.php -// So include of this file must be always done after include to main.inc.php - -$conf_db_type = $dolibarr_main_db_type; - -// Parametres de connexion a la base -$conf_db_host = $dolibarr_main_db_host; -$conf_db_user = $dolibarr_main_db_user; -$conf_db_pass = $dolibarr_main_db_pass; -$conf_db_base = $dolibarr_main_db_name; - -// Identifiant unique correspondant au tiers generique pour la vente -$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0); -// Identifiant unique correspondant a l'entrepot a utiliser -$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0); -if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { - $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0. -} - -// Identifiant unique correspondant au compte caisse / liquide -$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0); -// Identifiant unique correspondant au compte cheque -$conf_fkaccount_cheque = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE : 0); -// Identifiant unique correspondant au compte cb -$conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CB : 0); -//var_dump($_SESSION); - - -// View parameters -$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists -$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes diff --git a/htdocs/cashdesk/include/keypad.php b/htdocs/cashdesk/include/keypad.php deleted file mode 100644 index 6e4c9c874d6..00000000000 --- a/htdocs/cashdesk/include/keypad.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * 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 . - */ - -/** - * Return a string to output a keypad - * - * @param string $keypadname Key pad name - * @param string $formname Form name - * @return string HTML code to show a js keypad. - */ -function genkeypad($keypadname, $formname) -{ - global $conf; - - if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) { - return ''; - } - - // défine the font size of button - $btnsize = 32; - $sz = ''."\n"; - $sz .= '
'."\n"; - $sz .= ''; - return $sz; -} diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php deleted file mode 100644 index a4ee6fa415c..00000000000 --- a/htdocs/cashdesk/index.php +++ /dev/null @@ -1,232 +0,0 @@ - - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2011 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/cashdesk/index.php - * \ingroup cashdesk - * \brief File to login to point of sales - */ - -// Set and init common variables -// This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects -require_once '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("admin", "cashdesk")); - -// Test if user logged -if ($_SESSION['uid'] > 0) { - header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php'); - exit; -} - -$usertxt = GETPOST('user', '', 1); -$err = GETPOST("err"); - -// Instantiate hooks of thirdparty module only if not already define -$hookmanager->initHooks(array('cashdeskloginpage')); - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * View - */ - -$form = new Form($db); -$formproduct = new FormProduct($db); - -$arrayofcss = array('/cashdesk/css/style.css'); -top_htmlhead('', '', 0, 0, '', $arrayofcss); - -// Execute hook getLoginPageOptions (for table) -$parameters = array('entity' => GETPOST('entity', 'int')); -$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. -if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) { - $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility -} else { - $morelogincontent = $hookmanager->resPrint; -} -?> - - -
-
-
- - - -
-
- -
-
- -
-
-
- - -'; diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php deleted file mode 100644 index 94e0e7009cf..00000000000 --- a/htdocs/cashdesk/index_verif.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - * - * This page is called after submission of login page. - * We set here login choices into session. - */ - -/** - * \file htdocs/cashdesk/index_verif.php - * \ingroup cashdesk - * \brief index_verif.php - */ - -include '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("admin", "cashdesk")); - -$username = GETPOST("txtUsername"); -$password = GETPOST("pwdPassword"); -$thirdpartyid = (GETPOST('socid', 'int') > 0) ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY; -$warehouseid = (GETPOST("warehouseid") > 0) ?GETPOST("warehouseid", 'int') : $conf->global->CASHDESK_ID_WAREHOUSE; -$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH; -$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; -$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CB", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB; - - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -// Check username -if (empty($username)) { - $retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Login")); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); - exit; -} -// Check third party id -if (!($thirdpartyid > 0)) { - $retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("CashDeskThirdPartyForSell")); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); - exit; -} - -// If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished. -if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !($warehouseid > 0)) { - $retour = $langs->trans("CashDeskYouDidNotDisableStockDecease"); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); - exit; -} - -// If stock decrease on bill validation, check user has stock edit permissions -if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !empty($username)) { - $testuser = new User($db); - $testuser->fetch(0, $username); - $testuser->getrights('stock'); - if (empty($testuser->rights->stock->creer)) { - $retour = $langs->trans("UserNeedPermissionToEditStockToUsePos"); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); - exit; - } -} - - -// Check password -$auth = new Auth($db); -$retour = $auth->verif($username, $password); - -if ($retour >= 0) { - $return = array(); - - $sql = "SELECT rowid, lastname, firstname"; - $sql .= " FROM ".MAIN_DB_PREFIX."user"; - $sql .= " WHERE login = '".$db->escape($username)."'"; - $sql .= " AND entity IN (0,".$conf->entity.")"; - - $result = $db->query($sql); - if ($result) { - $tab = $db->fetch_array($res); - - foreach ($tab as $key => $value) { - $return[$key] = $value; - } - - $_SESSION['uid'] = $tab['rowid']; - $_SESSION['uname'] = $username; - $_SESSION['lastname'] = $tab['lastname']; - $_SESSION['firstname'] = $tab['firstname']; - $_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : ''); - $_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : ''); - - $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : ''); - $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : ''); - $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); - //var_dump($_SESSION);exit; - - header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV'); - exit; - } else { - dol_print_error($db); - } -} else { - // Load translation files required by the page - $langs->loadLangs(array("other", "errors")); - $retour = $langs->trans("ErrorBadLoginPassword"); - header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid); - exit; -} diff --git a/htdocs/cashdesk/javascript/dhtml.js b/htdocs/cashdesk/javascript/dhtml.js deleted file mode 100644 index fd15704b318..00000000000 --- a/htdocs/cashdesk/javascript/dhtml.js +++ /dev/null @@ -1,73 +0,0 @@ - -/* Copyright (C) 2007-2008 Jeremie Ollivier - * Copyright (C) 2015 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -// Instanciation et initialisation de l'objet xmlhttprequest -function file(fichier) { - - // Instanciation de l'objet pour Mozilla, Konqueror, Opera, Safari, etc ... - if (window.XMLHttpRequest) { - - xhr_object = new XMLHttpRequest (); - - // ... ou pour IE - } else if (window.ActiveXObject) { - - xhr_object = new ActiveXObject ("Microsoft.XMLHTTP"); - - } else { - - return (false); - - } - - xhr_object.open ("GET", fichier, false); - xhr_object.send (null); - - if (xhr_object.readyState == 4) { - - return (xhr_object.responseText); - - } else { - - return (false); - - } - -} - - -// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage -function verifResultat(aCible, aCode, iLimit) { - if (aCode != '' && aCode.length >= iLimit) { - - if (texte = file('facturation_dhtml.php?code='+escape(aCode))) { - document.getElementById(aCible).innerHTML = texte; - } else - document.getElementById(aCible).innerHTML = ''; - } - -} - - -// Change dynamiquement la classe de l'element ayant l'id aIdElement pour aClasse -function setStyle(aIdElement, aClasse) { - - aIdElement.className = aClasse; - -} - diff --git a/htdocs/cashdesk/javascript/facturation1.js b/htdocs/cashdesk/javascript/facturation1.js deleted file mode 100644 index b25a1473c53..00000000000 --- a/htdocs/cashdesk/javascript/facturation1.js +++ /dev/null @@ -1,175 +0,0 @@ - -/* Copyright (C) 2007-2008 Jeremie Ollivier - * - * 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 . - */ - -// Calcul et affichage en temps reel des informations sur le produit en cours -function modif() { - - var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value ); - var qte = parseFloat ( document.getElementById('frmQte').txtQte.value ); - var _index = parseFloat ( document.getElementById('frmQte').selTva.selectedIndex ); - var tva = parseFloat ( document.getElementById('frmQte').selTva.options[_index].text ); - var remise = parseInt ( document.getElementById('frmQte').txtRemise.value ); - var stock = document.getElementById('frmQte').txtStock.value; - -// // On s'assure que la quantitee tapee ne depasse pas le stock -// if ( qte > stock ) { -// -// qte = stock; -// document.getElementById('frmQte').txtQte.value = qte; -// -// } -// -// if ( qte < 1 ) { -// -// qte = 1; -// document.getElementById('frmQte').txtQte.value = qte; -// -// } -// -// if ( !stock || stock <= 0 ) { -// -// qte = 0; -// document.getElementById('frmQte').txtQte.value = qte; -// -// } - - // Calcul du total HT, sans remise - var total_ht = Math.round ( (prix_unit * qte) * 100 ) / 100; - - // Calcul du montant de la remise, apres s'etre assure que cette derniere ne soit pas negative - if ( remise <= 0 ) { - - document.getElementById('frmQte').txtRemise.value = 0; - montant_remise = 0; - - } else { - - var montant_remise = total_ht * remise / 100; - - } - - // Recalcul du montant total, avec la remise - var total = Math.round ( (total_ht - montant_remise) *100 ) / 100; - - // Affichage du resultat dans le formulaire - document.getElementById('frmQte').txtTotal.value = total.toFixed(2); - -} - -// Affecte la source de la requete (liste deroulante ou champ texte 'ref') au champ cache -function setSource(aSrc) { - - document.getElementById('frmFacturation').hdnSource.value = aSrc; - document.getElementById('frmFacturation').submit(); - -} - -// Verification de la coherence des informations saisies dans le formulaire de choix du nombre d'articles -function verifSaisie() { - - if ( document.getElementById('frmQte').txtQte.value ) { - - return true; - - } else { - - document.getElementById('frmQte').txtQte.focus(); - return false; - - } - -} - -// Verification de la coherence des informations saisies dans le formulaire de calcul de la difference -function verifDifference() { - - var du = parseFloat ( document.getElementById('frmDifference').txtDu.value ); - var encaisse = parseFloat ( document.getElementById('frmDifference').txtEncaisse.value ); - - if (encaisse > du) { - - resultat = Math.round ( (encaisse - du) * 100 ) / 100; - document.getElementById('frmDifference').txtRendu.value = resultat.toFixed(2); - - } else if (encaisse == du) { - - document.getElementById('frmDifference').txtRendu.value = '0'; - - } else { - - document.getElementById('frmDifference').txtRendu.value = '-'; - - } - -} - -// Affecte le moyen de paiement (ESP, CB ou CHQ) au champ cache en fonction du bouton clique -function verifClic(aChoix) { - - document.getElementById('frmDifference').hdnChoix.value = aChoix; - -} - -// Determination du moyen de paiement, et validation du formulaire si les donnees sont coherentes -function verifReglement() { - - var choix = document.getElementById('frmDifference').hdnChoix.value; - var du = parseFloat (document.getElementById('frmDifference').txtDu.value); - var encaisse = parseFloat (document.getElementById('frmDifference').txtEncaisse.value); - - if ( du > 0 ) { - - if ( choix == 'ESP' ) { - - if ( encaisse != 0 && encaisse >= du ) { - - return true; - - } else { - - document.getElementById('frmDifference').txtEncaisse.select(); - document.getElementById('frmDifference').txtEncaisse.focus(); - return false; - - } - - } else if ( choix == 'DIF' ) { - - if ( document.getElementById('frmDifference').txtDatePaiement.value ) { - - return true; - - } else { - - document.getElementById('frmDifference').txtDatePaiement.select(); - document.getElementById('frmDifference').txtDatePaiement.focus(); - return false; - - } - - } else { - - return true; - - } - - } else { - - return false; - - } -} diff --git a/htdocs/cashdesk/javascript/keypad.js b/htdocs/cashdesk/javascript/keypad.js deleted file mode 100644 index 48d8491e8bc..00000000000 --- a/htdocs/cashdesk/javascript/keypad.js +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2014 Charles-FR BENKE - * - * 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 . - */ - -function closekeypad(keypadname) -{ - document.getElementById('keypad'+keypadname).style.display='none'; - document.getElementById('closekeypad'+keypadname).style.display='none'; - document.getElementById('openkeypad'+keypadname).style.display='inline-block'; -} -function openkeypad(keypadname) -{ - document.getElementById('keypad'+keypadname).style.display='inline-block'; - document.getElementById('closekeypad'+keypadname).style.display='inline-block'; - document.getElementById('openkeypad'+keypadname).style.display='none'; -} -function addvalue(keypadname, formname, valueToAdd) -{ - myform=document.forms[formname]; - if (myform.elements[keypadname].value=="0") - myform.elements[keypadname].value=""; - myform.elements[keypadname].value+=valueToAdd; - modif(); -} diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php deleted file mode 100644 index 41a0f0b757e..00000000000 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ /dev/null @@ -1,225 +0,0 @@ - - * Copyright (C) 2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2015 Regis Houssin - * 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 . - * - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - -// Load translation files required by the page -$langs->loadLangs(array("main", "bills", "cashdesk")); - -// Object $form must de defined - -?> - - - - - - -
trans("Article"); ?> -
- - - - - - - - - - - - -
trans("FilterRefOrLabelOrBC"); ?>trans("Designation"); ?>
- - -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
trans("Qty"); ?>trans("PriceUHT"); ?>trans("Discount"); ?> (%)trans("VATRate"); ?>
- - - - - vatrate; // To get vat rate we just have selected - - $buyer = new Societe($db); - if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) { - $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); - } - echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1); - ?> -
trans("Stock"); ?> - - trans("TotalHT"); ?>
- - " /> -
-
- - -
- - -
trans("Amount"); ?> - - - - - - - - - - - -
trans("TotalTicket"); ?>trans("Received"); ?>trans("Change"); ?>
- -
-
- -
trans("PaymentMode"); ?> -
- '; - if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0) { - $langs->load("errors"); - print 'transnoentitiesnoconv("CashDesk"))).'" />'; - } else { - print ''; - } - print '
'; - print '
'; - if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) { - $langs->load("errors"); - print 'transnoentitiesnoconv("CashDesk"))).'" />'; - } else { - print ''; - } - print '
'; - print '
'; - if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) { - $langs->load("errors"); - print 'transnoentitiesnoconv("CashDesk")).'" />'; - } else { - print ''; - } - print '
'; - print '
'; - print '
'; - ?> - " onclick="javascript: verifClic('DIF');" /> - trans("DateDue").' :'; - print $form->selectDate(-1, 'txtDatePaiement', 0, 0, 0, 'paymentmode', 1, 0); - print '
'; - ?> -
-
-
- - diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php deleted file mode 100644 index 74be200945f..00000000000 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ /dev/null @@ -1,73 +0,0 @@ - - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - * - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - - -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("main", "bills", "cashdesk")); - -?> - -
-
- -

trans("ShoppingCart"); ?>

- -fetch($thirdpartyid); -/** end add Ditto */ - -$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array()); - -$tab_size = count($tab); -if ($tab_size <= 0) { - print '
'.$langs->trans("NoArticle").'

'; -} else { - for ($i = 0; $i < $tab_size; $i++) { - echo ('
'."\n"); - echo ('

'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'

'."\n"); - - if ($tab[$i]['remise_percent'] > 0) { - $remise_percent = ' -'.$tab[$i]['remise_percent'].'%'; - } else { - $remise_percent = ''; - } - - $remise = $tab[$i]['remise']; - - echo ('

'.$tab[$i]['qte'].' x '.price2num($tab[$i]['price'], 'MT').$remise_percent.' = '.price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT").' ('.price(price2num($tab[$i]['total_ttc'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC").')

'."\n"); - echo ('
'."\n"); - } -} - -echo ('

'.$langs->trans("Total").' : '.price(price2num($total_ttc, 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'

'."\n"); - -?>
-
diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php deleted file mode 100644 index 67891aa67cf..00000000000 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ /dev/null @@ -1,90 +0,0 @@ - - * Copyright (C) 2008-2010 Laurent Destailleur - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2017 Juanjo Menent - * Copyright (C) 2012 Marcos García - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - - -include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - -/*if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) -{ - $company=new Societe($db); - $company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); - $companyLink = $company->getNomUrl(1); -}*/ -if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) { - $bankcash = new Account($db); - $bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]); - $bankcash->label = $bankcash->ref; - $bankcashLink = $bankcash->getNomUrl(1); -} -if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) { - $bankcb = new Account($db); - $bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]); - $bankcbLink = $bankcb->getNomUrl(1); -} -if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) { - $bankcheque = new Account($db); - $bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]); - $bankchequeLink = $bankcheque->getNomUrl(1); -} -if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) { - $warehouse = new Entrepot($db); - $warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]); - $warehouseLink = $warehouse->getNomUrl(1); -} - -// Load translation files required by the page -$langs->loadLangs(array("main", "cashdesk")); - -print "\n".''."\n"; -print ''; -print "\n".''."\n"; diff --git a/htdocs/cashdesk/tpl/ticket.tpl.php b/htdocs/cashdesk/tpl/ticket.tpl.php deleted file mode 100644 index 9220e3daad4..00000000000 --- a/htdocs/cashdesk/tpl/ticket.tpl.php +++ /dev/null @@ -1,119 +0,0 @@ - - * Copyright (C) 2011 Laurent Destailleur - * Copyright (C) 2012 Marcos García - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - - -include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - -// Load translation files required by the page -$langs->loadLangs(array("main", "cashdesk")); - -top_httphead('text/html'); - -$facid = GETPOST('facid', 'int'); -$object = new Facture($db); -$object->fetch($facid); - -?> - - - <?php echo $langs->trans('PrintTicket') ?> - - - - - -
- -
-

name; ?>
-
-

- -

'; - print $object->ref; - ?>

-
-
- -
- - - - - - - - - - - - - - - - - - - - - - -
trans("Code"); ?>trans("Label"); ?>trans("Qty"); ?>trans("Discount").' (%)'; ?>trans("TotalHT"); ?>
currency); ?>
- - - - - - - - - - - - -
trans("TotalHT"); ?>amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
trans("TotalVAT").''.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
trans("TotalTTC").''.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?>
- - - -trans("Close"); ?> - - diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php deleted file mode 100644 index c2a9124f300..00000000000 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ /dev/null @@ -1,118 +0,0 @@ - - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - -// Load translation files required by the page -$langs->loadLangs(array("main", "bills", "banks")); - -// Object $form must de defined - -?> - -
trans("Summary"); ?> - - - - - -amountVat()) { - echo (''); -} else { - echo (''); -} -?> - - - -getsetPaymentMode() == 'DIF') { - echo (''); -} else { - echo (''); -} - -// Affichage du montant rendu (reglement en especes) -if ($obj_facturation->amountReturned()) { - echo (''); -} - -?> - -
trans("Invoice"); ?>numInvoice(); ?>
trans("TotalHT"); ?>amountWithoutTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
'.$langs->trans("VAT").''.price(price2num($obj_facturation->amountVat(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("VAT").''.$langs->trans("NoVAT").'
trans("TotalTTC"); ?> amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?>
trans("PaymentMode"); ?> - getSetPaymentMode()) { - case 'ESP': - echo $langs->trans("Cash"); - $filtre = 'courant=2'; - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) { - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]; - } - break; - case 'CB': - echo $langs->trans("CreditCard"); - $filtre = 'courant=1'; - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) { - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]; - } - break; - case 'CHQ': - echo $langs->trans("Cheque"); - $filtre = 'courant=1'; - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) { - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]; - } - break; - case 'DIF': - echo $langs->trans("Reported"); - $filtre = 'courant=1 OR courant=2'; - $selected = ''; - break; - default: - $filtre = 'courant=1 OR courant=2'; - $selected = ''; - } - - ?> -
'.$langs->trans("DateDue").''.$obj_facturation->paiementLe().'
'.$langs->trans("Received").''.price(price2num($obj_facturation->amountCollected(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("Change").''.price(price2num($obj_facturation->amountReturned(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'
- -
- -

- trans("BankToPay")."
"; - $form->select_comptes($selected, 'cashdeskbank', 0, $filtre); - ?> -

-

trans("Notes"); ?>

- - -
- - - -
diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php deleted file mode 100644 index d89edfdc41a..00000000000 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ /dev/null @@ -1,57 +0,0 @@ - - * Copyright (C) 2012 Marcos García - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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 . - * - */ - -// Protection to avoid direct call of template -if (empty($langs) || !is_object($langs)) { - print "Error, template page can't be called as URL"; - exit; -} - -// Load translation files required by the page -$langs->loadLangs(array("main", "bills")); - -?> - -
- -
-

trans("SellFinished"); ?>


- - - -

trans("ShowInvoice"); ?>

-
-

trans("PrintTicket"); ?>

- -
-
-
- diff --git a/htdocs/cashdesk/validation.php b/htdocs/cashdesk/validation.php deleted file mode 100644 index 799283f602a..00000000000 --- a/htdocs/cashdesk/validation.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * 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/cashdesk/validation.php - * \ingroup cashdesk - * \brief validation.php - */ - -$form = new Form($db); - -// Affichage des templates -require 'tpl/validation1.tpl.php'; diff --git a/htdocs/cashdesk/validation_ok.php b/htdocs/cashdesk/validation_ok.php deleted file mode 100644 index 124d47a1e04..00000000000 --- a/htdocs/cashdesk/validation_ok.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * 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/cashdesk/validation_ok.php - * \ingroup cashdesk - * \brief validation_ok.php - */ - -// Affichage des templates -require 'tpl/validation2.tpl.php'; diff --git a/htdocs/cashdesk/validation_ticket.php b/htdocs/cashdesk/validation_ticket.php deleted file mode 100644 index 5fcf017ada1..00000000000 --- a/htdocs/cashdesk/validation_ticket.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * 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/cashdesk/validation_ticket.php - * \ingroup cashdesk - * \brief validation_ticket.php - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * Actions - */ - -$obj_facturation = unserialize($_SESSION['serObjFacturation']); -unset($_SESSION['serObjFacturation']); - -$hookmanager->initHooks(array('cashdeskTplTicket')); - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj_facturation); -if (empty($reshook)) { - require 'tpl/ticket.tpl.php'; -} - - -$_SESSION['serObjFacturation'] = serialize($obj_facturation); diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php deleted file mode 100644 index 0c9758d9a29..00000000000 --- a/htdocs/cashdesk/validation_verif.php +++ /dev/null @@ -1,361 +0,0 @@ - - * Copyright (C) 2008-2009 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/cashdesk/validation_verif.php - * \ingroup cashdesk - * \brief validation_verif.php - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; -require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - -$obj_facturation = unserialize($_SESSION['serObjFacturation']); - -$action = GETPOST('action', 'aZ09'); -$bankaccountid = GETPOST('cashdeskbank'); - -if (empty($user->rights->cashdesk->run)) { - accessforbidden(); -} - - -/* - * Actions - */ - -switch ($action) { - default: - $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation'; - break; - - case 'validate_sell': - $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; - - $company = new Societe($db); - $company->fetch($thirdpartyid); - - $invoice = new Facture($db); - $invoice->date = dol_now(); - $invoice->type = Facture::TYPE_STANDARD; - - // To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here - // and restore values just after - $sav_FACTURE_ADDON = ''; - if (!empty($conf->global->POS_ADDON)) { - $sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON; - $conf->global->FACTURE_ADDON = $conf->global->POS_ADDON; - - // To force prefix only for POS with terre module - if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) { - $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX; - } - // To force prefix only for POS with mars module - if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) { - $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX; - } - // To force rule only for POS with mercure - //... - } - - $num = $invoice->getNextNumRef($company); - - // Restore save values - if (!empty($sav_FACTURE_ADDON)) { - $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON; - } - - $obj_facturation->numInvoice($num); - - $obj_facturation->getSetPaymentMode($_POST['hdnChoix']); - - // Si paiement autre qu'en especes, montant encaisse = prix total - $mode_reglement = $obj_facturation->getSetPaymentMode(); - if ($mode_reglement != 'ESP') { - $montant = $obj_facturation->amountWithTax(); - } else { - $montant = $_POST['txtEncaisse']; - } - - if ($mode_reglement != 'DIF') { - $obj_facturation->amountCollected($montant); - - //Determination de la somme rendue - $total = $obj_facturation->amountWithTax(); - $encaisse = $obj_facturation->amountCollected(); - - $obj_facturation->amountReturned($encaisse - $total); - } else { - //$txtDatePaiement=$_POST['txtDatePaiement']; - $datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']); - $txtDatePaiement = dol_print_date($datePaiement, 'dayrfc'); - $obj_facturation->paiementLe($txtDatePaiement); - } - - $redirection = 'affIndex.php?menutpl=validation'; - break; - - - case 'retour': - $redirection = 'affIndex.php?menutpl=facturation'; - break; - - - case 'validate_invoice': - $now = dol_now(); - - // Recuperation de la date et de l'heure - $date = dol_print_date($now, 'day'); - $heure = dol_print_date($now, 'hour'); - - $note = ''; - if (!is_object($obj_facturation)) { - dol_print_error('', 'Empty context'); - exit; - } - - switch ($obj_facturation->getSetPaymentMode()) { - case 'DIF': - $mode_reglement_id = 0; - //$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid') - $cond_reglement_id = 0; - break; - case 'ESP': - $mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement', 'code', 'id', 1); - $cond_reglement_id = 0; - $note .= $langs->trans("Cash")."\n"; - $note .= $langs->trans("Received").' : '.$obj_facturation->amountCollected()." ".$conf->currency."\n"; - $note .= $langs->trans("Rendu").' : '.$obj_facturation->amountReturned()." ".$conf->currency."\n"; - $note .= "\n"; - $note .= '--------------------------------------'."\n\n"; - break; - case 'CB': - $mode_reglement_id = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1); - $cond_reglement_id = 0; - break; - case 'CHQ': - $mode_reglement_id = dol_getIdFromCode($db, 'CHQ', 'c_paiement', 'code', 'id', 1); - $cond_reglement_id = 0; - break; - } - if (empty($mode_reglement_id)) { - $mode_reglement_id = 0; // If mode_reglement_id not found - } - if (empty($cond_reglement_id)) { - $cond_reglement_id = 0; // If cond_reglement_id not found - } - $note .= GETPOST('txtaNotes', 'alphanohtml'); - dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id); - - $error = 0; - - - $db->begin(); - - $user->fetch($_SESSION['uid']); - $user->getrights(); - - $thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY']; - $societe = new Societe($db); - $societe->fetch($thirdpartyid); - - $invoice = new Facture($db); - - // Get content of cart - $tab_liste = $_SESSION['poscart']; - - // Loop on each line into cart - $tab_liste_size = count($tab_liste); - for ($i = 0; $i < $tab_liste_size; $i++) { - $tmp = getTaxesFromId($tab_liste[$i]['fk_tva']); - $vat_rate = $tmp['rate']; - $vat_npr = $tmp['npr']; - $vat_src_code = $tmp['code']; - - $invoiceline = new FactureLigne($db); - $invoiceline->fk_product = $tab_liste[$i]['fk_article']; - $invoiceline->desc = $tab_liste[$i]['label']; - $invoiceline->qty = $tab_liste[$i]['qte']; - $invoiceline->remise_percent = $tab_liste[$i]['remise_percent']; - $invoiceline->price = $tab_liste[$i]['price']; - $invoiceline->subprice = $tab_liste[$i]['price']; - - $invoiceline->tva_tx = empty($vat_rate) ? 0 : $vat_rate; // works even if vat_rate is '' - $invoiceline->info_bits = empty($vat_npr) ? 0 : $vat_npr; - $invoiceline->vat_src_code = $vat_src_code; - - $invoiceline->total_ht = $tab_liste[$i]['total_ht']; - $invoiceline->total_ttc = $tab_liste[$i]['total_ttc']; - $invoiceline->total_tva = $tab_liste[$i]['total_vat']; - $invoiceline->total_localtax1 = $tab_liste[$i]['total_localtax1']; - $invoiceline->total_localtax2 = $tab_liste[$i]['total_localtax2']; - - $invoice->lines[] = $invoiceline; - } - - $invoice->socid = $conf_fksoc; - $invoice->date_creation = $now; - $invoice->date = $now; - $invoice->date_lim_reglement = 0; - $invoice->total_ht = $obj_facturation->amountWithoutTax(); - $invoice->total_tva = $obj_facturation->amountVat(); - $invoice->total_ttc = $obj_facturation->amountWithTax(); - $invoice->note_private = $note; - $invoice->cond_reglement_id = $cond_reglement_id; - $invoice->mode_reglement_id = $mode_reglement_id; - $invoice->module_source = 'cashdesk'; - $invoice->pos_source = '0'; - //print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit; - - // Si paiement differe ... - if ($obj_facturation->getSetPaymentMode() == 'DIF') { - $resultcreate = $invoice->create($user, 0, dol_stringtotime($obj_facturation->paiementLe())); - if ($resultcreate > 0) { - $warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0); - if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { - $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice - } - - $resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0); - - if ($warehouseidtodecrease > 0) { - // Decrease - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - $langs->load("agenda"); - // Loop on each line - $cpt = count($invoice->lines); - for ($i = 0; $i < $cpt; $i++) { - if ($invoice->lines[$i]->fk_product > 0) { - $mouvP = new MouvementStock($db); - $mouvP->origin = &$invoice; - // We decrease stock for product - if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) { - $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref)); - } else { - $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref)); - } - if ($result < 0) { - $error++; - } - } - } - } - } else { - setEventMessages($invoice->error, $invoice->errors, 'errors'); - $error++; - } - - $id = $invoice->id; - } else { - $resultcreate = $invoice->create($user, 0, 0); - if ($resultcreate > 0) { - $warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0); - if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) { - $warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice - } - - $resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0); - - if ($warehouseidtodecrease > 0) { - // Decrease - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; - $langs->load("agenda"); - // Loop on each line - $cpt = count($invoice->lines); - for ($i = 0; $i < $cpt; $i++) { - if ($invoice->lines[$i]->fk_product > 0) { - $mouvP = new MouvementStock($db); - $mouvP->origin = &$invoice; - // We decrease stock for product - if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) { - $result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref)); - } else { - $result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref)); - } - if ($result < 0) { - setEventMessages($mouvP->error, $mouvP->errors, 'errors'); - $error++; - } - } - } - } - - $id = $invoice->id; - - // Add the payment - $payment = new Paiement($db); - $payment->datepaye = $now; - $payment->amounts[$invoice->id] = $obj_facturation->amountWithTax(); - $payment->note_public = $langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); - $payment->paiementid = $invoice->mode_reglement_id; - $payment->num_paiement = ''; - $payment->num_payment = ''; - - $paiement_id = $payment->create($user); - if ($paiement_id > 0) { - if (!$error) { - $result = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccountid, '', ''); - if (!$result > 0) { - $errmsg = $paiement->error; - $error++; - } - } - - if (!$error) { - if ($invoice->total_ttc == $obj_facturation->amountWithTax() - && $obj_facturation->getSetPaymentMode() != 'DIFF') { - // We set status to paid - $result = $invoice->setPaid($user); - //print 'set paid';exit; - } - } - } else { - setEventMessages($invoice->error, $invoice->errors, 'errors'); - $error++; - } - } else { - setEventMessages($invoice->error, $invoice->errors, 'errors'); - $error++; - } - } - - - if (!$error) { - $db->commit(); - $redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr - } else { - $db->rollback(); - $redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr - } - break; - - // End of case: validate_invoice -} - -unset($_SESSION['serObjFacturation']); - -$_SESSION['serObjFacturation'] = serialize($obj_facturation); - -header('Location: '.$redirection); -exit; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c6c0d277edd..bbf86d87c59 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -261,7 +261,7 @@ class ActionComm extends CommonObject /** * @var int socpeople id linked to action */ - public $contactid; + public $contact_id; /** * @var Societe|null Company linked to action (optional) @@ -273,7 +273,7 @@ class ActionComm extends CommonObject /** * @var Contact|null Contact linked to action (optional) * @deprecated - * @see $contactid + * @see $contact_id */ public $contact; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9c587a934e2..9aebf9d3ed9 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -517,526 +517,543 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= $db->order($sortfield, $sortorder); - +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - // TODO Set and use an optimized request in $sqlforcount with no fields and no useless join to caluclate nb of records - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + /* This old and fast method to get and count full list returns all record so use a high amount of memory. + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + */ + /* The slow method does not consume memory on mysql (not tested on pgsql) */ + /*$resql = $db->query($sql, 0, 'auto', 1); + while ($db->fetch_object($resql)) { + $nbtotalofrecords++; + }*/ + /* This fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -$sql .= $db->plimit($limit + 1, $offset); -//print $sql; +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} -dol_syslog("comm/action/list.php", LOG_DEBUG); $resql = $db->query($sql); -if ($resql) { - $actionstatic = new ActionComm($db); - $societestatic = new Societe($db); +if (!$resql) { + dol_print_error($db); + exit; +} - $num = $db->num_rows($resql); +$num = $db->num_rows($resql); - $arrayofselected = is_array($toselect) ? $toselect : array(); - // Local calendar - $newtitle = '
'; - $newtitle .= ' '.$langs->trans("LocalAgenda").'   '; - $newtitle .= '
'; - //$newtitle=$langs->trans($title); +$actionstatic = new ActionComm($db); +$societestatic = new Societe($db); - $tabactive = 'cardlist'; +$num = $db->num_rows($resql); - $head = calendars_prepare_head($param); +$arrayofselected = is_array($toselect) ? $toselect : array(); - print '
'."\n"; +// Local calendar +$newtitle = '
'; +$newtitle .= ' '.$langs->trans("LocalAgenda").'   '; +$newtitle .= '
'; +//$newtitle=$langs->trans($title); - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - $nav = ''; +$tabactive = 'cardlist'; - if ($filter) { - $nav .= ''; - } - if ($showbirthday) { - $nav .= ''; - } - print $nav; +$head = calendars_prepare_head($param); - //print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); - //print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); - //print dol_get_fiche_end(); +print ''."\n"; - // Add link to show birthdays - /* - $link = ''; - if (empty($conf->use_javascript_ajax)) - { - $newparam=$param; // newparam is for birthday links - $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); - if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; - $link=''; - if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); - else $link.=$langs->trans("AgendaHideBirthdayEvents"); - $link.=''; - } - */ +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +$nav = ''; - $s = $newtitle; +if ($filter) { + $nav .= ''; +} +if ($showbirthday) { + $nav .= ''; +} +print $nav; - // Calendars from hooks - $parameters = array(); $object = null; - $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); - if (empty($reshook)) { - $s .= $hookmanager->resPrint; - } elseif ($reshook > 1) { - $s = $hookmanager->resPrint; +//print dol_get_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); +//print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); +//print dol_get_fiche_end(); + +// Add link to show birthdays +/* +$link = ''; +if (empty($conf->use_javascript_ajax)) +{ + $newparam=$param; // newparam is for birthday links + $newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam); + if (! preg_match('/showbirthday=/i',$newparam)) $newparam.='&showbirthday=1'; + $link=''; + if (empty($showbirthday)) $link.=$langs->trans("AgendaShowBirthdayEvents"); + else $link.=$langs->trans("AgendaHideBirthdayEvents"); + $link.=''; +} +*/ + +$s = $newtitle; + +// Calendars from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); +if (empty($reshook)) { + $s .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $s = $hookmanager->resPrint; +} + +$viewmode = ''; +$viewmode .= ''; +//$viewmode .= ''; +$viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"'); +//$viewmode .= ''; +$viewmode .= ''.$langs->trans("ViewList").''; + +$viewmode .= ''; +//$viewmode .= ''; +$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"'); +//$viewmode .= ''; +$viewmode .= ''.$langs->trans("ViewCal").''; + +$viewmode .= ''; +//$viewmode .= ''; +$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"'); +//$viewmode .= ''; +$viewmode .= ''.$langs->trans("ViewWeek").''; + +$viewmode .= ''; +//$viewmode .= ''; +$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"'); +//$viewmode .= ''; +$viewmode .= ''.$langs->trans("ViewDay").''; + +$viewmode .= ''; +//$viewmode .= ''; +$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"'); +//$viewmode .= ''; +$viewmode .= ''.$langs->trans("ViewPerUser").''; + +$viewmode .= ''; + +// Add more views from hooks +$parameters = array(); $object = null; +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $viewmode .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $viewmode = $hookmanager->resPrint; +} + +$tmpforcreatebutton = dol_getdate(dol_now(), true); + +$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; + +//$param='month='.$monthshown.'&year='.$year; +$hourminsec = '100000'; + +$url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; +$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; +$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + +$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create); + +$param .= '&action='.$action; + +print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); + +print $s; + +$objecttmp = new ActionComm($db); +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +$moreforfilter = ''; + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) { + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); +} +$i = 0; + +print '
'; +print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); +print '
'; + +print '
'; +print ''."\n"; + +print ''; +if (!empty($arrayfields['a.id']['checked'])) { + print ''; +} +if (!empty($arrayfields['owner']['checked'])) { + print ''; +} +if (!empty($arrayfields['c.libelle']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.label']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.note']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.datep']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.datep2']['checked'])) { + print ''; +} +if (!empty($arrayfields['s.nom']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.fk_contact']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.fk_element']['checked'])) { + print ''; +} + +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +if (!empty($arrayfields['a.datec']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.tms']['checked'])) { + print ''; +} +if (!empty($arrayfields['a.percent']['checked'])) { + print ''; +} +// Action column +print ''; +print "\n"; + +print ''; +if (!empty($arrayfields['a.id']['checked'])) { + print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['owner']['checked'])) { + print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['c.libelle']['checked'])) { + print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['a.label']['checked'])) { + print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['a.note']['checked'])) { + print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder); +} +//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) +if (!empty($arrayfields['a.datep']['checked'])) { + print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['a.datep2']['checked'])) { + print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['s.nom']['checked'])) { + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['a.fk_contact']['checked'])) { + print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); +} +if (!empty($arrayfields['a.fk_element']['checked'])) { + print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); +} + +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +if (!empty($arrayfields['a.datec']['checked'])) { + print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['a.tms']['checked'])) { + print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); +} + +if (!empty($arrayfields['a.percent']['checked'])) { + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder); +} +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print "\n"; + +$contactstatic = new Contact($db); +$now = dol_now(); +$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; + +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; +$caction = new CActionComm($db); +$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); +$contactListCache = array(); + +while ($i < min($num, $limit)) { + $obj = $db->fetch_object($resql); + + // Discard auto action if option is on + if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') { + $i++; + continue; } - $viewmode = ''; - $viewmode .= ''; - //$viewmode .= ''; - $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="pictoactionview block"'); - //$viewmode .= ''; - $viewmode .= ''.$langs->trans("ViewList").''; + $actionstatic->id = $obj->id; + $actionstatic->ref = $obj->id; + $actionstatic->code = $obj->code; + $actionstatic->type_code = $obj->type_code; + $actionstatic->type_label = $obj->type_label; + $actionstatic->type_picto = $obj->type_picto; + $actionstatic->type_color = $obj->type_color; + $actionstatic->label = $obj->label; + $actionstatic->location = $obj->location; + $actionstatic->note_private = dol_htmlentitiesbr($obj->note); - $viewmode .= ''; - //$viewmode .= ''; - $viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"'); - //$viewmode .= ''; - $viewmode .= ''.$langs->trans("ViewCal").''; - - $viewmode .= ''; - //$viewmode .= ''; - $viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"'); - //$viewmode .= ''; - $viewmode .= ''.$langs->trans("ViewWeek").''; - - $viewmode .= ''; - //$viewmode .= ''; - $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"'); - //$viewmode .= ''; - $viewmode .= ''.$langs->trans("ViewDay").''; - - $viewmode .= ''; - //$viewmode .= ''; - $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"'); - //$viewmode .= ''; - $viewmode .= ''.$langs->trans("ViewPerUser").''; - - $viewmode .= ''; - - // Add more views from hooks - $parameters = array(); $object = null; - $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); - if (empty($reshook)) { - $viewmode .= $hookmanager->resPrint; - } elseif ($reshook > 1) { - $viewmode = $hookmanager->resPrint; - } - - $tmpforcreatebutton = dol_getdate(dol_now(), true); - - $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; - $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; - $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); - - $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create); - - $param .= '&action='.$action; - - print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); - - print $s; - - $objecttmp = new ActionComm($db); - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - $moreforfilter = ''; - - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) { - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); - } - $i = 0; - - print '
'; - print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid); - print '
'; - - print '
'; - print '
'; + print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print ''; + print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); + print ''; + $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125'); + print ajax_combobox('selectsearch_status'); + print ''; +$searchpicto = $form->showFilterButtons(); +print $searchpicto; +print '
'."\n"; - - print ''; - if (!empty($arrayfields['a.id']['checked'])) { - print ''; - } - if (!empty($arrayfields['owner']['checked'])) { - print ''; - } - if (!empty($arrayfields['c.libelle']['checked'])) { - print ''; - } - if (!empty($arrayfields['a.label']['checked'])) { - print ''; - } - if (!empty($arrayfields['a.note']['checked'])) { - print ''; - } - if (!empty($arrayfields['a.datep']['checked'])) { - print ''; - } - if (!empty($arrayfields['a.datep2']['checked'])) { - print ''; - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - } + // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid + // but only if we need it if (!empty($arrayfields['a.fk_contact']['checked'])) { - print ''; + $actionstatic->fetchResources(); } + + print ''; + + // Ref + if (!empty($arrayfields['a.id']['checked'])) { + print ''; + } + + // User owner + if (!empty($arrayfields['owner']['checked'])) { + print ''; + } + + // Type + if (!empty($arrayfields['c.libelle']['checked'])) { + print ''; + } + + // Label + if (!empty($arrayfields['a.label']['checked'])) { + print ''; + } + + // Description + if (!empty($arrayfields['a.note']['checked'])) { + print ''; + } + + $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour'; + + // Start date + if (!empty($arrayfields['a.datep']['checked'])) { + print ''; + } + + // End date + if (!empty($arrayfields['a.datep2']['checked'])) { + print ''; + } + + // Third party + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + } + + // Contact + if (!empty($arrayfields['a.fk_contact']['checked'])) { + print ''; + } + + // Linked object if (!empty($arrayfields['a.fk_element']['checked'])) { - print ''; + print ''; } // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Date creation if (!empty($arrayfields['a.datec']['checked'])) { - print ''; + // Status/Percent + print ''; } + // Date update if (!empty($arrayfields['a.tms']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['a.percent']['checked'])) { - print ''; + // Status/Percent + $datep = $db->jdate($obj->dp); + print ''; } // Action column - print ''; + print "\n"; - - print ''; - if (!empty($arrayfields['a.id']['checked'])) { - print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['owner']['checked'])) { - print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['c.libelle']['checked'])) { - print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['a.label']['checked'])) { - print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['a.note']['checked'])) { - print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder); - } - //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - if (!empty($arrayfields['a.datep']['checked'])) { - print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder); - } - if (!empty($arrayfields['a.datep2']['checked'])) { - print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); - } - if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['a.fk_contact']['checked'])) { - print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); - } - if (!empty($arrayfields['a.fk_element']['checked'])) { - print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - - // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (!empty($arrayfields['a.datec']['checked'])) { - print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); - } - if (!empty($arrayfields['a.tms']['checked'])) { - print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); - } - - if (!empty($arrayfields['a.percent']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder); - } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - print "\n"; - - $contactstatic = new Contact($db); - $now = dol_now(); - $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60; - - require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; - $caction = new CActionComm($db); - $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); - $contactListCache = array(); - - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - - // Discard auto action if option is on - if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') { - $i++; - continue; - } - - $actionstatic->id = $obj->id; - $actionstatic->ref = $obj->id; - $actionstatic->code = $obj->code; - $actionstatic->type_code = $obj->type_code; - $actionstatic->type_label = $obj->type_label; - $actionstatic->type_picto = $obj->type_picto; - $actionstatic->type_color = $obj->type_color; - $actionstatic->label = $obj->label; - $actionstatic->location = $obj->location; - $actionstatic->note_private = dol_htmlentitiesbr($obj->note); - - // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid - // but only if we need it - if (!empty($arrayfields['a.fk_contact']['checked'])) { - $actionstatic->fetchResources(); - } - - print ''; - - // Ref - if (!empty($arrayfields['a.id']['checked'])) { - print ''; - } - - // User owner - if (!empty($arrayfields['owner']['checked'])) { - print ''; - } - - // Type - if (!empty($arrayfields['c.libelle']['checked'])) { - print ''; - } - - // Label - if (!empty($arrayfields['a.label']['checked'])) { - print ''; - } - - // Description - if (!empty($arrayfields['a.note']['checked'])) { - print ''; - } - - $formatToUse = $obj->fulldayevent ? 'day' : 'dayhour'; - - // Start date - if (!empty($arrayfields['a.datep']['checked'])) { - print ''; - } - - // End date - if (!empty($arrayfields['a.datep2']['checked'])) { - print ''; - } - - // Third party - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - } - - // Contact - if (!empty($arrayfields['a.fk_contact']['checked'])) { - print ''; - } - - // Linked object - if (!empty($arrayfields['a.fk_element']['checked'])) { - print ''; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['a.datec']['checked'])) { - // Status/Percent - print ''; - } - // Date update - if (!empty($arrayfields['a.tms']['checked'])) { - print ''; - } - if (!empty($arrayfields['a.percent']['checked'])) { - // Status/Percent - $datep = $db->jdate($obj->dp); - print ''; - } - // Action column - print ''; - - print "\n"; - $i++; - } - print "
'; - print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); - print ''; - print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); - print '
'; + print $actionstatic->getNomUrl(1, -1); + print ''; // With edge and chrome the td overflow is not supported correctly when content is not full text. + if ($obj->fk_user_action > 0) { + $userstatic->fetch($obj->fk_user_action); + print $userstatic->getNomUrl(-1); + } else { + print ' '; + } + print ''; + print $actionstatic->getTypePicto(); + $labeltype = $obj->type_code; + if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { + $labeltype = 'AC_OTH'; + } + if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') { + $labeltype = $langs->trans("Message"); + } else { + if (!empty($arraylist[$labeltype])) { + $labeltype = $arraylist[$labeltype]; + } + if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) { + $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code + } + } + print dol_trunc($labeltype, 28); + print ''; + print $actionstatic->label; + print ''; + $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0)); + print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private); + print ''; + print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + $late = 0; + if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { + $late = 1; + } + if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) { + $late = 1; + } + if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) { + $late = 1; + } + if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { + $late = 1; + } + if ($late) { + print img_warning($langs->trans("Late")).' '; + } + print ''; + print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + print ''; + if ($obj->socid > 0) { + $societestatic->id = $obj->socid; + $societestatic->client = $obj->client; + $societestatic->name = $obj->societe; + $societestatic->email = $obj->socemail; + + print $societestatic->getNomUrl(1, '', 28); + } else { + print ' '; + } + print ''; + + if (!empty($actionstatic->socpeopleassigned)) { + $contactList = array(); + foreach ($actionstatic->socpeopleassigned as $socpeopleassigned) { + if (!isset($contactListCache[$socpeopleassigned['id']])) { + // if no cache found we fetch it + $contact = new Contact($db); + if ($contact->fetch($socpeopleassigned['id']) > 0) { + $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0); + $contactList[] = $contact->getNomUrl(1, '', 0); + } + } else { + // use cache + $contactList[] = $contactListCache[$socpeopleassigned['id']]; + } + } + if (!empty($contactList)) { + print implode(', ', $contactList); + } + } elseif ($obj->fk_contact > 0) { //keep for retrocompatibility with faraway event + $contactstatic->id = $obj->fk_contact; + $contactstatic->email = $obj->email; + $contactstatic->lastname = $obj->lastname; + $contactstatic->firstname = $obj->firstname; + $contactstatic->phone_pro = $obj->phone_pro; + $contactstatic->phone_mobile = $obj->phone_mobile; + $contactstatic->phone_perso = $obj->phone_perso; + $contactstatic->country_id = $obj->country_id; + print $contactstatic->getNomUrl(1, '', 0); + } else { + print " "; + } + print ''; + //var_dump($obj->fkelement.' '.$obj->elementtype); + if ($obj->fk_element > 0 && !empty($obj->elementtype)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1); + } else { + print " "; + } + print ''.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').''.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').''; - $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'minwidth100imp maxwidth125'); - print ajax_combobox('selectsearch_status'); - print ''.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } print '
'; - print $actionstatic->getNomUrl(1, -1); - print ''; // With edge and chrome the td overflow is not supported correctly when content is not full text. - if ($obj->fk_user_action > 0) { - $userstatic->fetch($obj->fk_user_action); - print $userstatic->getNomUrl(-1); - } else { - print ' '; - } - print ''; - print $actionstatic->getTypePicto(); - $labeltype = $obj->type_code; - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { - $labeltype = 'AC_OTH'; - } - if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') { - $labeltype = $langs->trans("Message"); - } else { - if (!empty($arraylist[$labeltype])) { - $labeltype = $arraylist[$labeltype]; - } - if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) { - $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code - } - } - print dol_trunc($labeltype, 28); - print ''; - print $actionstatic->label; - print ''; - $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0)); - print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private); - print ''; - print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); - $late = 0; - if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { - $late = 1; - } - if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) { - $late = 1; - } - if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) { - $late = 1; - } - if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { - $late = 1; - } - if ($late) { - print img_warning($langs->trans("Late")).' '; - } - print ''; - print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); - print ''; - if ($obj->socid > 0) { - $societestatic->id = $obj->socid; - $societestatic->client = $obj->client; - $societestatic->name = $obj->societe; - $societestatic->email = $obj->socemail; - - print $societestatic->getNomUrl(1, '', 28); - } else { - print ' '; - } - print ''; - - if (!empty($actionstatic->socpeopleassigned)) { - $contactList = array(); - foreach ($actionstatic->socpeopleassigned as $socpeopleassigned) { - if (!isset($contactListCache[$socpeopleassigned['id']])) { - // if no cache found we fetch it - $contact = new Contact($db); - if ($contact->fetch($socpeopleassigned['id']) > 0) { - $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0); - $contactList[] = $contact->getNomUrl(1, '', 0); - } - } else { - // use cache - $contactList[] = $contactListCache[$socpeopleassigned['id']]; - } - } - if (!empty($contactList)) { - print implode(', ', $contactList); - } - } elseif ($obj->fk_contact > 0) { //keep for retrocompatibility with faraway event - $contactstatic->id = $obj->fk_contact; - $contactstatic->email = $obj->email; - $contactstatic->lastname = $obj->lastname; - $contactstatic->firstname = $obj->firstname; - $contactstatic->phone_pro = $obj->phone_pro; - $contactstatic->phone_mobile = $obj->phone_mobile; - $contactstatic->phone_perso = $obj->phone_perso; - $contactstatic->country_id = $obj->country_id; - print $contactstatic->getNomUrl(1, '', 0); - } else { - print " "; - } - print ''; - //var_dump($obj->fkelement.' '.$obj->elementtype); - if ($obj->fk_element > 0 && !empty($obj->elementtype)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print dolGetElementUrl($obj->fk_element, $obj->elementtype, 1); - } else { - print " "; - } - print ''.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').''.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').''.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
"; - print '
'; - print '
'; - - $db->free($resql); -} else { - dol_print_error($db); + $i++; } +print ""; +print '
'; +print ''; + +$db->free($resql); // End of page llxFooter(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 802416f1626..163581221a8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2579,7 +2579,7 @@ if ($action == 'create') { } // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED) { + if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { print ''.$langs->trans("AddBill").''; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2d4eb5fb164..a21b4650f5b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -517,6 +517,12 @@ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as c"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } + +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= ' WHERE p.fk_soc = s.rowid'; $sql .= ' AND p.entity IN ('.getEntity('propal').')'; if (!$user->rights->societe->client->voir && !$socid) { //restriction diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 77eedcd3e34..d25af27f34c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -187,6 +187,7 @@ $arrayfields = array( 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), @@ -470,6 +471,12 @@ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } + +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= ' WHERE c.fk_soc = s.rowid'; $sql .= ' AND c.entity IN ('.getEntity('commande').')'; if ($search_product_category > 0) { @@ -1180,6 +1187,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -1338,6 +1348,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1715,6 +1728,53 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ed61da3592e..03ec879c5ad 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1519,6 +1519,12 @@ class Account extends CommonObject */ public function needIBAN() { + global $conf; + + if (!empty($conf->global->MAIN_IBAN_IS_NEVER_MANDATORY)) { + return 0; + } + $country_code = $this->getCountryCode(); $country_code_in_EEC = array( diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 42e53085ea8..407e8b3cf73 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -251,7 +251,7 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index dccfc852213..1cf964815d5 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -99,7 +99,7 @@ class CashControl extends CommonObject 'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600), 'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated')), ); /** diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5c21f2b9539..5d81da90088 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5077,6 +5077,16 @@ if ($action == 'create') { print ''.price($resteapayeraffiche).''; print ' '; + // Remainder to pay Multicurrency + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + print $langs->trans('MulticurrencyRemainderToPay'); + print ''; + print ''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT')).''; + } + // Retained warranty : usualy use on construction industry if (!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty) { // Billed - retained warranty diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9cbfb33e5bd..eb380a4a212 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3869,7 +3869,7 @@ class Facture extends CommonInvoice global $conf, $langs; if ($this->module_source == 'takepos') { - $langs->load('cashdesk@cashdesk'); + $langs->load('cashdesk'); $moduleName = 'takepos'; $moduleSourceName = 'Takepos'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f25b2b05975..0becff9e54b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -234,6 +234,7 @@ $arrayfields = array( 'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140), 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), + 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170), 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171), 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180), @@ -1257,6 +1258,9 @@ if ($resql) { print ''; print ''; } + if (!empty($arrayfields['sale_representative']['checked'])) { + print ''; + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''; print ''; @@ -1449,6 +1453,9 @@ if ($resql) { if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['sale_representative']['checked'])) { + print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + } if (!empty($arrayfields['f.retained_warranty']['checked'])) { print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); } @@ -1939,6 +1946,53 @@ if ($resql) { } } + if (!empty($arrayfields['sale_representative']['checked'])) { + // Sales representatives + print ''; + if ($obj->socid > 0) { + $listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user); + if ($listsalesrepresentatives < 0) { + dol_print_error($db); + } + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->statut = $val['statut']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + //print '
': + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + //print '
'; + } + } + //else print $langs->trans("NoSalesRepresentativeAffected"); + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['f.retained_warranty']['checked'])) { print ''.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').''; } diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 8368bffbab2..5a93f3fde33 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; // Load translation files required by the page $langs->loadLangs(array('products', 'contracts', 'companies')); +$optioncss = GETPOST('optioncss', 'aZ09'); + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -58,7 +60,6 @@ $search_name = GETPOST("search_name", 'alpha'); $search_contract = GETPOST("search_contract", 'alpha'); $search_service = GETPOST("search_service", 'alpha'); $search_status = GETPOST("search_status", 'alpha'); -$statut = GETPOST('statut', 'int') ?GETPOST('statut', 'int') : 1; $search_product_category = GETPOST('search_product_category', 'int'); $socid = GETPOST('socid', 'int'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractservicelist'.$mode; @@ -412,16 +413,16 @@ if (!empty($filter_op2) && $filter_op2 != -1) { if (!empty($filter_opcloture) && $filter_opcloture != -1) { $param .= '&filter_opcloture='.urlencode($filter_opcloture); } -if ($filter_dateouvertureprevue != '') { +if ($filter_dateouvertureprevue_start != '') { $param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; } -if ($filter_date1 != '') { +if ($filter_date1_start != '') { $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; } -if ($filter_date2 != '') { +if ($filter_date2_start != '') { $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; } -if ($filter_datecloture != '') { +if ($filter_datecloture_start != '') { $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; } if ($optioncss != '') { diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 909178d4fb1..18920da3bc2 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1201,11 +1201,12 @@ abstract class CommonDocGenerator * get extrafield content for pdf writeHtmlCell compatibility * usage for PDF line columns and object note block * - * @param object $object common object - * @param string $extrafieldKey the extrafield key + * @param object $object Common object + * @param string $extrafieldKey The extrafield key + * @param Translate $outputlangs The output langs (if value is __(XXX)__ we use it to translate it). * @return string */ - public function getExtrafieldContent($object, $extrafieldKey) + public function getExtrafieldContent($object, $extrafieldKey, $outputlangs = null) { global $hookmanager; @@ -1341,7 +1342,7 @@ abstract class CommonDocGenerator $field = new stdClass(); $field->rank = intval($extrafields->attributes[$object->table_element]['pos'][$key]); - $field->content = $this->getExtrafieldContent($object, $key); + $field->content = $this->getExtrafieldContent($object, $key, $outputlangs); $field->label = $outputlangs->transnoentities($label); $field->type = $extrafields->attributes[$object->table_element]['type'][$key]; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7f26c83a727..d01b972e0c5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3022,6 +3022,7 @@ abstract class CommonObject */ public function updateRangOfLine($rowid, $rang) { + global $hookmanager; $fieldposition = 'rang'; // @todo Rename 'rang' into 'position' if (in_array($this->table_element_line, array('bom_bomline', 'ecm_files', 'emailcollector_emailcollectoraction'))) { $fieldposition = 'position'; @@ -3034,6 +3035,9 @@ abstract class CommonObject if (!$this->db->query($sql)) { dol_print_error($this->db); } + $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); + $action=''; + $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -4117,7 +4121,7 @@ abstract class CommonObject $sql .= " SET ".$fieldstatus." = ".((int) $status); // If status = 1 = validated, update also fk_user_valid if ($status == 1 && $elementTable == 'expensereport') { - $sql .= ", fk_user_valid = ".$user->id; + $sql .= ", fk_user_valid = ".((int) $user->id); } $sql .= " WHERE rowid=".((int) $elementId); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 42ffcbb2f6d..8e69a4b49df 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4724,7 +4724,7 @@ class Form $more .= '
'."\n"; foreach ($formquestion as $key => $input) { if (is_array($input) && !empty($input)) { - $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead. $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 2e0a71460ba..bb37293354e 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -515,7 +515,7 @@ class Notify case 'SHIPPING_VALIDATE': $link = ''.$newref.''; $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); - $object_type = 'expedition'; + $object_type = 'shipping'; $labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link); break; diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 9996d09f036..50e013ce8b7 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -214,13 +214,14 @@ interface Database /** * Execute a SQL request and return the resultset * - * @param string $query SQL query string - * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). - * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. - * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param string $query SQL query string + * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). + * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. + * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode * @return resource Resultset of answer */ - public function query($query, $usesavepoint = 0, $type = 'auto'); + public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0); /** * Connexion to server @@ -493,8 +494,8 @@ interface Database /** * Returns the current line (as an object) for the resultset cursor * - * @param resource $resultset Cursor of the desired request - * @return Object Object result line or false if KO or end of cursor + * @param resource $resultset Cursor of the desired request + * @return Object Object result line or false if KO or end of cursor */ public function fetch_object($resultset); // phpcs:enable diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 36974d29218..bef1209dd84 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -262,9 +262,10 @@ class DoliDBMysqli extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode * @return bool|mysqli_result Resultset of answer */ - public function query($query, $usesavepoint = 0, $type = 'auto') + public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) { global $conf, $dolibarr_main_db_readonly; @@ -289,9 +290,9 @@ class DoliDBMysqli extends DoliDB if (!$this->database_name) { // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) - $ret = $this->db->query($query); + $ret = $this->db->query($query, $result_mode); } else { - $ret = $this->db->query($query); + $ret = $this->db->query($query, $result_mode); } if (!preg_match("/^COMMIT/i", $query) && !preg_match("/^ROLLBACK/i", $query)) { @@ -316,7 +317,7 @@ class DoliDBMysqli extends DoliDB // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * Returns the current line (as an object) for the resultset cursor * * @param mysqli_result $resultset Curseur de la requete voulue * @return object|null Object result line or null if KO or end of cursor diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 0513226ac31..5245a9dac3c 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -494,9 +494,10 @@ class DoliDBPgsql extends DoliDB * @param string $query SQL query string * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode (not used with pgsql) * @return false|resource Resultset of answer */ - public function query($query, $usesavepoint = 0, $type = 'auto') + public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) { global $conf, $dolibarr_main_db_readonly; @@ -570,7 +571,7 @@ class DoliDBPgsql extends DoliDB // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * Returns the current line (as an object) for the resultset cursor * * @param resource $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 395155973be..53bcb6806dc 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -393,9 +393,10 @@ class DoliDBSqlite3 extends DoliDB * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode (not used with sqlite) * @return SQLite3Result Resultset of answer */ - public function query($query, $usesavepoint = 0, $type = 'auto') + public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) { global $conf, $dolibarr_main_db_readonly; @@ -504,7 +505,7 @@ class DoliDBSqlite3 extends DoliDB // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * Returns the current line (as an object) for the resultset cursor * * @param SQLite3Result $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 683b92fb8d9..ef5b3eab061 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1528,10 +1528,11 @@ function complete_elementList_with_modules(&$elementList) * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) - * @param string $helptext Help + * @param string $helptext Tooltip help to use for the column name of values + * @param string $text Text to use for the column name of values * @return void */ -function form_constantes($tableau, $strictw3c = 0, $helptext = '') +function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Value') { global $db, $langs, $conf, $user; global $_Avery_Labels; @@ -1552,7 +1553,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') print ''; print ''.$langs->trans("Description").''; print ''; - $text = $langs->trans("Value"); + $text = $langs->trans($text); print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext'); print ''; if (empty($strictw3c)) { diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 54bbc0a7666..12022ed178c 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/lib/barcode.lib.php - * \brief Set of functions used for barcode generation + * \brief Set of functions used for barcode generation (internal lib, also code 'phpbarcode') * \ingroup core */ @@ -69,7 +69,7 @@ if (defined('PHP-BARCODE_PATH_COMMAND')) { * Print barcode * * @param string $code Code - * @param string $encoding Encoding + * @param string $encoding Encoding ('EAN13', 'ISBN', 'C128', 'UPC', 'CBR', 'QRCODE', 'DATAMATRIX', 'ANY'...) * @param integer $scale Scale * @param string $mode 'png' or 'jpg' ... * @return array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message @@ -149,12 +149,10 @@ function barcode_encode($code, $encoding) dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding); $bars = barcode_encode_genbarcode($code, $encoding); } else { - print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")
\n"; + print "barcode_encode needs an external program for encodings other then EAN/ISBN (code=".dol_escape_htmltag($code).", encoding=".dol_escape_htmltag($encoding).")
\n"; print "\n"; print "
\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a9cb45e06fb..f692f4944f8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6860,6 +6860,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if ($onlykey) { $substitutionarray['__ID__'] = '__ID__'; $substitutionarray['__REF__'] = '__REF__'; + $substitutionarray['__NEWREF__'] = '__NEWREF__'; $substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__'; $substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__'; $substitutionarray['__NOTE_PUBLIC__'] = '__NOTE_PUBLIC__'; @@ -6940,6 +6941,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } else { $substitutionarray['__ID__'] = $object->id; $substitutionarray['__REF__'] = $object->ref; + $substitutionarray['__NEWREF__'] = $object->newref; $substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null); @@ -7183,6 +7185,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'supplier_proposal') { $substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id; } + if (is_object($object) && $object->element == 'shipping') { + $substitutionarray['__URL_SHIPMENT__'] = DOL_MAIN_URL_ROOT."/expedition/card.php?id=".$object->id; + } } if (is_object($object) && $object->element == 'action') { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4821bfde2b9..c2257cd20fe 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1357,12 +1357,15 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); } - // Description short of product line - $libelleproduitservice = $label; - if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) { - $libelleproduitservice = ''.$libelleproduitservice.''; + if (empty($conf->global->PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES)) { + // Description short of product line + $libelleproduitservice = $label; + if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) { + $libelleproduitservice = ''.$libelleproduitservice.''; + } } + // Add ref of subproducts if (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) { $prodser->get_sousproduits_arbo(); diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index fe36f7604c2..443e3f436f8 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/modules/barcode/doc/phpbarcode.modules.php * \ingroup barcode - * \brief File with class to generate barcode images using php barcode generator + * \brief File with class to generate barcode images using php internal lib barcode generator */ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php'; @@ -126,7 +126,7 @@ class modPhpbarcode extends ModeleBarCode * * @param string $code Value to encode * @param string $encoding Mode of encoding - * @param string $readable Code can be read + * @param string $readable Code can be read (What is this ? is this used ?) * @param integer $scale Scale * @param integer $nooutputiferror No output if error * @return int <0 if KO, >0 if OK @@ -163,7 +163,7 @@ class modPhpbarcode extends ModeleBarCode if (!is_array($result)) { $this->error = $result; if (empty($nooutputiferror)) { - print $this->error; + print dol_escape_htmltag($this->error); } return -1; } diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index df9ec39546d..ed32667a67e 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -100,7 +100,7 @@ class modTcpdfbarcode extends ModeleBarCode * * @param string $code Value to encode * @param string $encoding Mode of encoding - * @param string $readable Code can be read + * @param string $readable Code can be read (What is this ? is this used ?) * @param integer $scale Scale (not used with this engine) * @param integer $nooutputiferror No output if error (not used with this engine) * @return int <0 if KO, >0 if OK diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 263f502e10d..be0b9f3c6fe 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1356,7 +1356,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); - if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1420,10 +1420,12 @@ class pdf_einstein extends ModelePDFCommandes } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index e3d77bfaca8..7e04445ea15 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -726,7 +726,7 @@ class pdf_eratosthene extends ModelePDFCommandes if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } @@ -1538,7 +1538,7 @@ class pdf_eratosthene extends ModelePDFCommandes } $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); - if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1606,10 +1606,12 @@ class pdf_eratosthene extends ModelePDFCommandes } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 815cc9b16c1..638c22221bd 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -657,7 +657,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_contrat, "day", false, $outputlangs, true), '', 'R'); - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -695,11 +695,13 @@ class pdf_strato extends ModelePDFContract } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetTextColor(0, 0, 60); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 39ea743c5de..2893234e719 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -539,7 +539,7 @@ class pdf_storm extends ModelePDFDeliveryOrder if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c50367f3407..28d797acffc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -665,7 +665,7 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } @@ -1021,7 +1021,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } - if (!empty($object->thirdparty->code_client)) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1099,10 +1099,12 @@ class pdf_espadon extends ModelePdfExpedition } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 01e49967088..aa6603fa35a 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -127,7 +127,7 @@ class pdf_rouget extends ModelePdfExpedition $this->db = $db; $this->name = "rouget"; - $this->description = $langs->trans("DocumentModelStandardPDF"); + $this->description = $langs->trans("DocumentModelStandardPDF").' ('.$langs->trans("OldImplementation").')'; $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template $this->type = 'pdf'; @@ -971,7 +971,7 @@ class pdf_rouget extends ModelePdfExpedition $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R'); } - if (!empty($object->thirdparty->code_client)) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1049,10 +1049,12 @@ class pdf_rouget extends ModelePdfExpedition } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3cbcd553f74..44b658cc42e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1803,7 +1803,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R'); } - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1862,10 +1862,12 @@ class pdf_crabe extends ModelePDFFactures } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index fe5cc73e5fa..d6b4516695a 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -766,7 +766,7 @@ class pdf_sponge extends ModelePDFFactures if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } @@ -2041,7 +2041,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R'); } - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -2100,10 +2100,12 @@ class pdf_sponge extends ModelePDFFactures } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 1beb42fdc69..37d64c43e17 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -613,7 +613,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R'); - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -651,11 +651,13 @@ class pdf_soleil extends ModelePDFFicheinter } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetTextColor(0, 0, 60); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetTextColor(0, 0, 60); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php deleted file mode 100644 index a128b92ee29..00000000000 --- a/htdocs/core/modules/modCashDesk.class.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * 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 . - */ - -/** - * \defgroup pos Module points of sale - * \brief Module to manage points of sale - * \file htdocs/core/modules/modCashDesk.class.php - * \ingroup pos - * \brief Description and activation file for the module Point Of Sales - */ -include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; - - -/** - * Class to describe and enable module Point Of Sales - */ -class modCashDesk extends DolibarrModules -{ - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - - // Id for module (must be unique). - // Use here a free id (See in Home -> System information -> Dolibarr for list of used module id). - $this->numero = 50100; - // Key text used to identify module (for permission, menus, etc...) - $this->rights_class = 'cashdesk'; - - $this->family = "portal"; - $this->module_position = '59'; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i', '', get_class($this)); - $this->description = "CashDesk module"; - - $this->version = 'deprecated'; - - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto = 'cash-register'; - - // Data directories to create when module is enabled - $this->dirs = array(); - - // Config pages. Put here list of php page names stored in admmin directory used to setup module. - $this->config_page_url = array("cashdesk.php@cashdesk"); - - // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'FR'=>'modBlockedLog'); // List of modules id that must be enabled if this module is enabled - $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->phpmin = array(5, 6); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(2, 4); // Minimum version of Dolibarr required by module - $this->langfiles = array("cashdesk"); - $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') - //$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text') - - // Constants - $this->const = array(); - - // Boxes - $this->boxes = array(); - - // Permissions - $this->rights = array(); - $r = 0; - - $r++; - $this->rights[$r][0] = 50101; - $this->rights[$r][1] = 'Use Point of sale'; - $this->rights[$r][2] = 'a'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'run'; - - // Main menu entries - $this->menus = array(); // List of menus to add - $r = 0; - - // This is to declare the Top Menu entry: - $this->menu[$r] = array('fk_menu'=>0, // Put 0 if this is a top menu - 'type'=>'top', // This is a Top menu entry - 'titre'=>'PointOfSaleShort', - 'mainmenu'=>'cashdesk', - 'leftmenu'=>'', - 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), - 'url'=>'/cashdesk/index.php?user=__USER_LOGIN__', - 'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>900, - 'enabled'=>'$conf->cashdesk->enabled', - 'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules - 'target'=>'pointofsale', - 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both - - $r++; - - // This is to declare a Left Menu entry: - // $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the top menu entry - // 'type'=>'left', // This is a Left menu entry - // 'titre'=>'Title left menu', - // 'mainmenu'=>'mymodule', - // 'url'=>'/comm/action/index2.php', - // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'position'=>100, - // 'perms'=>'$user->rights->mymodule->level1->level2', // Use 'perms'=>'1' if you want your menu with no permission rules - // 'target'=>'', - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - // $r++; - } - - - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - public function init($options = '') - { - $sql = array(); - - // Remove permissions and default values - $this->remove($options); - - return $this->_init($sql, $options); - } -} diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index fbf7927ed1c..eaaf15d40a1 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -87,6 +87,7 @@ class modWorkflow extends DolibarrModules 0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), 1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0), 2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0), + 3=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0), 4=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0), 5=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0), 6=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 2f6c2827b0f..2045683661b 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1523,7 +1523,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R'); - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1587,10 +1587,12 @@ class pdf_azur extends ModelePDFPropales } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 43513ee94e1..7d8ada03ad5 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -737,7 +737,7 @@ class pdf_cyan extends ModelePDFPropales if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } @@ -1634,7 +1634,7 @@ class pdf_cyan extends ModelePDFPropales } $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R'); - if ($object->thirdparty->code_client) { + if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); @@ -1701,10 +1701,12 @@ class pdf_cyan extends ModelePDFPropales } // Show sender name - $pdf->SetXY($posx + 2, $posy + 3); - $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); - $posy = $pdf->getY(); + if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) { + $pdf->SetXY($posx + 2, $posy + 3); + $pdf->SetFont('', 'B', $default_font_size); + $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); + $posy = $pdf->getY(); + } // Show sender information $pdf->SetXY($posx + 2, $posy); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index dc898c98cb5..3e04844119b 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -672,7 +672,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index f1b62676887..8b7ff9ac62c 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -65,7 +65,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if (is_array($crit)) { $crit = implode(' ', $crit); // natural_search() expects a string } elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { - $sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey.' = "'.$db->escape($crit).'")'; + $sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." = '".$db->escape($crit)."')"; continue; } $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 72a08d22494..e5291cab775 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -256,15 +256,20 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - if ($action == 'SHIPPING_VALIDATE') { + if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) { + if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && + ( + (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) || + (!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED')) + ) + ) { $qtyshipped = array(); $qtyordred = array(); require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - //find all shippement on order origin + // Find all shipments on order origin $order = new Commande($this->db); $ret = $order->fetch($object->origin_id); if ($ret < 0) { @@ -309,15 +314,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers $diff_array = array_diff_assoc($qtyordred, $qtyshipped); if (count($diff_array) == 0) { //No diff => mean everythings is shipped - $ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); + $ret = $order->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); if ($ret < 0) { - $this->error = $object->error; - $this->errors = $object->errors; + $this->error = $order->error; + $this->errors = $order->errors; return $ret; } } } } + // classify billed reception if ($action == 'BILL_SUPPLIER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG); diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index af11f4c1d67..85dd3080512 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -288,17 +288,18 @@ class TraceableDB extends DoliDB /** * Execute a SQL request and return the resultset * - * @param string $query SQL query string - * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). - * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. - * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @param string $query SQL query string + * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). + * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. + * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @param int $result_mode Result mode + * @return resource Resultset of answer */ - public function query($query, $usesavepoint = 0, $type = 'auto') + public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0) { $this->startTracing(); - $resql = $this->db->query($query, $usesavepoint, $type); + $resql = $this->db->query($query, $usesavepoint, $type, $result_mode); $this->endTracing($query, $resql); diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 2fbf30b1c70..b6c80feadd4 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -116,7 +116,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0,'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0,'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'),), ); public $rowid; public $ref; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 270c87fb15c..9430d2c52ad 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -480,8 +480,8 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; @@ -491,10 +491,10 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index e8e86a2641a..72d66b7fb87 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -253,8 +253,8 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; @@ -264,10 +264,10 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e938b729f80..ff84e67122c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -471,7 +471,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".$this->socid; } $sql .= " WHERE l.fk_commande = ".$this->id; if ($only_product) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 7b5bbbc50c5..049bcf89c8b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -530,7 +530,8 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->date_end, $this->lines[$i]->array_options, $this->lines[$i]->fk_unit, - $this->lines[$i]->multicurrency_subprice + $this->lines[$i]->multicurrency_subprice, + $this->lines[$i]->ref_supplier ); } else { $this->error = $this->db->lasterror(); @@ -568,7 +569,15 @@ class FactureFournisseur extends CommonInvoice $line->fk_product, 'HT', (!empty($line->info_bits) ? $line->info_bits : ''), - $line->product_type + $line->product_type, + $line->remise_percent, + 0, + $line->date_start, + $line->date_end, + $line->array_options, + $line->fk_unit, + $line->multicurrency_subprice, + $line->ref_supplier ); } else { $this->error = $this->db->lasterror(); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2c847b9a421..09588389cb1 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -721,12 +721,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Description").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print ''.$langs->trans("EatByDate").''; - } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.$langs->trans("SellByDate").''; } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } } else { print ''; print ''; @@ -814,12 +814,12 @@ if ($id > 0 || !empty($ref)) { print $linktoprod; print ""; print ''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print ''; - } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } } else { print ''; print $linktoprod; @@ -827,12 +827,12 @@ if ($id > 0 || !empty($ref)) { print ''; print $langs->trans("ProductDoesNotUseBatchSerial"); print ''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print ''; - } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } } } else { print ''; @@ -901,7 +901,7 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; print ''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc'.$suffix.'month'), GETPOST('dlc'.$suffix.'day'), GETPOST('dlc'.$suffix.'year')); print $form->selectDate($dlcdatesuffix, 'dlc'.$suffix, '', '', 1, ''); @@ -917,8 +917,8 @@ if ($id > 0 || !empty($ref)) { } else { $type = 'dispatch'; $colspan = 7; - $colspan = (!empty($conf->global->PRODUCT_DISABLE_EATBY)) ? --$colspan : $colspan; $colspan = (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) ? --$colspan : $colspan; + $colspan = (!empty($conf->global->PRODUCT_DISABLE_EATBY)) ? --$colspan : $colspan; print ''; print ''; // Qty to dispatch print ''; @@ -1140,12 +1140,12 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("DateDeliveryPlanned").''; if (!empty($conf->productbatch->enabled)) { print ''.$langs->trans("batch_number").''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print ''.$langs->trans("EatByDate").''; - } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.$langs->trans("SellByDate").''; } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.$langs->trans("EatByDate").''; + } } print ''.$langs->trans("QtyDispatched").''; print ''.$langs->trans("Warehouse").''; @@ -1199,16 +1199,20 @@ if ($id > 0 || !empty($ref)) { $lot = new Productlot($db); $lot->fetch(0, $objp->pid, $objp->batch); print ''.$lot->getNomUrl(1).''; - if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { - print ''.dol_print_date($lot->eatby, 'day').''; - } if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.dol_print_date($lot->sellby, 'day').''; } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''.dol_print_date($lot->eatby, 'day').''; + } } else { print ''; - print ''; - print ''; + if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { + print ''; + } } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6b67d0a2dcf..b39041542eb 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3237,6 +3237,17 @@ if ($action == 'create') { print ''; print ''; print ''.price($resteapayeraffiche).''; + + // Remainder to pay Multicurrency + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + print $langs->trans('MulticurrencyRemainderToPay'); + print ''; + print ''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT')).''; + } + print ' '; } else // Credit note { diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index e7fc4014563..155bb564137 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -86,6 +86,9 @@ if (($id > 0) || $ref) { } } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('holidaycard', 'globalcard')); + $cancreate = 0; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->holiday->writeall_advance)) { diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index fe2c42b0d1b..8a294a47e2c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -234,7 +234,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { print ''; print ''.$holidaystatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(-1, 'leave').''; - print ''.dol_escape_htmltag($typeleaves[$obj->fk_type]['label']).''; + print ''.dol_escape_htmltag($langs->trans($typeleaves[$obj->fk_type]['code'])).''; $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index a509768f4b5..c138dc42fdb 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -26,6 +26,7 @@ * \ingroup install * \brief Test if file conf can be modified and if does not exists, test if install process can create it */ + include_once 'inc.php'; global $langs; @@ -74,7 +75,7 @@ if (!empty($useragent)) { $browserversion = $tmp['browserversion']; $browsername = $tmp['browsername']; if ($browsername == 'ie' && $browserversion < 7) { - print 'Error '.$langs->trans("WarningBrowserTooOld")."
\n"; + print 'Error '.$langs->trans("WarningBrowserTooOld")."
\n"; } } @@ -83,13 +84,13 @@ if (!empty($useragent)) { $arrayphpminversionerror = array(5, 5, 0); $arrayphpminversionwarning = array(5, 6, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { // Minimum to use (error if lower) - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); $checksok = 0; // 0=error, 1=warning } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) { // Minimum supported (warning if lower) - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); $checksok = 0; // 0=error, 1=warning } else { - print 'Ok '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray()); + print 'Ok '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray()); } if (empty($force_install_nophpinfo)) { print ' ('.$langs->trans("MoreInformation").')'; @@ -99,58 +100,58 @@ print "
\n"; // Check PHP support for $_GET and $_POST if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) { // We must keep $_GET and $_POST here - print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); + print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; print "
\n"; $checksok = 0; } else { - print 'Ok '.$langs->trans("PHPSupportPOSTGETOk")."
\n"; + print 'Ok '.$langs->trans("PHPSupportPOSTGETOk")."
\n"; } // Check if session_id is enabled if (!function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; $checksok = 0; } else { - print 'Ok '.$langs->trans("PHPSupportSessions")."
\n"; + print 'Ok '.$langs->trans("PHPSupportSessions")."
\n"; } // Check if GD is supported (we need GD for image conversion) if (!function_exists("imagecreate")) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupport", "GD")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "GD")."
\n"; } // Check if Curl is supported if (!function_exists("curl_init")) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupport", "Curl")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "Curl")."
\n"; } // Check if PHP calendar extension is available if (!function_exists("easter_date")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."
\n"; } else { - print 'Ok '.$langs->trans("PHPSupport", "Calendar")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "Calendar")."
\n"; } // Check if UTF8 is supported if (!function_exists("utf8_encode")) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupport", "UTF8")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "UTF8")."
\n"; } @@ -158,19 +159,19 @@ if (!function_exists("utf8_encode")) { if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') { if (!function_exists("locale_get_primary_language") || !function_exists("locale_get_region")) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupport", "Intl")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "Intl")."
\n"; } } if (!class_exists('ZipArchive')) { $langs->load("errors"); - print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."
\n"; + print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } else { - print 'Ok '.$langs->trans("PHPSupport", "ZIP")."
\n"; + print 'Ok '.$langs->trans("PHPSupport", "ZIP")."
\n"; } // Check memory @@ -192,9 +193,9 @@ if ($memmaxorig != '') { } } if ($memmax >= $memrequired || $memmax == -1) { - print 'Ok '.$langs->trans("PHPMemoryOK", $memmaxorig, $memrequiredorig)."
\n"; + print 'Ok '.$langs->trans("PHPMemoryOK", $memmaxorig, $memrequiredorig)."
\n"; } else { - print 'Warning '.$langs->trans("PHPMemoryTooLow", $memmaxorig, $memrequiredorig)."
\n"; + print 'Warning '.$langs->trans("PHPMemoryTooLow", $memmaxorig, $memrequiredorig)."
\n"; } } @@ -244,12 +245,12 @@ if (is_readable($conffile) && filesize($conffile) > 8) { // File is missing and cannot be created if (!file_exists($conffile)) { - print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated", $conffiletoshow); - print "

"; + print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated", $conffiletoshow); + print '

'; print $langs->trans("YouMustCreateWithPermission", $conffiletoshow); - print "

"; + print '


'."\n"; - print $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok'); + print ''.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').''; $err++; } else { if (dol_is_dir($conffile)) { @@ -380,7 +381,7 @@ if (!file_exists($conffile)) { $choice .= '
'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; - // Ok '; + // Ok '; } $choice .= ''; diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 85a2f4703c2..88967664ad8 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -16,10 +16,22 @@ */ +.center { + text-align: center; +} + +.centpercent { + width: 100%; +} + .paddingright { padding-right: 4px; } +.valignmiddle { + vertical-align: middle; +} + .opacitymedium { opacity: 0.5; } @@ -28,6 +40,10 @@ display: inline-block; } +.small { + font-size: 0.9em; +} + body { font-size:14px; font-family: roboto,arial,tahoma,verdana,helvetica; @@ -36,14 +52,14 @@ body { } table.main-inside { - padding-left: 10px; - padding-right: 10px; + /*padding-left: 10px; + padding-right: 10px;*/ padding-bottom: 10px; margin-bottom: 10px; margin-top: 10px; color: #000000; border-top: 1px solid #ccc; - border-bottom: 1px solid #ccc; + /* border-bottom: 1px solid #ccc; */ line-height: 22px; } @@ -418,3 +434,43 @@ a.button:hover { .text-security { -webkit-text-security: disc; } + + + +/* For support section */ + +.tablesupport { + padding: 6px; + width: 500px; +} + +table.login.tablesupport .title { + background: #eee !important; +} + +.blocksupport { + padding: 12px; + /* width: 90%; */ +} + +table.tablesupport { + min-height: 250px; + border: 1px solid #E0E0E0; + background: #FFF; +} + + +/* Force values for small screen 570 */ +@media only screen and (max-width: 570px) +{ + .blocksupport { + width: 90%; + } + + .tablesupport { + padding: 6px; + width: 100%; + } +} + +} diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 274e3b145e0..7e3bea011b2 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -60,3 +60,9 @@ ALTER TABLE llx_product_customer_price MODIFY COLUMN ref_customer varchar(128); -- -- add action trigger INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13); + +ALTER TABLE llx_product ADD COLUMN fk_default_bom integer DEFAULT NULL; + + +DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = 'cashdesk'; + diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 4aad3393137..e89a7658e5a 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -103,5 +103,6 @@ create table llx_product desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, - fk_project integer DEFAULT NULL -- Used when product was generated by a project or is specifif to a project + fk_default_bom integer DEFAULT NULL, + fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project )ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index f54959024a2..e04183baaf8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -241,8 +241,8 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; @@ -252,10 +252,10 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 773695f4601..134cbdf8d9a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1372,7 +1372,7 @@ AccountCodeManager=Options for automatic generation of customer/vendor accountin NotificationsDesc=Email notifications can be sent automatically for some Dolibarr events.
Recipients of notifications can be defined: NotificationsDescUser=* per user, one user at a time. NotificationsDescContact=* per third-party contacts (customers or vendors), one contact at a time. -NotificationsDescGlobal=* or by setting global email addresses in this setup page. +NotificationsDescGlobal=* or by setting global email addresses in the setup page of the module. ModelModules=Document Templates DocumentModelOdt=Generate documents from OpenDocument templates (.ODT / .ODS files from LibreOffice, OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document @@ -1995,8 +1995,10 @@ MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add picture on proposal line -MAIN_PDF_NO_SENDER_FRAME=Hide sender frame -MAIN_PDF_NO_RECIPENT_FRAME=Hide recipent frame +MAIN_PDF_NO_SENDER_FRAME=Hide borders on sender address frame +MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipent address frame +MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code +MAIN_PDF_HIDE_SENDER_NAME=Hide sender/company name in address block PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add electronic sign in PDF @@ -2159,4 +2161,5 @@ DatabasePasswordObfuscated=Database password is obfuscated in conf file DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file APIsAreNotEnabled=APIs modules are not enabled YouShouldSetThisToOff=You should set this to 0 or off -InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s \ No newline at end of file +InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s +OldImplementation=Old implementation diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 86fdfd753a5..80e6c564767 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -42,7 +42,7 @@ AddTable=Add table Place=Place TakeposConnectorNecesary='TakePOS Connector' required OrderPrinters=Add a button to send the order to some given printers, without payment (for example to send an order to a kitchen) -NotAvailableWithBrowserPrinter=Not available when printer for receipt is set to browser: +NotAvailableWithBrowserPrinter=Not available when printer for receipt is set to browser SearchProduct=Search product Receipt=Receipt Header=Header @@ -128,3 +128,4 @@ PrintPaymentMethodOnReceipts=Print payment method on tickets|receipts WeighingScale=Weighing scale ShowPriceHT = Display the column with the price excluding tax (on screen) ShowPriceHTOnReceipt = Display the column with the price excluding tax (on the receipt) +CustomerDisplay=Customer display diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 67a242e640a..a8953bf64a3 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -19,7 +19,7 @@ # ModuleEventOrganizationName = Event Organization EventOrganizationDescription = Event Organization through Module Project -EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page +EventOrganizationDescriptionLong= Manage the organization of an events including conferences, speakers or attendees, with public submission and subscription page # # Menu # diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index bf34efe3f79..ae199f4136b 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -399,3 +399,5 @@ ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination PMPValue=Weighted average price PMPValueShort=WAP +DefaultBOM=Default BOM +DefaultBOMDesc=The default BOM recommended to use to manufacture this product. This field can be set only if nature of product is '%s'. \ No newline at end of file diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 15fd8ef07c2..fafbc6e8d8a 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -13,6 +13,7 @@ descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposal as b descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source sales order as billed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked order) descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source sales order as billed when customer invoice is set to paid (and if the amount of the invoice is the same as the total amount of the linked order) descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source sales order as shipped when a shipment is validated (and if the quantity shipped by all shipments is the same as in the order to update) +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classify linked source sales order as shipped when a shipment is closed (and if the quantity shipped by all shipments is the same as in the order to update) # Autoclassify purchase order descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classify linked source vendor proposal as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked proposal) descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked source purchase order as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked order) diff --git a/htdocs/langs/fr_FR/workflow.lang b/htdocs/langs/fr_FR/workflow.lang index 2af480afa83..13fbbace793 100644 --- a/htdocs/langs/fr_FR/workflow.lang +++ b/htdocs/langs/fr_FR/workflow.lang @@ -13,6 +13,7 @@ descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classer la/les proposition(s) commer descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) facturée(s) à la validation de la facture client (et si le montant de la facture est le même que le montant total des commandes liées) descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) à Facturée quand une facture client est passée à Payé (et si le montant de la facture est identique à la somme des commandes sources) descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classer la commande source à expédiée à la validation d'une expédition (et si les quantités expédiées dans le bon d'expédition sont les même que dans la commande mise à jour) +descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classer la commande source à expédiée à la cloture d'une expédition (et si les quantités expédiées dans le bon d'expédition sont les même que dans la commande mise à jour) # Autoclassify purchase order descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classer la ou les proposition(s) commerciale(s) fournisseur sources facturées quand une facture fournisseur est validée (et si le montant de la facture est le même que le total des propositions sources liées) descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classer la ou les commande(s) fournisseur(s) de source(s) à facturée(s) lorsque la facture fournisseur est validée (et si le montant de la facture est le même que le montant total des commandes liées) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 43457d6620d..1b95a2a0c20 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -645,7 +645,7 @@ class pdf_standard_myobject extends ModelePDFMyObject if (!empty($object->lines[$i]->array_options)) { foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) { if ($this->getColumnStatus($extrafieldColKey)) { - $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey); + $extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); $this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); $nexY = max($pdf->GetY(), $nexY); } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 1e319e18ec2..8f4024342d7 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -293,7 +293,7 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; @@ -303,10 +303,10 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; @@ -344,35 +344,45 @@ $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); */ -$sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + /* This old and fast method to get and count full list returns all record so use a high amount of memory. $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); + */ + /* The slow method does not consume memory on mysql (not tested on pgsql) */ + /*$resql = $db->query($sql, 0, 'auto', 1); + while ($db->fetch_object($resql)) { + $nbtotalofrecords++; + }*/ + /* This fast and low memory method to get and count full list convert the sql into a sql count */ + $sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ee4b64471c3..df5dcba60ad 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -118,7 +118,7 @@ class Mo extends CommonObject 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), ); public $rowid; public $ref; diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index bac3528e642..012b43ff61a 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -235,7 +235,7 @@ foreach ($search as $key => $val) { } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; @@ -245,10 +245,10 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 7b9c0662e53..803fb3bf5b7 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -133,12 +133,12 @@ $arrayfields = array( //'m.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), //'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500) ); -if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { - unset($arrayfields['pl.eatby']); -} if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) { unset($arrayfields['pl.sellby']); } +if (!empty($conf->global->PRODUCT_DISABLE_EATBY)) { + unset($arrayfields['pl.eatby']); +} $objectlist->fields = dol_sort_array($objectlist->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index f5b72dca2d2..e36e94d39c7 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -294,8 +294,8 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) { - if ($search[$key] == '-1' || $search[$key] === '0') { + if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { + if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) { $search[$key] = ''; } $mode_search = 2; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2472c764d7e..f1729b153b9 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -64,13 +64,12 @@ if (!empty($conf->commande->enabled)) { } if (!empty($conf->accounting->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -} -if (!empty($conf->accounting->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; -} -if (!empty($conf->accounting->enabled)) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } +if (!empty($conf->bom->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +} // Load translation files required by the page $langs->loadLangs(array('products', 'other')); @@ -522,6 +521,13 @@ if (empty($reshook)) { $object->finished = null; } + $fk_default_bom = GETPOST('fk_default_bom', 'int'); + if ($fk_default_bom >= 0) { + $object->fk_default_bom = $fk_default_bom; + } else { + $object->fk_default_bom = null; + } + $units = GETPOST('units', 'int'); if ($units > 0) { $object->fk_unit = $units; @@ -1215,8 +1221,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; print ''; print ''; - - print ''; + print ''; // Stock desired level print ''.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; @@ -1246,7 +1251,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1); print ''; } + } + if ($type != 1) { if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { // Brut Weight print ''.$langs->trans("Weight").''; @@ -1782,7 +1789,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $formproduct->selectProductNature('finished', $object->finished); print ''; } + } + if (!$object->isService() && !empty($conf->bom->enabled)) { + print ''.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; + $bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".$object->id; + print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1); + print ''; + } + + if (!$object->isService()) { if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { // Brut Weight print ''.$langs->trans("Weight").''; @@ -2266,7 +2282,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $object->getLibFinished(); print ''; } + } + if (!$object->isService() && !empty($conf->bom->enabled) && $object->finished) { + print ''.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; + if ($object->fk_default_bom) { + $bom_static = new BOM($db); + $bom_static->fetch($object->fk_default_bom); + print $bom_static->getNomUrl(1); + } + print ''; + } + + if (!$object->isService()) { // Brut Weight if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { print ''.$langs->trans("Weight").''; @@ -2417,7 +2445,7 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->d // Define confirmation messages $formquestionclone = array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'size'=>24), + array('type' => 'text', 'name' => 'clone_ref', 'label' => $langs->trans("NewRefForClone"), 'value' => empty($tmpcode) ? $langs->trans("CopyOf").' '.$object->ref : $tmpcode, 'morecss'=>'width150'), array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), ); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 555bc08d03e..64517c25443 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -477,18 +477,13 @@ class FormProduct $filter = array(); $filter['t.active'] = 1; - $result = $productNature->fetchAll( - '', - '', - 0, - 0, - $filter - ); + $result = $productNature->fetchAll('', '', 0, 0, $filter); + if ($result < 0) { dol_print_error($db); return -1; } else { - $return .= ''; if ($showempty || ($selected == '' || $selected == '-1')) { $return .= '