From a8c91069b2fbb595c050dd63db020f5305b8458c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2020 15:24:42 +0200 Subject: [PATCH 01/75] Fix doliwamp installer --- build/exe/doliwamp/Languages/MyEnglish.isl | 1 + build/exe/doliwamp/doliwamp.iss | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index 371e724d6d0..7ad94c4ca86 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -32,6 +32,7 @@ PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go bac FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? +MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open : LaunchNow=Launch Dolibarr now diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 1b79648279c..4a6dca3af01 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -519,7 +519,7 @@ begin // check that we don't try an upgrade (mysql upgrade no supported) //---------------------------------------------- - if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45'+phpVersion+'/bin/mysqld-nt.exe') then + if FileExists (pathWithSlashes+'/bin/mysql/mysql5.0.45/bin/mysqld-nt.exe') then begin MsgBox('An existing installation using an old version of Mysql exists. Sorry, upgrade with this installer is not possible.', mbInformation, MB_OK); Abort(); @@ -588,15 +588,26 @@ begin end; end; + if browser = 'iexplore.exe' then + begin + if FileExists (winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe') then + begin + if MsgBox(CustomMessage('MicrosoftEdgeDetected'),mbConfirmation,MB_YESNO) = IDYES then + begin + browser := winPath+'/SystemApps/Microsoft.MicrosoftEdge_8wekyb3d8bbwe/MicrosoftEdge.exe'; + end; + end; + end; + if browser = 'iexplore.exe' then begin if FileExists (pfPath+'/Internet Explorer/iexplore.exe') then begin - GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer','exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe'); + GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, pfPath+'/Internet Explorer', 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe'); end else begin - GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath,'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe'); + GetOpenFileName(CustomMessage('ChooseDefaultBrowser'), browser, winPath, 'exe files (*.exe)|*.exe|All files (*.*)|*.*' ,'exe'); end; end; From 566c1aaf845abd9de7963bb039f55e1fedd5c081 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 22 Jun 2020 22:54:33 +0200 Subject: [PATCH 02/75] Fix for credit transfer module --- htdocs/compta/facture/prelevement.php | 193 +++++++++++++----- htdocs/core/lib/fourn.lib.php | 22 ++ htdocs/core/lib/invoice.lib.php | 1 - htdocs/fourn/facture/card.php | 16 +- htdocs/fourn/facture/contact.php | 2 +- .../install/mysql/tables/llx_actioncomm.sql | 5 +- htdocs/langs/en_US/banks.lang | 4 +- htdocs/langs/en_US/withdrawals.lang | 3 + 8 files changed, 182 insertions(+), 64 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index bc3762b41ea..2b181e52078 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -29,11 +29,14 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; if (!$user->rights->facture->lire) accessforbidden(); @@ -44,14 +47,18 @@ $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); - $type = GETPOST('type', 'aZ09'); +$mode = GETPOST('mode', 'aZ09'); $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); -$object = new Facture($db); +if ($mode == 'bank-transfer') { + $object = new FactureFournisseur($db); +} else { + $object = new Facture($db); +} // Load object if ($id > 0 || !empty($ref)) @@ -124,13 +131,20 @@ if (empty($reshook)) * View */ +$form = new Form($db); + $now = dol_now(); -$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders'); -$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; +if ($mode == 'bank-transfer') { + $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer'); + $helpurl = ""; +} else { + $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders'); + $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; +} + llxHeader('', $title, $helpurl); -$form = new Form($db); /* *************************************************************************** */ /* */ @@ -156,18 +170,33 @@ if ($object->id > 0) if ($object->paye) $resteapayer = 0; $resteapayeraffiche = $resteapayer; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; - } + if ($mode == 'bank-transfer') { + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } else { + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')"; + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; + } - $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); + $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote, 0, 1); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + } else { + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } else { + $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; + } + + $absolute_discount = $object->thirdparty->getAvailableDiscounts('', $filterabsolutediscount); + $absolute_creditnote = $object->thirdparty->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + } $author = new User($db); if ($object->user_author) @@ -175,20 +204,37 @@ if ($object->id > 0) $author->fetch($object->user_author); } - $head = facture_prepare_head($object); + if ($mode == 'bank-transfer') { + $head = facturefourn_prepare_head($object); + } else { + $head = facture_prepare_head($object); + } - dol_fiche_head($head, 'standingorders', $langs->trans('InvoiceCustomer'), -1, 'bill'); + dol_fiche_head($head, 'standingorders', $title, -1, 'bill'); // Invoice content - - $linkback = ''.$langs->trans("BackToList").''; + if ($mode == 'bank-transfer') { + $linkback = ''.$langs->trans("BackToList").''; + } else { + $linkback = ''.$langs->trans("BackToList").''; + } $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + if ($mode == 'bank-transfer') { + $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + } else { + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + } // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + if ($mode == 'bank-transfer') { + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + } else { + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + } // Project if (!empty($conf->projet->enabled)) { @@ -239,15 +285,26 @@ if ($object->id > 0) // Type print ''.$langs->trans('Type').''; print $object->getLibType(); - if ($object->type == Facture::TYPE_REPLACEMENT) + if ($object->module_source) { + print ' ('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')'; + } + if ($object->type == $object::TYPE_REPLACEMENT) { - $facreplaced = new Facture($db); + if ($mode == 'bank-transfer') { + $facreplaced = new FactureFournisseur($db); + } else { + $facreplaced = new Facture($db); + } $facreplaced->fetch($object->fk_facture_source); print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')'; } - if ($object->type == Facture::TYPE_CREDIT_NOTE) + if ($object->type == $object::TYPE_CREDIT_NOTE) { - $facusing = new Facture($db); + if ($mode == 'bank-transfer') { + $facusing = new FactureFournisseur($db); + } else { + $facusing = new Facture($db); + } $facusing->fetch($object->fk_facture_source); print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; } @@ -261,7 +318,11 @@ if ($object->id > 0) { if ($i == 0) print ' '; else print ','; - $facavoir = new Facture($db); + if ($mode == 'bank-transfer') { + $facavoir = new FactureFournisseur($db); + } else { + $facavoir = new Facture($db); + } $facavoir->fetch($id); print $facavoir->getNomUrl(1); } @@ -280,24 +341,39 @@ if ($object->id > 0) // Discounts print ''.$langs->trans('Discounts').''; - $thirdparty = $object->thirdparty; - $discount_type = 0; + if ($mode == 'bank-transfer') { + //$societe = new Fournisseur($db); + //$result = $societe->fetch($object->socid); + $thirdparty = $object->thirdparty; + $discount_type = 1; + } else { + $thirdparty = $object->thirdparty; + $discount_type = 0; + } $backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id); $cannotApplyDiscount = 1; include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; print ''; + // Label + if ($mode == 'bank-transfer') { + print ''; + print ''.$form->editfieldkey("Label", 'label', $object->label, $object, 0).''; + print ''.$form->editfieldval("Label", 'label', $object->label, $object, 0).''; + print ''; + } + // Date invoice print ''; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('DateInvoice'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) + if ($object->type != $object::TYPE_CREDIT_NOTE) { if ($action == 'editinvoicedate') { @@ -305,12 +381,12 @@ if ($object->id > 0) } else { - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); } } else { - print dol_print_date($object->date, 'daytext'); + print dol_print_date($object->date, 'day'); } print ''; print ''; @@ -320,10 +396,10 @@ if ($object->id > 0) print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) + if ($object->type != $object::TYPE_CREDIT_NOTE) { if ($action == 'editconditions') { @@ -345,18 +421,23 @@ if ($object->id > 0) print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) print ''; print '
'; print $langs->trans('DateMaxPayment'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; print ''; - if ($object->type != Facture::TYPE_CREDIT_NOTE) + if ($object->type != $object::TYPE_CREDIT_NOTE) { + $duedate = $object->date_lim_reglement; + if ($mode == 'bank-transfer') { + $duedate = $object->date_echeance; + } + if ($action == 'editpaymentterm') { - $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm'); + $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $duedate, 'paymentterm'); } else { - print dol_print_date($object->date_lim_reglement, 'daytext'); + print dol_print_date($duedate, 'day'); if ($object->hasDelay()) { print img_warning($langs->trans('Late')); } @@ -559,8 +640,13 @@ if ($object->id > 0) print "\n
\n"; + $buttonlabel = $langs->trans("MakeWithdrawRequest"); + if ($mode == 'bank-transfer') { + $buttonlabel = $langs->trans("MakeBankTransferOrder"); + } + // Add a transfer request - if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0) + if ($object->statut > $object::STATUS_DRAFT && $object->paye == 0 && $num == 0) { if ($resteapayer > 0) { @@ -572,36 +658,39 @@ if ($object->id > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; } else { - print ''.$langs->trans("MakeWithdrawRequest").''; + print ''.$buttonlabel.''; } } else { - print ''.$langs->trans("MakeWithdrawRequest").''; + print ''.$buttonlabel.''; } } else { if ($num == 0) { - if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; - else print ''.$langs->trans("MakeWithdrawRequest").''; + if ($object->statut > $object::STATUS_DRAFT) print ''.$buttonlabel.''; + else print ''.$buttonlabel.''; } - else print ''.$langs->trans("MakeWithdrawRequest").''; + else print ''.$buttonlabel.''; } print "

\n"; - print '
'.$langs->trans("DoStandingOrdersBeforePayments").'

'; - + if ($mode == 'bank-transfer') { + print '
'.$langs->trans("DoCreditTransferBeforePayments").'

'; + } else { + print '
'.$langs->trans("DoStandingOrdersBeforePayments").'

'; + } /* * Withdrawals @@ -614,7 +703,11 @@ if ($object->id > 0) print ''.$langs->trans("DateRequest").''; print ''.$langs->trans("User").''; print ''.$langs->trans("Amount").''; - print ''.$langs->trans("WithdrawalReceipt").''; + if ($mode == 'bank-transfer') { + print ''.$langs->trans("BankTransferReceipt").''; + } else { + print ''.$langs->trans("WithdrawalReceipt").''; + } print ' '; print ''.$langs->trans("DateProcess").''; print ' '; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 3b41f2620b4..8d0e767c943 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -53,6 +53,28 @@ function facturefourn_prepare_head($object) $h++; } + //if ($fac->mode_reglement_code == 'PRE') + if (!empty($conf->paymentbybanktransfer->enabled)) + { + $nbStandingOrders = 0; + $sql = "SELECT COUNT(pfd.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " WHERE pfd.fk_facture_fourn = ".$object->id; + $sql .= " AND pfd.ext_payment_id IS NULL"; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $nbStandingOrders = $obj->nb; + } + else dol_print_error($db); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&mode=bank-transfer'; + $head[$h][1] = $langs->trans('BankTransfer'); + if ($nbStandingOrders > 0) $head[$h][1] .= ''.$nbStandingOrders.''; + $head[$h][2] = 'standingorders'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f081fc94120..077176c6ff9 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -55,7 +55,6 @@ function facture_prepare_head($object) $h++; } - //if ($fac->mode_reglement_code == 'PRE') if (!empty($conf->prelevement->enabled)) { $nbStandingOrders = 0; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a5f15e997de..2113d7ebb12 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2559,14 +2559,6 @@ else // Date print ''.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').''; print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker'); - print ''; - - // Due date - print ''.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').''; - print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); - if ($action != 'editdate_lim_reglement' && $object->hasDelay()) { - print img_warning($langs->trans('Late')); - } print ''; // Default terms of the settlement @@ -2591,6 +2583,14 @@ else print ""; print ''; + // Due date + print ''.$form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker').''; + print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); + if ($action != 'editdate_lim_reglement' && $object->hasDelay()) { + print img_warning($langs->trans('Late')); + } + print ''; + // Mode of payment $langs->load('bills'); print ''; diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index ebe3573bd99..eca47acaef5 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -193,7 +193,7 @@ if ($id > 0 || !empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Type print ''; print ''; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 8d0e767c943..201d74a9ff9 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -68,7 +68,7 @@ function facturefourn_prepare_head($object) if ($obj) $nbStandingOrders = $obj->nb; } else dol_print_error($db); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&mode=bank-transfer'; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&type=bank-transfer'; $head[$h][1] = $langs->trans('BankTransfer'); if ($nbStandingOrders > 0) $head[$h][1] .= ''.$nbStandingOrders.''; $head[$h][2] = 'standingorders'; @@ -233,8 +233,6 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierorderdet'; $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); $head[$h][2] = 'supplierinvoice'; From 5e259d26ab3cbe4b0eebfa010107f695dc93d466 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 15:20:42 +0200 Subject: [PATCH 57/75] FIX takepos hook can add more than 1 button within 1 module --- htdocs/takepos/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 63bbc5d1808..51358e24080 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,8 +932,14 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { +if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { +$menus[$r++] = $reshook; + } +} else { $menus[$r++] = $reshook; } +} if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From 92f4744d11c49d2ec6a5dede2c75920a54f9a0fa Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Jul 2020 13:22:43 +0000 Subject: [PATCH 58/75] Fixing style errors. --- htdocs/takepos/index.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 51358e24080..af9c3062ba3 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,13 +932,13 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { -if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { -$menus[$r++] = $reshook; - } -} else { - $menus[$r++] = $reshook; -} + if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { + $menus[$r++] = $reshook; + } + } else { + $menus[$r++] = $reshook; + } } if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From cc132775f3a896a63e0746bf3a4c966b79a048aa Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 16:18:19 +0200 Subject: [PATCH 59/75] FIX non numeric value on comm/car.php --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4a97dc0f98c..9b385ea7ead 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -943,7 +943,7 @@ if ($object->id > 0) $late = ''; foreach ($contrat->lines as $line) { if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { - if (($line->date_fin_validite + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); + if (((!empty($line->date_fin_validite)?$line->date_fin_validite:0) + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); } } From 92a36dbeee93b6387bd32394b83e10e08f22e5df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 60/75] FIX Use of office365 TLS with SMTPs method. --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 51e375c5279..09a1f7f2949 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host = 'tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -565,6 +565,8 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From 324c8e9b54930f2a0fc95e0cc8659a59f5fe2620 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 61/75] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index df7647b330c..9c071a36f23 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -568,6 +568,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From d3c23428d5cf773172ebeb573c234c1f10a12cc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 62/75] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f978fd47fba..bce175b3872 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -555,6 +555,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From ae0c73898098ab949fb1a9eb80358fcfb941f07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 19:42:28 +0200 Subject: [PATCH 63/75] FIX Entry from stripe intent were reported into SEPA payments FIX Label of popup on thirdparty FIX Missing the tooltip when creating bank account --- htdocs/compta/paymentbybanktransfer/index.php | 9 +- .../class/bonprelevement.class.php | 156 +++++++++++------- htdocs/compta/prelevement/create.php | 20 ++- htdocs/compta/prelevement/index.php | 14 +- htdocs/societe/class/societe.class.php | 20 +-- htdocs/societe/paymentmodes.php | 17 +- 6 files changed, 155 insertions(+), 81 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 792507c56fd..1fc6c53cf99 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture_fourn = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -195,7 +197,8 @@ if ($result) print"\n\n"; print '
'; print '
'.$langs->trans('Type').''; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 8c50964eb59..f335a93cfeb 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -17,7 +17,8 @@ -- along with this program. If not, see . -- -- --- Actions commerciales +-- Table of events and actions (past and to do). +-- This is also the table to track events on other Dolibarr objects. -- ======================================================================== create table llx_actioncomm @@ -40,7 +41,7 @@ create table llx_actioncomm fk_soc integer, fk_contact integer, fk_parent integer NOT NULL default 0, - fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into another table) + fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into table 'actioncomm_resources') fk_user_done integer, -- user id of user that has made action (deprecated) transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources. diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 17ebc2ff7ed..7a36346733f 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -105,8 +105,8 @@ SupplierInvoicePayment=Vendor payment SubscriptionPayment=Subscription payment WithdrawalPayment=Debit payment order SocialContributionPayment=Social/fiscal tax payment -BankTransfer=Bank transfer -BankTransfers=Bank transfers +BankTransfer=Credit transfer +BankTransfers=Credit transfers MenuBankInternalTransfer=Internal transfer TransferDesc=Transfer from one account to another, Dolibarr will write two records (a debit in source account and a credit in target account). The same amount (except sign), label and date will be used for this transaction) TransferFrom=From diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index c80db907a84..bea89f1d5d0 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -40,6 +40,7 @@ CreditTransferStatistics=Credit transfer statistics Rejects=Rejects LastWithdrawalReceipt=Latest %s direct debit receipts MakeWithdrawRequest=Make a direct debit payment request +MakeBankTransferOrder=Make a credit transfer request WithdrawRequestsDone=%s direct debit payment requests recorded ThirdPartyBankCode=Third-party bank code NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. @@ -93,6 +94,7 @@ WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your cou ShowWithdraw=Show Direct Debit Order IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. +DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to manage the credit transfer payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. WithdrawalFile=Withdrawal file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null @@ -103,6 +105,7 @@ RUMLong=Unique Mandate Reference RUMWillBeGenerated=If empty, a UMR (Unique Mandate Reference) will be generated once the bank account information is saved. WithdrawMode=Direct debit mode (FRST or RECUR) WithdrawRequestAmount=Amount of Direct debit request: +BankTransferAmount=Amount of Credit Transfer request: WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty amount. SepaMandate=SEPA Direct Debit Mandate SepaMandateShort=SEPA Mandate From 4d2cbf700642ce9c08fcb38261e47303a30586c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 11:27:40 +0200 Subject: [PATCH 03/75] Fix alert picto of expired services not visible Fix CSS --- htdocs/comm/card.php | 27 +++++++++++++------- htdocs/core/boxes/box_services_contracts.php | 10 ++++++-- htdocs/fourn/card.php | 2 +- htdocs/theme/eldy/global.inc.php | 5 ++++ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4ff16cd7c03..4a97dc0f98c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -86,6 +86,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('thirdpartycomm', 'globalcard')); +$now = dol_now(); /* @@ -580,7 +581,7 @@ if ($object->id > 0) // Lien recap $boxstat .= '
'; $boxstat .= ''; - $boxstat .= '\n"; @@ -898,11 +898,11 @@ if ($object->id > 0) } /* - * Latest linked contracts + * Latest contracts */ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { - $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup"; + $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= " WHERE c.fk_soc = s.rowid "; $sql .= " AND s.rowid = ".$object->id; @@ -921,7 +921,7 @@ if ($object->id > 0) print '
'; + $boxstat .= '
'; if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { @@ -664,7 +665,6 @@ if ($object->id > 0) print $boxstat; - $now = dol_now(); /* * Latest proposals @@ -677,7 +677,7 @@ if ($object->id > 0) $sql .= ", p.tva as total_tva"; $sql .= ", p.total as total_ttc"; $sql .= ", p.ref, p.ref_client, p.remise"; - $sql .= ", p.datep as dp, p.fin_validite as datelimite"; + $sql .= ", p.datep as dp, p.fin_validite as date_limit"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql .= " AND s.rowid = ".$object->id; @@ -716,7 +716,7 @@ if ($object->id > 0) $propal_static->total_tva = $objp->total_tva; $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); - if (($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1) { + if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) { print " ".img_warning(); } print ''.dol_print_date($db->jdate($objp->dp), 'day')."
'; print ''; - print ''; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 1a13eb2edb9..193d352ae35 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -703,9 +703,16 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql .= " WHERE f.fk_statut = 1"; - $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND f.rowid = pfd.fk_facture"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } + if ($mode != 'bank-transfer') { + $sql .= " AND f.rowid = pfd.fk_facture"; + } else { + $sql .= " AND f.rowid = pfd.fk_facture_fourn"; + } $sql .= " AND f.paye = 0"; $sql .= " AND pfd.traite = 0"; $sql .= " AND f.total_ttc > 0"; @@ -744,16 +751,16 @@ class BonPrelevement extends CommonObject /** * Get number of invoices to withdrawal * - * @param string $mode 'direct-debit' or 'bank-transfer' + * @param string $type 'direct-debit' or 'bank-transfer' * @return int '; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index eaec6d92f16..72c318a1024 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -94,7 +94,7 @@ print '
'; + print ''; @@ -937,15 +937,24 @@ if ($object->id > 0) $contrat->ref = $objp->ref ? $objp->ref : $objp->id; $contrat->ref_customer = $objp->refcus; $contrat->ref_supplier = $objp->refsup; + $contrat->statut = $objp->contract_status; $contrat->fetch_lines(); + $late = ''; + foreach ($contrat->lines as $line) { + if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { + if (($line->date_fin_validite + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); + } + } + print ''; print '\n"; print '\n"; - print '\n"; - print '\n"; + //print '\n"; + print '\n"; print ''; print ''; // Label - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''; print ''; print ''; @@ -427,7 +427,7 @@ if ($object->id > 0) if ($object->type != $object::TYPE_CREDIT_NOTE) { $duedate = $object->date_lim_reglement; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $duedate = $object->date_echeance; } @@ -488,7 +488,7 @@ if ($object->id > 0) print ''; $title = 'CustomerIBAN'; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $title = 'SupplierIBAN'; } print ''; print ''; print ''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''; } else { print ''; @@ -723,7 +724,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; $sql .= " pfd.date_traite as date_traite, pfd.amount,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -743,14 +744,29 @@ if ($object->id > 0) { $i = 0; + $tmpuser = new User($db); + $num = $db->num_rows($result); while ($i < $num) { $obj = $db->fetch_object($result_sql); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; + print '\n"; - print ''; + + print ''; + print ''; print ''; print ''; @@ -758,7 +774,7 @@ if ($object->id > 0) print ''; print ''; @@ -778,7 +794,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,"; $sql .= " pb.ref,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -798,15 +814,27 @@ if ($object->id > 0) $numclosed = $num; $i = 0; + $tmpuser = new User($db); + while ($i < $num) { $obj = $db->fetch_object($result); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; print '\n"; - print ''; + print ''; print ''; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 6172b3f1284..792507c56fd 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -94,11 +94,11 @@ print '
'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).''; print ''; //print ''; print '
'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllContracts").''.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print $contrat->getNomUrl(1, 12); + print $late; print "'.dol_trunc($objp->refsup, 12)."'.dol_print_date($db->jdate($objp->dc), 'day')."'.dol_print_date($db->jdate($objp->dcon), 'day')."'.dol_print_date($db->jdate($objp->dc), 'day')."'.dol_print_date($db->jdate($objp->dcon), 'day')." '; print $contrat->getLibStatut(4); diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 7167097672b..9d96d11f64d 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,"; - $sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,"; + $sql .= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type, cd.date_fin_validite as date_line,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity, p.tobuy, p.tosell"; $sql .= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; @@ -113,6 +113,8 @@ class box_services_contracts extends ModeleBoxes while ($i < $num) { + $late = ''; + $objp = $this->db->fetch_object($result); $datem = $this->db->jdate($objp->datem); @@ -124,11 +126,11 @@ class box_services_contracts extends ModeleBoxes $contractlinestatic->product_id = $objp->product_id; $contractlinestatic->product_ref = $objp->product_ref; - $contractstatic->statut = $objp->contract_status; $contractstatic->id = $objp->rowid; $contractstatic->ref = $objp->ref; $contractstatic->ref_customer = $objp->ref_customer; $contractstatic->ref_supplier = $objp->ref_supplier; + $contractstatic->statut = $objp->contract_status; $thirdpartytmp->name = $objp->name; $thirdpartytmp->id = $objp->socid; @@ -140,6 +142,9 @@ class box_services_contracts extends ModeleBoxes $thirdpartytmp->code_compta = $objp->code_compta; $thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur; + $dateline = $this->db->jdate($objp->date_line); + if ($contractstatic->statut == Contrat::STATUS_VALIDATED && $objp->statut == ContratLigne::STATUS_OPEN && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); + // Multilangs if (!empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on { @@ -214,6 +219,7 @@ class box_services_contracts extends ModeleBoxes $this->info_box_contents[$i][] = array( 'td' => '', 'text' => dol_print_date($datem, 'day'), + 'text2'=> $late, ); $this->info_box_contents[$i][] = array( diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 6470b7db313..b467fdbd366 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -358,7 +358,7 @@ if ($object->id > 0) // Lien recap $boxstat .= '
'; $boxstat .= ''; - $boxstat .= ''; if ($total_revenue_ht) { print ''; print ''; - print ''; + print ''; print ''; print ''; } From 1762e10e69f365f93be32080122b5f5ebdeb215c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 09:55:10 +0200 Subject: [PATCH 08/75] Fix return code not returned --- htdocs/modulebuilder/template/scripts/mymodule.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 02024759058..009dcabaafd 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -53,7 +53,10 @@ if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/master.i if (!$res && file_exists("../master.inc.php")) $res = @include "../master.inc.php"; if (!$res && file_exists("../../master.inc.php")) $res = @include "../../master.inc.php"; if (!$res && file_exists("../../../master.inc.php")) $res = @include "../../../master.inc.php"; -if (!$res) die("Include of master fails"); +if (!$res) { + print "Include of master fails"; + exit(-1); +} // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. From de62037ba51f7de09841208e8fa36703b863c711 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 12:58:10 +0200 Subject: [PATCH 09/75] Fix signed only in margin calculation of project --- htdocs/comm/propal/class/propal.class.php | 4 +++- htdocs/core/class/html.form.class.php | 2 +- htdocs/langs/en_US/propal.lang | 1 + htdocs/projet/element.php | 25 +++++++++++++++-------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3c7cfe0006c..0101805cd88 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1537,7 +1537,9 @@ class Propal extends CommonObject $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; - $this->statut = (int) $obj->fk_statut; + + $this->status = (int) $obj->fk_statut; + $this->statut = $this->status; // deprecated $this->statut_libelle = $obj->statut_label; $this->datec = $this->db->jdate($obj->datec); // TODO deprecated diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c38e69eaa50..447f9569517 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4264,7 +4264,7 @@ class Form elseif ($input['type'] == 'select') { $more .= '
'; - if (!empty($input['label'])) $more .= $input['label'].'
'; + if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more .= '
'."\n"; } diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 71d6857c909..273996ab1b1 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,3 +84,4 @@ DefaultModelPropalClosed=Default template when closing a business proposal (unbi ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by +SignedOnly=Signed only diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2566dcb104d..c6932e34f45 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (!empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -635,10 +635,10 @@ foreach($listofreferent as $key => $value) if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'add') { if ($margin == 'add') { - $tooltiponprofitplus.=' + '.$name."
\n"; + $tooltiponprofitplus.=' > '.$name." (+)
\n"; } if ($margin == 'minus') { - $tooltiponprofitminus.=' - '.$name."
\n"; + $tooltiponprofitminus.=' > '.$name." (-)
\n"; } } } @@ -693,7 +693,7 @@ foreach ($listofreferent as $key => $value) } if ($key == 'propal') { - if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal = false; // Refused proposal must not be included in total + if ($element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedfortotal = false; // Only signed proposal must not be included in total } if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); @@ -777,7 +777,8 @@ foreach ($listofreferent as $key => $value) // Each element with at least one line is output $qualifiedforfinalprofit = true; if ($key == 'intervention' && empty($conf->global->PROJECT_INCLUDE_INTERVENTION_AMOUNT_IN_PROFIT)) $qualifiedforfinalprofit = false; - //var_dump($key); + if ($key == 'propal' && $element->status != Propal::STATUS_SIGNED && $element->status != Propal::STATUS_BILLED) $qualifiedforfinalprofit = false; + //var_dump($key.' '.$qualifiedforfinalprofit); // Calculate margin if ($qualifiedforfinalprofit) @@ -803,13 +804,19 @@ foreach ($listofreferent as $key => $value) print '
'; // Amount HT print ''; // Amount TTC print ''; print ''; } From 2865d6bd1592aab50301ed8763831694665fee6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Jun 2020 13:39:00 +0200 Subject: [PATCH 10/75] Fix set of free product --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0fb1aff011d..2c54d4540b6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -180,7 +180,7 @@ if ($nolinesbefore) { echo ''; @@ -741,7 +749,7 @@ if ($object->id > 0) $obj = $db->fetch_object($result_sql); print ''; - print '\n"; + print '\n"; print ''; print ''; print ''; @@ -750,7 +758,7 @@ if ($object->id > 0) print ''; print ''; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index c37ece437d4..cb7ce67d923 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -687,6 +687,160 @@ abstract class CommonInvoice extends CommonObject return $datelim; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Create a withdrawal request for a direct debit order or a credit transfer order. + * Use the remain to pay excluding all existing open direct debit requests. + * + * @param User $fuser User asking the direct debit transfer + * @param float $amount Amount we request direct debit for + * @param string $type 'direct-debit' or 'bank-transfer' + * @param string $sourcetype Source ('facture' or 'supplier_invoice') + * @return int <0 if KO, >0 if OK + */ + public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture') + { + // phpcs:enable + global $conf; + + $error = 0; + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + + if ($this->statut > self::STATUS_DRAFT && $this->paye == 0) + { + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $bac = new CompanyBankAccount($this->db); + $bac->fetch(0, $this->socid); + + $sql = 'SELECT count(*)'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; + if ($type == 'bank-transfer') { + $sql .= ' WHERE fk_facture_fourn = '.$this->id; + } else { + $sql .= ' WHERE fk_facture = '.$this->id; + } + $sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments + $sql .= ' AND traite = 0'; + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $row = $this->db->fetch_row($resql); + if ($row[0] == 0) + { + $now = dol_now(); + + $totalpaye = $this->getSommePaiement(); + $totalcreditnotes = $this->getSumCreditNotesUsed(); + $totaldeposits = $this->getSumDepositsUsed(); + //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits; + + // We can also use bcadd to avoid pb with floating points + // For example print 239.2 - 229.3 - 9.9; does not return 0. + //$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); + //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); + if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT'); + + if (is_numeric($amount) && $amount != 0) + { + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande('; + if ($type == 'bank-transfer') { + $sql .= 'fk_facture_fourn, '; + } else { + $sql .= 'fk_facture, '; + } + $sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, entity)'; + $sql .= ' VALUES ('.$this->id; + $sql .= ",'".price2num($amount)."'"; + $sql .= ",'".$this->db->idate($now)."'"; + $sql .= ",".$fuser->id; + $sql .= ",'".$this->db->escape($bac->code_banque)."'"; + $sql .= ",'".$this->db->escape($bac->code_guichet)."'"; + $sql .= ",'".$this->db->escape($bac->number)."'"; + $sql .= ",'".$this->db->escape($bac->cle_rib)."'"; + $sql .= ",'".$this->db->escape($sourcetype)."'"; + $sql .= ",".$conf->entity; + $sql .= ")"; + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::demandeprelevement Erreur'); + $error++; + } + } + else + { + $this->error = 'WithdrawRequestErrorNilAmount'; + dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount'); + $error++; + } + + if (!$error) + { + // Force payment mode of invoice to withdraw + $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement', 'code', 'id', 1); + if ($payment_mode_id > 0) + { + $result = $this->setPaymentMethods($payment_mode_id); + } + } + + if ($error) return -1; + return 1; + } + else + { + $this->error = "A request already exists"; + dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); + return 0; + } + } + else + { + $this->error = $this->db->error(); + dol_syslog(get_class($this).'::demandeprelevement Erreur -2'); + return -2; + } + } + else + { + $this->error = "Status of invoice does not allow this"; + dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id"); + return -3; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Remove a direct debit request or a credit transfer request + * + * @param User $fuser User making delete + * @param int $did ID of request to delete + * @return int <0 if OK, >0 if KO + */ + public function demande_prelevement_delete($fuser, $did) + { + // phpcs:enable + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; + $sql .= ' WHERE rowid = '.$did; + $sql .= ' AND traite = 0'; + if ($this->db->query($sql)) + { + return 0; + } + else + { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error); + return -1; + } + } } diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 1e562909360..dccc80b1918 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -440,6 +440,8 @@ BankAccountNumberKey=Checksum Residence=Address IBANNumber=IBAN account number IBAN=IBAN +CustomerIBAN=IBAN of customer +SupplierIBAN=IBAN of vendor BIC=BIC/SWIFT BICNumber=BIC/SWIFT code ExtraInfos=Extra infos diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index bea89f1d5d0..49c9f8b5921 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -131,7 +131,7 @@ ICS=Creditor Identifier CI END_TO_END="EndToEndId" SEPA XML tag - Unique id assigned per transaction USTRD="Unstructured" SEPA XML tag ADDDAYS=Add days to Execution Date - +NoDefaultIBANFound=No default IBAN found for this third party ### Notifications InfoCreditSubject=Payment of direct debit payment order %s by the bank InfoCreditMessage=The direct debit payment order %s has been paid by the bank
Data of payment: %s From bbb8c9418e09888d2b955468b47165fc49bae256 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jun 2020 11:49:20 +0200 Subject: [PATCH 13/75] Fix bad property --- htdocs/core/boxes/box_shipments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 8908f52640c..61942d03f45 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -103,10 +103,10 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql .= " WHERE e.entity = ".$conf->entity; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; $sql .= $this->db->plimit($max, 0); From 18c23680f7822387735e27141e82444677dcf571 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jun 2020 12:17:06 +0200 Subject: [PATCH 14/75] Fix bad object --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 5b3ddefa0f5..f35c17d375d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1704,7 +1704,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'ICALEVENT') print '
('.dol_trunc($event->icalname, $maxnbofchar).')'; $thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0)); - $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->cotact->id > 0) ? $event->contact->id : 0)); + $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0)); // If action related to company / contact $linerelatedto = ''; From ccfe6f18fe0a06530dbe2d30e4eef6b262fb099f Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 25 Jun 2020 16:01:27 +0200 Subject: [PATCH 15/75] FIX 10.0 - fatal with postgres backport of https://github.com/Dolibarr/dolibarr/pull/14064/files --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 3cd302ebdbb..24dfa57f190 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1349,7 +1349,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $langs->load("mails"); $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; - $sql2.= ", '' as fk_element, '' as elementtype, '' as contact_id"; + $sql2.= ", null as fk_element, '' as elementtype, null as contact_id"; $sql2.= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; $sql2.= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2.= ", '' as lastname, '' as firstname"; From 62f55b85497ec3dc0f899c644db5fddcdb4e2a57 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 25 Jun 2020 20:43:41 +0200 Subject: [PATCH 16/75] FIX: SQL Problem in supplier invoice list --- htdocs/fourn/facture/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 164255d4a61..0ebfd024658 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -407,7 +407,8 @@ if (!$search_all) $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom,"; $sql .= ' country.code,'; - $sql .= " p.rowid, p.ref, p.title"; + $sql .= " p.rowid, p.ref, p.title,"; + $sql .= " u.login"; if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { //prevent error with sql_mode=only_full_group_by From 0c60c9fd0d9294badb7b06e2dc17fbbe89d01fc5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 25 Jun 2020 20:53:03 +0200 Subject: [PATCH 17/75] FIX: SQL Problem in social contribution list --- htdocs/compta/sociales/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 9d210c23d85..b249ed035ed 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -152,6 +152,7 @@ if ($search_typeid) { $sql .= " AND cs.fk_type=".$db->escape($search_typeid); } $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle"; +if (!empty($conf->projet->enabled)) $sql .= ", p.rowid"; $sql .= $db->order($sortfield, $sortorder); $totalnboflines = 0; From e99ab329fd04eb50fb4cca199dbee79f28b9441a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jun 2020 22:22:54 +0200 Subject: [PATCH 18/75] Remove bans --- build/doxygen/doxygen_footer.html | 28 +--------------------------- build/doxygen/doxygen_header.html | 24 ------------------------ 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/build/doxygen/doxygen_footer.html b/build/doxygen/doxygen_footer.html index 1426885a565..2615af0b485 100644 --- a/build/doxygen/doxygen_footer.html +++ b/build/doxygen/doxygen_footer.html @@ -5,7 +5,7 @@ File added into doxygen generated documentation - +
@@ -22,31 +22,5 @@ File added into doxygen generated documentation gtag('config', 'UA-9049390-16'); - - - - - - - - - - - - - \ No newline at end of file diff --git a/build/doxygen/doxygen_header.html b/build/doxygen/doxygen_header.html index 5810182050f..235797bb6c9 100644 --- a/build/doxygen/doxygen_header.html +++ b/build/doxygen/doxygen_header.html @@ -12,21 +12,6 @@ - - - - - @@ -48,15 +33,6 @@ src="https://www.facebook.com/tr?id=1998533953704960&ev=PageView&noscript=1"
- - - -
From 1bc07994f6d5af3acc88029b0b88add4467d2961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 02:53:01 +0200 Subject: [PATCH 19/75] Update doc --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f611f333e6a..fa5326079ec 100644 --- a/README.md +++ b/README.md @@ -91,14 +91,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Products and/or Services catalog - Commercial proposals management - Customer & Supplier Orders management +- Invoices and payment management - Shipping management - Warehouse/Stock management -- Invoices and payment management -- Standing orders management (European SEPA) +- Manufacturing Orders - Bank accounts management +- Direct debit orders management (European SEPA) - Accounting management - Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Opportunities and/or project management +- Opportunities or Leads management - Projects & Tasks management - Contracts management - Interventions management From 858a751eef997d488bda47b4904d3735c9728cba Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 26 Jun 2020 10:51:04 +0200 Subject: [PATCH 20/75] FIX : $_POST must be GETPOST --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9400c64de85..48015547903 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2103,7 +2103,7 @@ class ExtraFields if (in_array($key_type, array('date','datetime'))) { // Clean parameters - $value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]); + $value_key=dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { From 29ba9c82c3f8bc5a4e9e186dc02b52aff64b969f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 17:17:13 +0200 Subject: [PATCH 21/75] Fix #14120 --- htdocs/comm/action/card.php | 11 ++++------- htdocs/core/class/html.form.class.php | 7 +++++++ htdocs/langs/cs_CZ/admin.lang | 4 ++-- htdocs/langs/cs_CZ/agenda.lang | 1 + htdocs/langs/cs_CZ/main.lang | 22 +++++++++++----------- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 716e02ae678..d733cb61ba3 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -815,6 +815,7 @@ if ($action == 'create') } setdatefields(); $("#fullday").change(function() { + console.log("setdatefields"); setdatefields(); }); $("#selectcomplete").change(function() { @@ -869,9 +870,7 @@ if ($action == 'create') if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 447f9569517..587040ac53f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5784,10 +5784,17 @@ class Form } elseif ($addnowlink == 2) { + /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. + * This break application for foreign languages. $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; + */ + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; } /*if ($usecalendar == "eldy") { diff --git a/htdocs/langs/cs_CZ/admin.lang b/htdocs/langs/cs_CZ/admin.lang index 66e491723a3..e0e91baaff7 100644 --- a/htdocs/langs/cs_CZ/admin.lang +++ b/htdocs/langs/cs_CZ/admin.lang @@ -543,7 +543,7 @@ Module54Desc=Správa smluv (služby nebo opakované předplatné) Module55Name=Čárové kódy Module55Desc=Správa čárových kódů Module56Name=Platba převodem -Module56Desc=Správa plateb prostřednictvím příkazů k úhradě. Zahrnuje vytvoření souboru SEPA pro evropské země. +Module56Desc=Management of payment of suppliers by credit transfer orders. It includes generation of SEPA file for European countries. Module57Name=Bank Direct Debit platby Module57Desc=Správa platebních příkazů inkasních příkazů. Zahrnuje generování souboru SEPA pro evropské země. Module58Name=ClickToDial @@ -1983,7 +1983,7 @@ SmallerThan=Menší než LargerThan=Větší než IfTrackingIDFoundEventWillBeLinked=Všimněte si, že je-li ID ID nalezeno v příchozím e-mailu, bude událost automaticky propojena s příslušnými objekty. WithGMailYouCanCreateADedicatedPassword=Pokud jste s účtem GMail povolili ověření ve 2 - dvou krocích, doporučuje se pro aplikaci vytvořit vyhrazené druhé heslo namísto použití hesla pro vlastní účet z adresy https://myaccount.google.com/. -EmailCollectorTargetDir=Po úspěšném zpracování může být žádoucí chování při přesunu e-mailu do jiné značky / adresáře. Chcete-li tuto funkci použít, nastavte zde hodnotu. Musíte také použít přihlašovací účet pro čtení a zápis. +EmailCollectorTargetDir=It may be a desired behaviour to move the email into another tag/directory when it was processed successfully. Just set name of directory here to use this feature (Do NOT use special characters in name). Note that you must also use a read/write login account. EmailCollectorLoadThirdPartyHelp=Pomocí této akce můžete pomocí obsahu e-mailu najít a načíst existující třetí stranu ve vaší databázi. Nalezená (nebo vytvořená) třetí strana bude použita pro následující akce, které ji potřebují. V poli parametrů můžete použít například 'EXTRACT: BODY: Name: \\ s ([^ \\ s] *)', pokud chcete extrahovat jméno třetí strany z řetězce 'Name: name to find' nalezeného do tělo. EndPointFor=Koncový bod pro %s: %s DeleteEmailCollector=Smazat sběratele e-mailu diff --git a/htdocs/langs/cs_CZ/agenda.lang b/htdocs/langs/cs_CZ/agenda.lang index 0c590afa4ae..62ba1fc0337 100644 --- a/htdocs/langs/cs_CZ/agenda.lang +++ b/htdocs/langs/cs_CZ/agenda.lang @@ -63,6 +63,7 @@ ShipmentClassifyClosedInDolibarr=Zásilka %s klasifikováno účtoval ShipmentUnClassifyCloseddInDolibarr=Zásilka %s byla znovu otevřena ShipmentBackToDraftInDolibarr=Doprava %s se vrátí zpět na stav konceptu ShipmentDeletedInDolibarr=Doprava %s odstraněna +ReceptionValidatedInDolibarr=Reception %s validated OrderCreatedInDolibarr=Objednat %s vytvořil OrderValidatedInDolibarr=Objednávka %s ověřena OrderDeliveredInDolibarr=Objednávka %s označena jako dodaná diff --git a/htdocs/langs/cs_CZ/main.lang b/htdocs/langs/cs_CZ/main.lang index 55be67bde38..880f21e416b 100644 --- a/htdocs/langs/cs_CZ/main.lang +++ b/htdocs/langs/cs_CZ/main.lang @@ -8,21 +8,21 @@ FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=Space -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Yr -FormatDateShortJava=MM/dd/yyyy -FormatDateShortJavaInput=MM/dd/yyyy -FormatDateShortJQuery=mm/dd/yy -FormatDateShortJQueryInput=mm/dd/yy +FormatDateShort=%d.%m.%Y +FormatDateShortInput=%d.%m.%Y +FormatDateShortJava=dd.MM.yyyy +FormatDateShortJavaInput=dd.MM.yyyy +FormatDateShortJQuery=dd.mm.yy +FormatDateShortJQueryInput=dd.mm.yy FormatHourShortJQuery=HH:MI -FormatHourShort=%I:%M %p +FormatHourShort=%H:%M FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y FormatDateText=%B %d, %Y -FormatDateHourShort=%m/%d/%Y %I:%M %p -FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p -FormatDateHourTextShort=%b %d, %Y, %I:%M %p -FormatDateHourText=%B %d, %Y, %I:%M %p +FormatDateHourShort=%d.%m.%Y %H.%M +FormatDateHourSecShort=%d.%m.%Y %H.%M.%S +FormatDateHourTextShort=%b %d, %Y, %H.%M +FormatDateHourText=%B %d, %Y, %H.%M DatabaseConnection=Připojení k databázi NoTemplateDefined=Pro tento typ e-mailu není k dispozici žádná šablona AvailableVariables=K dispozici substituční proměnné From f4494db73fb12fd064dd01a6b4897b1758ff532d Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 26 Jun 2020 17:34:11 +0200 Subject: [PATCH 22/75] Fix missing translate key --- htdocs/langs/en_US/errors.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 520519c3439..75a12d517d0 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -36,6 +36,7 @@ ErrorBadSupplierCodeSyntax=Bad syntax for vendor code ErrorSupplierCodeRequired=Vendor code required ErrorSupplierCodeAlreadyUsed=Vendor code already used ErrorBadParameters=Bad parameters +ErrorWrongParameters=Wrong or missing parameters ErrorBadValueForParameter=Wrong value '%s' for parameter '%s' ErrorBadImageFormat=Image file has not a supported format (Your PHP does not support functions to convert images of this format) ErrorBadDateFormat=Value '%s' has wrong date format From d6346522b868aafe5ab8b96b45442d755f9e2e62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 18:56:05 +0200 Subject: [PATCH 23/75] Code comment --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 587040ac53f..9c4e2526249 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5482,7 +5482,7 @@ class Form * @param int $d 1=Show days, month, years * @param int $addnowlink Add a link "Now", 1 with server time, 2 with local computer time * @param int $disabled Disable input fields - * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 + * @param int $fullday When a checkbox with id #fullday is cheked, hours are set with 00:00 (if value if 'fulldaystart') or 23:59 (if value is 'fulldayend') * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. * @param datetime $adddateof Add a link "Date of ..." using the following date. See also $labeladddateof for the label used. * @param string $openinghours Specify hour start and hour end for the select ex 8,20 From ee0bdde8c184a36d9b37ff6ad1d4ad7c5dd522ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 19:35:09 +0200 Subject: [PATCH 24/75] FIX Filter on status, closing opening status --- htdocs/core/actions_massactions.inc.php | 2 - htdocs/ticket/card.php | 2 +- htdocs/ticket/class/ticket.class.php | 10 +- htdocs/ticket/list.php | 126 +++++++++++++++++++++--- 4 files changed, 123 insertions(+), 17 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 40e6849d494..77fbea3c36a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1153,8 +1153,6 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) $result = $objecttmp->fetch($toselectid); if ($result > 0) { - //if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - //else $result = $objecttmp->validate($user); if ($result == 0) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index b4a82ae660c..076c42867ca 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -491,7 +491,7 @@ if (empty($reshook)) { if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { // prevent browser refresh from reopening ticket several times - if ($object->fk_statut == Ticket::STATUS_CLOSED) { + if ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) { $res = $object->setStatut(Ticket::STATUS_ASSIGNED); if ($res) { // Log action in ticket logs table diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5dab31b790d..dbd81128d49 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -108,7 +108,8 @@ class Ticket extends CommonObject /** * @var int Ticket statut */ - public $fk_statut; + public $fk_statut; // deprecated + public $status; /** * @var string State resolution @@ -463,7 +464,7 @@ class Ticket extends CommonObject $sql .= " t.fk_user_assign,"; $sql .= " t.subject,"; $sql .= " t.message,"; - $sql .= " t.fk_statut,"; + $sql .= " t.fk_statut as status,"; $sql .= " t.resolution,"; $sql .= " t.progress,"; $sql .= " t.timing,"; @@ -509,7 +510,10 @@ class Ticket extends CommonObject $this->fk_user_assign = $obj->fk_user_assign; $this->subject = $obj->subject; $this->message = $obj->message; - $this->fk_statut = $obj->fk_statut; + + $this->status = $obj->status; + $this->fk_statut = $this->status; // For backward compatibility + $this->resolution = $obj->resolution; $this->progress = $obj->progress; $this->timing = $obj->timing; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 72b398c8281..8d523d88632 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018 Regis Houssin * Copyright (C) 2019 Juanjo Menent - * Copyright (C) 2019 Laurent Destailleur + * Copyright (C) 2019-2020 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 @@ -38,7 +38,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; // Load translation files required by the page $langs->loadLangs(array("ticket", "companies", "other", "projects")); - // Get parameters $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) @@ -145,6 +144,12 @@ if ($project_ref) $search_fk_project = $projectid; } +$permissiontoread = $user->rights->ticket->read; +$permissiontoadd = $user->rights->ticket->write; +$permissiontodelete = $user->rights->ticket->delete; + +$error = 0; + /* * Actions @@ -183,10 +188,95 @@ if (empty($reshook)) // Mass actions $objectclass = 'Ticket'; $objectlabel = 'Ticket'; - $permissiontoread = $user->rights->ticket->read; - $permissiontodelete = $user->rights->ticket->delete; $uploaddir = $conf->ticket->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + // Close records + if (!$error && $massaction == 'close' && $permissiontoadd) + { + $objecttmp = new $objectclass($db); + if (!$error) + { + $db->begin(); + + $nbok = 0; + foreach ($toselect as $toselectid) + { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) + { + $result = $objecttmp->close($user); + if ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else $nbok++; + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } + } + + // Reopen records + if (!$error && $massaction == 'reopen' && $permissiontoadd) + { + $objecttmp = new $objectclass($db); + if (!$error) + { + $db->begin(); + + $nbok = 0; + foreach ($toselect as $toselectid) + { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) + { + if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) { + $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED); + if ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else $nbok++; + } else { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors'); + $error++; + break; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } + } } @@ -236,11 +326,23 @@ foreach ($search as $key => $val) { if ($key == 'fk_statut') { - $tmpstatus = ''; - if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus .= ($tmpstatus ? ',' : '')."'".Ticket::STATUS_NOT_READ."', '".Ticket::STATUS_READ."', '".Ticket::STATUS_ASSIGNED."', '".Ticket::STATUS_IN_PROGRESS."', '".Ticket::STATUS_NEED_MORE_INFO."', '".Ticket::STATUS_WAITING."'"; - if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus .= ($tmpstatus ? ',' : '')."'".Ticket::STATUS_CLOSED."', '".Ticket::STATUS_CANCELED."'"; - if ($tmpstatus) $sql .= " AND fk_statut IN (".$tmpstatus.")"; - elseif (is_array($search[$key]) && count($search[$key])) $sql .= natural_search($key, join(',', $search[$key]), 2); + $newarrayofstatus = array(); + foreach($search['fk_statut'] as $key2 => $val2) { + if (in_array($val2, array('openall', 'closeall'))) continue; + $newarrayofstatus[] = $val2; + } + if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) { + $newarrayofstatus[] = Ticket::STATUS_NOT_READ; + $newarrayofstatus[] = Ticket::STATUS_ASSIGNED; + $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS; + $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO; + $newarrayofstatus[] = Ticket::STATUS_WAITING; + } + if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) { + $newarrayofstatus[] = Ticket::STATUS_CLOSED; + $newarrayofstatus[] = Ticket::STATUS_CANCELED; + } + if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2); continue; } if ($key == 'fk_user_assign') @@ -452,6 +554,8 @@ $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); +if ($user->rights->ticket->write) $arrayofmassactions['close'] = $langs->trans("Close"); +if ($user->rights->ticket->write) $arrayofmassactions['reopen'] = $langs->trans("ReOpen"); if ($user->rights->ticket->delete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -549,8 +653,8 @@ foreach ($object->fields as $key => $val) $arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --'; foreach ($object->statuts_short as $key2 => $val2) { - $arrayofstatus[$key2] = $val2; - if ($key2 == '6') $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --'; + if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --'; + $arrayofstatus[$key2] = $val2; } print '
'; + $boxstat .= '
'; if ($conf->supplier_proposal->enabled) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9f15e97104c..a8bf76236fc 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3633,6 +3633,11 @@ ul.noborder li:nth-child(even):not(.liste_titre) { padding-bottom: 2px; width: 118px; } + +td.tdboxstats .boxstats { + box-shadow: 1px 1px 8px var(--colorboxstatsborder); +} + .tabBar .fichehalfright .boxstats { padding-top: 8px; padding-bottom: 4px; From d05c60baf0a04868aaa765ca20af4f93e144bb5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 14:33:34 +0200 Subject: [PATCH 04/75] Fix css --- htdocs/admin/system/perf.php | 7 ------- htdocs/index.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 ++++---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index dd77c41a673..8d4360b37c0 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -552,13 +552,6 @@ else } print '
'; -// Database statistics update -/* -print '
'; -print ''.$langs->trans("DatabaseStatistics").': '; -print '
'; -*/ - // End of page llxFooter(); $db->close(); diff --git a/htdocs/index.php b/htdocs/index.php index 1e6b7bcf210..20e2d5f9c9a 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -897,7 +897,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) if (!empty($boxstatFromHook) || !empty($boxstatItems)) { $boxstat .= ''."\n"; $boxstat .= '
'; - $boxstat .= ''; + $boxstat .= '
'; $boxstat .= ''; $boxstat .= ''; print ''; print ''; +$total_revenue_ht = 0; + foreach ($listofreferent as $key => $value) { $name = $langs->trans($value['name']); @@ -780,7 +782,11 @@ foreach ($listofreferent as $key => $value) // Calculate margin if ($qualifiedforfinalprofit) { - if ($margin != "add") + if ($margin == 'add') { + $total_revenue_ht += $total_ht; + } + + if ($margin != "add") // Revert sign { $total_ht = -$total_ht; $total_ttc = -$total_ttc; @@ -811,11 +817,20 @@ foreach ($listofreferent as $key => $value) } // and the final balance print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; +// and the margin (profit / revenues) +if ($total_revenue_ht) { + print ''; + print ''; + print ''; + print ''; + print ''; +} + print "
'; $boxstat .= '
'.$langs->trans("DolibarrStateBoard").'
'; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a8bf76236fc..273073d7b5d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1726,7 +1726,7 @@ div.heightref { min-height: 80px; } div.divphotoref { - padding-: 20px; + padding-: 30px; } div.paginationref { padding-bottom: 10px; @@ -3117,7 +3117,7 @@ table.listwithfilterbefore { /* Pagination */ div.refidpadding { - padding-top: 3px; + /* padding-top: 3px; */ } div.refid { font-weight: bold; @@ -3159,7 +3159,7 @@ div.pagination li { display: inline-block; padding-left: 0px; padding-right: 0px; - padding-top: 10px; + /* padding-top: 10px; */ padding-bottom: 5px; font-size: 1.1em; } @@ -3634,7 +3634,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { width: 118px; } -td.tdboxstats .boxstats { +.boxtable:not(.widgetstats) td.tdboxstats .boxstats { box-shadow: 1px 1px 8px var(--colorboxstatsborder); } From 7c992eac5e7c36b5dba9efe1cca719aa75e0ee1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 15:52:17 +0200 Subject: [PATCH 05/75] Fix option PROJECT_ELEMENTS_FOR_MINUS_MARGIN --- htdocs/projet/element.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 0b46d14a7fa..2bd7e49d86d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -540,12 +540,12 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { } if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { foreach($listofreferent as $key => $element) { - if ($listofreferent[$key]['margin'] == 'add') { + if ($listofreferent[$key]['margin'] == 'minus') { unset($listofreferent[$key]['margin']); } } - $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); - foreach($newelementforplusmargin as $value) { + $newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); + foreach($newelementforminusmargin as $value) { $listofreferent[$value]['margin']='minus'; } } From 036371747611ab80857692df9859e203d178b5c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 16:05:00 +0200 Subject: [PATCH 06/75] Fix PROJECT_ELEMENTS_FOR_MINUS_MARGIN --- htdocs/projet/element.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2bd7e49d86d..6878efcd6ab 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -535,7 +535,7 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { } $newelementforplusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN); foreach($newelementforplusmargin as $value) { - $listofreferent[$value]['margin']='add'; + $listofreferent[trim($value)]['margin']='add'; } } if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { @@ -546,7 +546,7 @@ if (! empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { } $newelementforminusmargin = explode(',', $conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN); foreach($newelementforminusmargin as $value) { - $listofreferent[$value]['margin']='minus'; + $listofreferent[trim($value)]['margin']='minus'; } } @@ -651,6 +651,8 @@ print '
'.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).''.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).'
'.$langs->trans("Margin").''.price(price2num($balance_ht / $total_revenue_ht, 'MT')).'
"; From a854d955b826c7168cce80935570dbb6a975ae86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2020 16:08:31 +0200 Subject: [PATCH 07/75] Fix rounding --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6878efcd6ab..2566dcb104d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -826,7 +826,7 @@ print '
'.$langs->trans("Margin").''.price(price2num($balance_ht / $total_revenue_ht, 'MT')).''.round(100 * $balance_ht / $total_revenue_ht, 1).'%
'.$i.''; - if (!$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; - else print price($total_ht); + if ($key == 'intervention' && !$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; + else { + print price($total_ht); + if ($key == 'propal') print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; + } print ''; - if (!$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; - else print price($total_ttc); + if ($key == 'intervention' && !$qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; + else { + print price($total_ttc); + if ($key == 'propal') print ''.$form->textwithpicto('', $langs->trans("SignedOnly")).''; + } print '
'.$langs->trans("RIB").''; + $title = 'CustomerIBAN'; + if ($mode == 'bank-transfer') { + $title = 'SupplierIBAN'; + } + print '
'.$langs->trans($title).''; $bac = new CompanyBankAccount($db); $bac->fetch(0, $object->thirdparty->id); print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; - if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message); + if (!empty($bac->iban)) { + if ($bac->verif() <= 0) print img_warning('Error on default bank number for IBAN : '.$bac->error_message); + } else { + print img_warning($langs->trans("NoDefaultIBANFound")); + } print '
'.dol_print_date($db->jdate($obj->date_demande), 'day')."'.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''.price($obj->amount).'-'.$langs->trans("OrderWaiting").''; - print ''; + print ''; print img_delete(); print '
'.$langs->trans("DateActionStart").''; if (GETPOST("afaire") == 1) { - print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldayend'); - } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldayend'); + print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo" } else { print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart'); } @@ -886,11 +885,9 @@ if ($action == 'create') } print '
'.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); - } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend'); } else { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend'); } print '
'; //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); From 8e324c36ff010fd1a94ab151c47ac0028a40f037 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 19:39:01 +0200 Subject: [PATCH 25/75] Prepare 11.0.5 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 0352963b13e..2acaad4ec29 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From 347667b3461f71ce86774deceaf3fabaefb41086 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 19:45:39 +0200 Subject: [PATCH 26/75] Prepare 11.0.5 --- ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 67cf9513a4a..3ea709eb7bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,52 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 11.0.4 compared to 11.0.3 ***** +FIX: $arraydefaultmessage is an object, as well as in /htdocs/core/class/html.formmail.class.php +FIX: 10.0 - pagination in prelevement/bons.php +FIX: 10.0 - undefined $langs if template file copy fails during activation of modContrat +FIX: 11.0 - fatal with postgres on contact/agenda.php +FIX: 11.0 - multicurrency amount not fetched when fetching payments from llx_paiement or llx_paiementfourn +FIX: 11.0 - when using pdftk as per hidden conf USE_PDFTK_FOR_PDF_CONCAT, check that the file exists before displaying a success message +FIX: #13841 +FIX: #13877 - Can validate invoice if there is a credit note with VAT 0% on an invoice with other lines with a VAT non 0% +FIX: #13968 +FIX: #14001 +FIX: #14002 +FIX: 9.0 - delete unused mandatory argument from migrate_clean_association: argument count mismatch causes a fatal error since php7 +FIX: 9.0 - fatal during migration from 3.1 using PHP 7 +FIX: Accountancy - Binding index - Add a filter on sql request for module Subtotal & Jalon +FIX: avoid error "Call to undefined function measuringUnitString()" +FIX: BlindBoolean SQL injection reported by Christian Weiler +FIX: Can create a credit note on situation invoice if previous is also +FIX: can install module even if (x) was appended during download. +FIX: copy value date of VariousPayment onto the new AccountLine +FIX: count of open day when date and start are not open should be 0 +FIX: Default bank account was not loaded for document generation. +FIX: Do not show stats panel if the user does not have permissions +FIX: Fix link of the button to create a credit note and fix the awareness of a error that happen when wo create a credit note +FIX: force rounding 2 on export ld compta +FIX: free text on cash desk +FIX: links into emails of notifications +FIX: missing file manifest.json.php +FIX: missing GetNomURL Hook in warehouse class +FIX: missing hook init + table class + $page not set +FIX: missing rollbacks on trigger bad return +FIX: missing translation value for key "NoMorePredefinedProductToDispatch" +FIX: percent must be displayed on one line +FIX: php error if multicompany disabled +FIX: Privilege escalation reported by wizlynx WLX-2020-011 +FIX: replace filter parameter "none" by "restricthtml" +FIX: Rounding Total TVA in "crabe" model pdf +FIX: Show ref_customer, amount on contract link object +FIX: Site ec.europa.eu has moved to https:// +FIX: Tickets mail models doesn't work +FIX: vulnerability reported by wizlynx WLX-2020-012 +FIX: We must only rename current bank receipt +FIX: when creating a VariousPayment, the value date is not copied onto the AccountLine that gets created at the same time, so the bank transaction's value date will be the payment date instead of the payment's value date +FIX: wrong url param +FIX: XSS using the renaming of .noexe files - reported by Nolan. + ***** ChangeLog for 11.0.4 compared to 11.0.3 ***** FIX: #13749 FIX: #7594 Expense report multi pagebreak From 0eac798674eacb44e725fa53423c35ea860acd02 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 19:47:03 +0200 Subject: [PATCH 27/75] Changelog --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3ea709eb7bf..515a98f4180 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ English Dolibarr ChangeLog -------------------------------------------------------------- -***** ChangeLog for 11.0.4 compared to 11.0.3 ***** +***** ChangeLog for 11.0.5 compared to 11.0.4 ***** FIX: $arraydefaultmessage is an object, as well as in /htdocs/core/class/html.formmail.class.php FIX: 10.0 - pagination in prelevement/bons.php FIX: 10.0 - undefined $langs if template file copy fails during activation of modContrat From 6df049e05c95eaf8db10c652f551c1897a60552a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 20:35:06 +0200 Subject: [PATCH 28/75] FIX #14112 --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/product/index.php | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 551fe2b82c0..0f823984fa2 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1144,7 +1144,7 @@ class DolGraph foreach ($legends as $val) // Loop on each serie { if ($i > 0) $this->stringtoshow .= ', '; - $this->stringtoshow .= "'".$val."'"; + $this->stringtoshow .= "'".dol_trunc($val,32)."'"; $i++; } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 3067cc63733..6c5d1603168 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -166,17 +166,16 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us $dataseries = array(); if (!empty($conf->product->enabled)) { - $dataseries[] = array($langs->trans("ProductsOnSale"), round($SommeA)); - $dataseries[] = array($langs->trans("ProductsOnPurchase"), round($SommeB)); - $dataseries[] = array($langs->trans("ProductsNotOnSell"), round($SommeC)); + $dataseries[] = array($langs->transnoentitiesnoconv("ProductsOnSale"), round($SommeA)); + $dataseries[] = array($langs->transnoentitiesnoconv("ProductsOnPurchase"), round($SommeB)); + $dataseries[] = array($langs->transnoentitiesnoconv("ProductsNotOnSell"), round($SommeC)); } if (!empty($conf->service->enabled)) { - $dataseries[] = array($langs->trans("ServicesOnSale"), round($SommeD)); - $dataseries[] = array($langs->trans("ServicesOnPurchase"), round($SommeE)); - $dataseries[] = array(dol_trunc($langs->trans("ServicesNotOnSell"), 24), round($SommeF)); + $dataseries[] = array($langs->transnoentitiesnoconv("ServicesOnSale"), round($SommeD)); + $dataseries[] = array($langs->transnoentitiesnoconv("ServicesOnPurchase"), round($SommeE)); + $dataseries[] = array($langs->transnoentitiesnoconv("ServicesNotOnSell"), round($SommeF)); } - include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); From 3655f6f407ed504b8e42048a96dd2a8b82c59f35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Jun 2020 20:38:41 +0200 Subject: [PATCH 29/75] FIX #14109 --- htdocs/core/class/dolgraph.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 0f823984fa2..141ac1e0e85 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1144,7 +1144,7 @@ class DolGraph foreach ($legends as $val) // Loop on each serie { if ($i > 0) $this->stringtoshow .= ', '; - $this->stringtoshow .= "'".dol_trunc($val,32)."'"; + $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val,32))."'"; $i++; } @@ -1207,7 +1207,7 @@ class DolGraph foreach ($legends as $val) // Loop on each serie { if ($i > 0) $this->stringtoshow .= ', '; - $this->stringtoshow .= "'".$val."'"; + $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val,32))."'"; $i++; } From 443558e3a2a15bb121fd8be85403c67a4f5a47cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2020 01:57:01 +0200 Subject: [PATCH 30/75] Fix phpcs --- htdocs/core/class/dolgraph.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 141ac1e0e85..4df5c6add45 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1144,7 +1144,7 @@ class DolGraph foreach ($legends as $val) // Loop on each serie { if ($i > 0) $this->stringtoshow .= ', '; - $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val,32))."'"; + $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'"; $i++; } @@ -1207,7 +1207,7 @@ class DolGraph foreach ($legends as $val) // Loop on each serie { if ($i > 0) $this->stringtoshow .= ', '; - $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val,32))."'"; + $this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'"; $i++; } From 90bcc64547e5cd8dc6934b1b88f235f7aea9b595 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2020 01:59:08 +0200 Subject: [PATCH 31/75] Fix phpcs --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 8d523d88632..8abacee8f47 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -327,7 +327,7 @@ foreach ($search as $key => $val) if ($key == 'fk_statut') { $newarrayofstatus = array(); - foreach($search['fk_statut'] as $key2 => $val2) { + foreach ($search['fk_statut'] as $key2 => $val2) { if (in_array($val2, array('openall', 'closeall'))) continue; $newarrayofstatus[] = $val2; } From d5324ff3db3e981c856f8a606334fcfa599eafcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2020 14:38:40 +0200 Subject: [PATCH 32/75] Fix template --- htdocs/modulebuilder/template/README.md | 2 +- .../modulebuilder/template/core/modules/modMyModule.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 1472929c043..c3afa63e1b7 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -8,7 +8,7 @@ Description... ![Screenshot mymodule](img/screenshot_mymodule.png?raw=true "MyModule"){imgmd} --> -Other modules are available on [Dolistore.com](https://www.dolistore.com>). +Other modules are available on [Dolistore.com](https://www.dolistore.com). ## Translations diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 10cdfa54001..a580a655d85 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -276,7 +276,7 @@ class modMyModule extends DolibarrModules 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. - 'perms'=>'$user->rights->mymodule->myobject->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->myobject->read' if you want your menu with a permission rules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); From 41c6155922b7e4f59ef12a3e40287e31bf42fc9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2020 14:44:38 +0200 Subject: [PATCH 33/75] Hiden useless entry --- htdocs/modulebuilder/index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 7e6355b2a30..118718db57e 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2136,10 +2136,11 @@ elseif (!empty($module)) print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("LanguageFile").' : '; - if (!is_array($dicts) || empty($dicts)) print ''.$langs->trans("NoDictionaries").''; - else print ''.$dicts['langs'].''; - print '
'; + if (is_array($dicts) && !empty($dicts)) { + print ' '.$langs->trans("LanguageFile").' : '; + print ''.$dicts['langs'].''; + print '
'; + } print load_fiche_titre($langs->trans("ListOfDictionariesEntries"), '', ''); From 194b92e70f82ddc337888bd99edd03224a759770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Jun 2020 15:27:09 +0200 Subject: [PATCH 34/75] Fix load of menu when 'perm' or 'enabled' is '0'. --- htdocs/admin/menus/index.php | 16 ++++++++-------- htdocs/core/class/menubase.class.php | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 97f0246ac88..1dea0ca4473 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -328,18 +328,18 @@ if ($conf->use_javascript_ajax) $entry = '
'; $entry .= '   '.$titre.''; $entry .= ''; - $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; - $entry .= ''.img_edit_add('default').' '; - $entry .= ''.img_delete('default').' '; + $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $entry .= ''.img_edit_add('default').' '; + $entry .= ''.img_delete('default').' '; $entry .= '     '; - $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; $entry .= '
'; - $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; - $buttons .= ''.img_edit_add('default').' '; - $buttons .= ''.img_delete('default').' '; + $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $buttons .= ''.img_edit_add('default').' '; + $buttons .= ''.img_delete('default').' '; $buttons .= '     '; - $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; $data[] = array( 'rowid'=>$menu['rowid'], diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index a6d774090aa..953064e6b4c 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -656,7 +656,7 @@ class Menubase // Define $right $perms = true; - if ($menu['perms']) + if (isset($menu['perms'])) { $tmpcond = $menu['perms']; if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true @@ -666,7 +666,7 @@ class Menubase // Define $enabled $enabled = true; - if ($menu['enabled']) + if (isset($menu['enabled'])) { $tmpcond = $menu['enabled']; if ($leftmenu == 'all') $tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index cc47218e2db..f6e5c2c83d6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -49,7 +49,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $mainmenu = (empty($_SESSION["mainmenu"]) ? '' : $_SESSION["mainmenu"]); $leftmenu = (empty($_SESSION["leftmenu"]) ? '' : $_SESSION["leftmenu"]); - $id = 'mainmenu'; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -457,6 +456,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $num = count($newTabMenu); for ($i = 0; $i < $num; $i++) { + //var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']); $idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']); $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 273073d7b5d..06feb97c2dd 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4511,7 +4511,7 @@ td.cal_other_month { .treeview ul { background-color: transparent !important; margin-top: 4px; padding-top: 4px !important; } .treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 26px; } .treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; } - +.treeview .hitarea { margin-top: 3px; } /* ============================================================================== */ From 731978fda6a35393f11e304d94fcc21926302092 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 28 Jun 2020 16:33:44 +0200 Subject: [PATCH 35/75] FIX html lost on html extrafield --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e1a834a42ca..ae5d41dba48 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,7 +2086,7 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double'))) + elseif (in_array($key_type, array('price', 'double', 'html'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); From 2de1433818a276ed50f82c1a3bb9acc098e73f53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 21:05:36 +0200 Subject: [PATCH 36/75] FIX #14142 --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 7a6f2333346..af05a55a8e7 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -80,7 +80,7 @@ ALTER TABLE llx_document_model MODIFY COLUMN type varchar(64); -- Delete an old index that is duplicated -- VMYSQL4.1 DROP INDEX ix_fk_product_stock on llx_product_batch; --- VPGSQL8.2 DROP INDEX ix_fk_product_stock +-- VPGSQL8.2 DROP INDEX ix_fk_product_stock; ALTER TABLE llx_actioncomm DROP COLUMN punctual; From a11f7d107000863c519b5d6a74dd844f8af341a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 21:11:25 +0200 Subject: [PATCH 37/75] Update list.php --- htdocs/compta/sociales/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index b249ed035ed..8ccd8aa35aa 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -152,7 +152,7 @@ if ($search_typeid) { $sql .= " AND cs.fk_type=".$db->escape($search_typeid); } $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle"; -if (!empty($conf->projet->enabled)) $sql .= ", p.rowid"; +if (!empty($conf->projet->enabled)) $sql .= ", p.rowid, p.ref, p.title"; $sql .= $db->order($sortfield, $sortorder); $totalnboflines = 0; From a5893db10679e0cb0c73a3a021d6352f15ac73e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 22:05:55 +0200 Subject: [PATCH 38/75] FIX upload documents into manual ECM was reported a permission error --- htdocs/core/lib/security.lib.php | 39 +++++++++++----------------- htdocs/core/modules/modECM.class.php | 8 +++--- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a4f1a30bd4d..1aec703de4a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -233,28 +233,22 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f continue; } - if ($feature == 'societe') - { + if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'contact') - { + elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'produit|service') - { + elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'prelevement') - { + elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; } } - elseif ($feature == 'cheque') - { + elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; } } - elseif ($feature == 'projet') - { + elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; } } elseif (!empty($feature2)) // This is for permissions on 2 levels @@ -296,30 +290,27 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { foreach ($featuresarray as $feature) { - if ($feature == 'contact') - { + if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'produit|service') - { + elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'prelevement') - { + elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'commande_fournisseur') - { + elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; } } - elseif ($feature == 'banque') - { + elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } } - elseif ($feature == 'cheque') - { + elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } } + elseif ($feature == 'ecm') { + if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } + } elseif (!empty($feature2)) // This is for permissions on one level { foreach ($feature2 as $subfeature) diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index 4d314644fb4..637cdb33739 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2020 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 @@ -97,21 +97,21 @@ class modECM extends DolibarrModules $r++; $this->rights[$r][0] = 2501; - $this->rights[$r][1] = 'Consulter/Télécharger les documents'; + $this->rights[$r][1] = 'Read or download documents'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'read'; $r++; $this->rights[$r][0] = 2503; - $this->rights[$r][1] = 'Soumettre ou supprimer des documents'; + $this->rights[$r][1] = 'Upload a document'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'upload'; $r++; $this->rights[$r][0] = 2515; - $this->rights[$r][1] = 'Administrer les rubriques de documents'; + $this->rights[$r][1] = 'Administer directories of documents'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'setup'; From 600a24346aaad87f0c9f74a576d58a9aca66fdd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 22:09:17 +0200 Subject: [PATCH 39/75] Some people are missing this table --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index af05a55a8e7..2a7fc17e77e 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -66,6 +66,16 @@ ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafie ALTER TABLE llx_facture_rec MODIFY COLUMN titre varchar(200) NOT NULL; +create table llx_mrp_mo_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_fk_object(fk_object); + -- This var is per entity now, so we remove const if global if exists delete from llx_const where name in ('PROJECT_HIDE_TASKS', 'MAIN_BUGTRACK_ENABLELINK', 'MAIN_HELP_DISABLELINK') and entity = 0; From 5d65b5f66025473cfca99bb6bd48f0c5f7fbfc71 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 29 Jun 2020 09:07:54 +0200 Subject: [PATCH 40/75] fix html should not do price2num --- htdocs/core/class/extrafields.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ae5d41dba48..caf43f94342 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,11 +2086,15 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double', 'html'))) + elseif (in_array($key_type, array('price', 'double'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); } + elseif (in_array($key_type, array('html'))) + { + $value_key = GETPOST("options_".$key, 'alpha'); + } else { $value_key = GETPOST("options_".$key); From eb30f6ed1a3d1b54b927b71f8f8801b0d5f428ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:15:49 +0200 Subject: [PATCH 41/75] Prepare 12.0.1 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 1697037619f..eedc5c5829f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '12.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From 68b4866438903e087877ccb9d0b9b87f8496d11e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:43:39 +0200 Subject: [PATCH 42/75] Trans --- htdocs/langs/en_US/withdrawals.lang | 4 ++-- htdocs/takepos/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 49c9f8b5921..1f9c91719da 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -93,8 +93,8 @@ CreditDate=Credit on WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported) ShowWithdraw=Show Direct Debit Order IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. -DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. -DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to manage the credit transfer payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null. +DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Direct Debit orders to generate and manage the direct debit payment order. When direct debit order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. +DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Credit transfer orders to generate and manage the credit transfer order. When credit transfer order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. WithdrawalFile=Withdrawal file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dbc68afeaf4..f4b83138416 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -873,7 +873,7 @@ $menus[$r++] = array('title'=>''
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); if ($conf->global->TAKEPOS_DIRECT_PAYMENT) { - $menus[$r++] = array('title'=>'
'.$langs->trans("DirectPayment").'
', 'action'=>'DirectPayment();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("DirectPayment").' ('.$langs->trans("Cash").')
', 'action'=>'DirectPayment();'); } // BAR RESTAURANT specific menu From 7c4e737668ad84c54bcf45a7be4b00f6d8c6b96c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:53:55 +0200 Subject: [PATCH 43/75] Clean code --- htdocs/core/modules/modAsset.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index c11cf34d257..ebceca2960e 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -102,9 +102,7 @@ class modAsset extends DolibarrModules // Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), // 1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) // ); - $this->const = array( - //1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + $this->const = array(); if (!isset($conf->asset) || !isset($conf->asset->enabled)) From 8bb11039dce1f5a2a60ed459d16580b5434ff7c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 09:56:04 +0200 Subject: [PATCH 44/75] Clean code --- .../modulebuilder/template/core/modules/modMyModule.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index a580a655d85..71fc16f09cd 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -136,9 +136,7 @@ class modMyModule extends DolibarrModules // Example: $this->const=array(1 => array('MYMODULE_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1), // 2 => array('MYMODULE_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // ); - $this->const = array( - // 1 => array('MYMODULE_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) - ); + $this->const = array(); // Some keys to add into the overwriting translation tables /*$this->overwrite_translation = array( From 5b3670f30078811b77ba400ea2fc07b5fa7825d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 13:48:00 +0200 Subject: [PATCH 45/75] FIX SQL syntax error when editing extrafields Conflicts: htdocs/core/lib/security.lib.php --- htdocs/core/db/mysqli.class.php | 4 +- htdocs/core/db/pgsql.class.php | 13 ++--- htdocs/core/lib/security.lib.php | 65 ++++++++--------------- htdocs/core/modules/modDebugBar.class.php | 2 +- htdocs/core/modules/modSyslog.class.php | 2 +- 5 files changed, 32 insertions(+), 54 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7c0d680662d..9c023a05478 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -806,7 +806,7 @@ class DoliDBMysqli extends DoliDB $sql .= $field_desc['type']; if (preg_match("/^[^\s]/i", $field_desc['value'])) { - if (!in_array($field_desc['type'], array('date', 'datetime'))) + if (!in_array($field_desc['type'], array('date', 'datetime')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } @@ -853,7 +853,7 @@ class DoliDBMysqli extends DoliDB // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { + if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } if ($field_desc['null'] == 'not null' || $field_desc['null'] == 'NOT NULL') diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index bf9b468d4a8..6b71366c46c 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1126,11 +1126,12 @@ class DoliDBPgsql extends DoliDB // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if (preg_match("/^[^\s]/i", $field_desc['value'])) - if (!in_array($field_desc['type'], array('int', 'date', 'datetime'))) - { - $sql .= "(".$field_desc['value'].")"; - } + if (preg_match("/^[^\s]/i", $field_desc['value'])) { + if (!in_array($field_desc['type'], array('int', 'date', 'datetime')) && $field_desc['value']) + { + $sql .= "(".$field_desc['value'].")"; + } + } if (preg_match("/^[^\s]/i", $field_desc['attribute'])) $sql .= " ".$field_desc['attribute']; if (preg_match("/^[^\s]/i", $field_desc['null'])) @@ -1167,7 +1168,7 @@ class DoliDBPgsql extends DoliDB // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; - if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { + if (in_array($field_desc['type'], array('double', 'tinyint', 'int', 'varchar')) && $field_desc['value']) { $sql .= "(".$field_desc['value'].")"; } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1aec703de4a..3ee5739bc6d 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -223,52 +223,39 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f // Check read permission from module $readok = 1; $nbko = 0; - foreach ($featuresarray as $feature) // first we check nb of test ko - { + foreach ($featuresarray as $feature) { // first we check nb of test ko $featureforlistofmodule = $feature; if ($featureforlistofmodule == 'produit') $featureforlistofmodule = 'product'; - if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) // If limits on modules for external users, module must be into list of modules for external users - { + if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users $readok = 0; $nbko++; continue; } if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'contact') { + } elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'produit|service') { + } elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'prelevement') { + } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; } - } - elseif ($feature == 'cheque') { + } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; } - } - elseif ($feature == 'projet') { + } elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; } - } - elseif (!empty($feature2)) // This is for permissions on 2 levels - { + } elseif (!empty($feature2)) { // This is for permissions on 2 levels $tmpreadok = 1; - foreach ($feature2 as $subfeature) - { + foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid) continue; // A user can always read its own card if (!empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok = 0; } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok = 0; } else { $tmpreadok = 1; break; } // Break is to bypass second test if the first is ok } - if (!$tmpreadok) // We found a test on feature that is ko - { + if (!$tmpreadok) { // We found a test on feature that is ko $readok = 0; // All tests are ko (we manage here the and, the or will be managed later using $nbko). $nbko++; } - } - elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) // This is permissions on 1 level - { + } elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) { // This is permissions on 1 level if (empty($user->rights->$feature->lire) && empty($user->rights->$feature->read) && empty($user->rights->$feature->run)) { $readok = 0; $nbko++; } @@ -292,29 +279,21 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f { if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'produit|service') { + } elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'prelevement') { + } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'commande_fournisseur') { + } elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; } - } - elseif ($feature == 'banque') { + } elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } - } - elseif ($feature == 'cheque') { + } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } - } - elseif ($feature == 'ecm') { + } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } - elseif (!empty($feature2)) // This is for permissions on one level - { - foreach ($feature2 as $subfeature) - { + elseif (!empty($feature2)) { // This is for permissions on one level + foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) continue; // User can edit its own card if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) continue; // User can edit its own password @@ -329,10 +308,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f break; } } - } - elseif (!empty($feature)) // This is for permissions on 2 levels ('creer' or 'write') - { - //print '
feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; + } elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write') + //print '
feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; exit; if (empty($user->rights->$feature->creer) && empty($user->rights->$feature->write) && empty($user->rights->$feature->create)) { diff --git a/htdocs/core/modules/modDebugBar.class.php b/htdocs/core/modules/modDebugBar.class.php index bf2bc640c44..f89f3659285 100644 --- a/htdocs/core/modules/modDebugBar.class.php +++ b/htdocs/core/modules/modDebugBar.class.php @@ -54,7 +54,7 @@ class modDebugBar extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto = 'technic'; + $this->picto = 'bug'; $this->module_parts = array('moduleforexternal' => 0); diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index 91e90d6540f..01079310e4b 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -58,7 +58,7 @@ class modSyslog extends DolibarrModules // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. - $this->picto = 'technic'; + $this->picto = 'bug'; // Data directories to create when module is enabled $this->dirs = array(); From b64fc7dc3f9e1ca1ff57c5583151853b6f90be24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 14:37:36 +0200 Subject: [PATCH 46/75] FIX Avoid warning when creating a module with already existing files --- htdocs/modulebuilder/index.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 118718db57e..30cde322422 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -151,20 +151,17 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/sql/data.sql'); dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql'); - dol_delete_dir($destdir.'/sql'); dol_delete_file($destdir.'/class/actions_'.strtolower($modulename).'.class.php'); dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php'); - dol_delete_dir($destdir.'/class'); dol_delete_file($destdir.'/css/'.strtolower($modulename).'.css.php'); - dol_delete_dir($destdir.'/css'); dol_delete_file($destdir.'/js/'.strtolower($modulename).'.js.php'); - dol_delete_dir($destdir.'/js'); dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php'); - dol_delete_dir($destdir.'/scripts'); + + dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php'); // Delete some files related to Object (because the previous dolCopyDir has copied everything) dol_delete_file($destdir.'/myobject_card.php'); @@ -173,18 +170,21 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); - dol_delete_file($destdir.'/test/phpunit/MyModuleFunctionnalTest.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); - dol_delete_file($destdir.'/test/phpunit'); - dol_delete_file($destdir.'/test'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql'); dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); - dol_delete_dir($destdir.'/class'); - dol_delete_dir($destdir.'/sql'); + + dol_delete_dir($destdir.'/class', 1); + dol_delete_dir($destdir.'/sql', 1); + dol_delete_dir($destdir.'/scripts', 1); + dol_delete_dir($destdir.'/js', 1); + dol_delete_dir($destdir.'/css', 1); + dol_delete_dir($destdir.'/test/phpunit', 1); + dol_delete_dir($destdir.'/test', 1); } // Edit PHP files From 3d8d55a531881d7b3d4e60264fcbfb36234e95dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 14:42:09 +0200 Subject: [PATCH 47/75] Fix bad path in import section --- .../modulebuilder/template/core/modules/modMyModule.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 71fc16f09cd..5aecfe915c8 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -333,7 +333,7 @@ class modMyModule extends DolibarrModules $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='myobject@mymodule'; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); @@ -363,7 +363,7 @@ class modMyModule extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r]='myobject@mymodule'; - $keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; + $keyforclass = 'MyObject'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; $keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@mymodule'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; From f34a3785f07c17e4b9f8ad5c06a6367cae841253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 16:02:08 +0200 Subject: [PATCH 48/75] FIX CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 06feb97c2dd..ef6dd9a2b68 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -614,10 +614,10 @@ textarea.centpercent { padding-: 2px; } .paddingtop { - padding-bottom: 4px; + padding-top: 4px; } .paddingtop2 { - padding-bottom: 2px; + padding-top: 2px; } .paddingbottom { padding-bottom: 4px; From 9bb0ef04f54a240b7ebf0f98f0bc3a394cd63959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 18:07:51 +0200 Subject: [PATCH 49/75] Fix upload of file in import module --- htdocs/core/lib/security.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ee5739bc6d..72713393025 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -289,6 +289,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } + } elseif ($feature == 'import') { + if (!$user->rights->import->run) { $createok = 0; $nbko++; } } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } From 6553c40bea8f467b58d79945e0b1b3bde74181d3 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 30 Jun 2020 11:23:55 +0200 Subject: [PATCH 50/75] FIX : create a deposit with amount using comma didn't work --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ff7a1714757..a65d7f6ed81 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1255,7 +1255,8 @@ if (empty($reshook)) if ($_POST['type'] == Facture::TYPE_DEPOSIT) { $typeamount = GETPOST('typedeposit', 'alpha'); - $valuedeposit = GETPOST('valuedeposit', 'int'); + $valuedeposit = GETPOST('valuedeposit'); + $valuedeposit = price2num($valuedeposit, 'MU'); $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) From 4f1ac84a199059a63e373ad7416ce6ebc37383d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 12:07:24 +0200 Subject: [PATCH 51/75] Fix can't find link to edit table plan --- htdocs/langs/en_US/cashdesk.lang | 3 ++- htdocs/takepos/admin/bar.php | 23 ++++++++++++++++++++--- htdocs/takepos/admin/setup.php | 1 + htdocs/takepos/index.php | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 71a2a992e19..4494e10545d 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -111,4 +111,5 @@ AutoOrder=Order by the customer himself RestaurantMenu=Menu CustomerMenu=Customer menu ScanToMenu=Scan QR code to see the menu -ScanToOrder=Scan QR code to order \ No newline at end of file +ScanToOrder=Scan QR code to order +DefineTablePlan=Define table plan \ No newline at end of file diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 97f651efdb2..3d4bd490dde 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -66,12 +66,14 @@ if (GETPOST('action', 'alpha') == 'set') $form = new Form($db); $formproduct = new FormProduct($db); -llxHeader('', $langs->trans("CashDeskSetup")); +$arrayofcss = array("/takepos/css/colorbox.css"); + +llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); -dol_fiche_head($head, 'bar', 'TakePOS', -1); +dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); print '
'; @@ -80,6 +82,20 @@ print '
'; print ''; print ''; +?> + + + + '.$langs->trans("DefineTablePlan").'
'; +print '

'; + print '
'; print ''; print ''; @@ -138,9 +154,9 @@ print ''; - print '
'; print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '
'; + if ($conf->global->TAKEPOS_AUTO_ORDER) { print '
'; @@ -168,6 +184,7 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print '
'; } + if ($conf->global->TAKEPOS_QR_MENU) { $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 03607409ea7..a6f8b4968cc 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -121,6 +121,7 @@ if ($action != '') { } } + /* * View */ diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f4b83138416..63bbc5d1808 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -433,7 +433,7 @@ function CloseBill() { } function Floors() { - console.log("Open box to select floor"); + console.log("Open box to select floor place="+place); $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"trans("Floors"); ?>"}); } From 5afd518718ab4a58308333c451fa42f2c94b5fe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 13:06:44 +0200 Subject: [PATCH 52/75] Update vat rate for Congo --- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++++ htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 0888c68783c..afd3a762ccc 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -86,6 +86,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT standard rate',1); +-- CONGO = REPUBLIQUE DU CONGO (id country=72) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); + -- CYPRUS (id country=78) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT Rate 9',1); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 2a7fc17e77e..1d543fad548 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -322,3 +322,5 @@ UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL; ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); From 918e669c98755e896326380e3cfc5a3e45dbf03d Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 30 Jun 2020 16:33:18 +0200 Subject: [PATCH 53/75] FIX change selected fields on company card --- htdocs/societe/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d277632c348..d2f27419e76 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -846,6 +846,11 @@ if (empty($reshook)) $id=$socid; $object->fetch($socid); + // Selection of new fields + if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD) && (empty($conf->global->SOCIETE_DISABLE_CONTACTS) || !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))) { + include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; + } + // Actions to send emails $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; From 5f37f54675ff7637c88136a04672552f2d437820 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:16:06 +0200 Subject: [PATCH 54/75] Fix warning --- htdocs/master.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 4005e6a2ed5..0db06b121fd 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -49,7 +49,7 @@ $conf->db->host = $dolibarr_main_db_host; $conf->db->port = $dolibarr_main_db_port; $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; -$conf->db->pass = $dolibarr_main_db_pass; +$conf->db->pass = empty($dolibarr_main_db_pass)?'':$dolibarr_main_db_pass; $conf->db->type = $dolibarr_main_db_type; $conf->db->prefix = $dolibarr_main_db_prefix; $conf->db->character_set = $dolibarr_main_db_character_set; From 5f2486049eefff6ab31501bb6e3b6bb2b14813f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:22:15 +0200 Subject: [PATCH 55/75] Fix trans --- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/banks.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6e5c2c83d6..0bfa4cfd2db 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1491,7 +1491,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Direct debit order if (!empty($conf->prelevement->enabled)) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7a36346733f..75f9549dca5 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -37,6 +37,7 @@ IbanValid=BAN valid IbanNotValid=BAN not valid StandingOrders=Direct debit orders StandingOrder=Direct debit order +PaymentByDirectDebit=Payment by direct debit PaymentByBankTransfers=Payments by credit transfer PaymentByBankTransfer=Payment by credit transfer AccountStatement=Account statement From e2a9743dd403e9274b82959b9cb375872ebe5e97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 14:19:47 +0200 Subject: [PATCH 56/75] Debug module credit transfer --- htdocs/compta/facture/prelevement.php | 76 +++++++++++++------ htdocs/compta/paymentbybanktransfer/index.php | 11 +-- .../class/bonprelevement.class.php | 21 +++-- htdocs/compta/prelevement/create.php | 7 +- htdocs/compta/prelevement/index.php | 7 +- htdocs/core/lib/fourn.lib.php | 4 +- 6 files changed, 83 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index dd9c1394563..b24723330a0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -48,13 +48,12 @@ $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); $type = GETPOST('type', 'aZ09'); -$mode = GETPOST('mode', 'aZ09'); $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $object = new FactureFournisseur($db); } else { $object = new Facture($db); @@ -94,6 +93,7 @@ if (empty($reshook)) $sourcetype = 'facture'; if ($type == 'bank-transfer') { $sourcetype = 'supplier_invoice'; + $newtype = 'bank-transfer'; } $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); @@ -119,7 +119,7 @@ if (empty($reshook)) $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&mode='.$mode); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type); exit; } } @@ -135,7 +135,7 @@ $form = new Form($db); $now = dol_now(); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer'); $helpurl = ""; } else { @@ -170,7 +170,7 @@ if ($object->id > 0) if ($object->paye) $resteapayer = 0; $resteapayeraffiche = $resteapayer; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice @@ -204,7 +204,7 @@ if ($object->id > 0) $author->fetch($object->user_author); } - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $head = facturefourn_prepare_head($object); } else { $head = facture_prepare_head($object); @@ -213,7 +213,7 @@ if ($object->id > 0) dol_fiche_head($head, 'standingorders', $title, -1, 'bill'); // Invoice content - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $linkback = ''.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; @@ -221,7 +221,7 @@ if ($object->id > 0) $morehtmlref = '
'; // Ref customer - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); } else { @@ -230,7 +230,7 @@ if ($object->id > 0) } // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } else { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; @@ -290,7 +290,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_REPLACEMENT) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facreplaced = new FactureFournisseur($db); } else { $facreplaced = new Facture($db); @@ -300,7 +300,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_CREDIT_NOTE) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facusing = new FactureFournisseur($db); } else { $facusing = new Facture($db); @@ -318,7 +318,7 @@ if ($object->id > 0) { if ($i == 0) print ' '; else print ','; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facavoir = new FactureFournisseur($db); } else { $facavoir = new Facture($db); @@ -341,7 +341,7 @@ if ($object->id > 0) // Discounts print '
'.$langs->trans('Discounts').''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { //$societe = new Fournisseur($db); //$result = $societe->fetch($object->socid); $thirdparty = $object->thirdparty; @@ -357,7 +357,7 @@ if ($object->id > 0) print '
'.$form->editfieldkey("Label", 'label', $object->label, $object, 0).''.$form->editfieldval("Label", 'label', $object->label, $object, 0).'
'.$langs->trans($title).''; @@ -649,7 +649,7 @@ if ($object->id > 0) print "\n
\n"; $buttonlabel = $langs->trans("MakeWithdrawRequest"); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $buttonlabel = $langs->trans("MakeBankTransferOrder"); } @@ -665,6 +665,7 @@ if ($object->id > 0) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -694,7 +695,7 @@ if ($object->id > 0) print "

\n"; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print '
'.$langs->trans("DoCreditTransferBeforePayments").'

'; } else { print '
'.$langs->trans("DoStandingOrdersBeforePayments").'

'; @@ -711,7 +712,7 @@ if ($object->id > 0) print '
'.$langs->trans("DateRequest").''.$langs->trans("User").''.$langs->trans("Amount").''.$langs->trans("BankTransferReceipt").''.$langs->trans("WithdrawalReceipt").'
'.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''.price($obj->amount).'- '.$langs->trans("OrderWaiting").''; - print ''; + print ''; print img_delete(); print '
'.dol_print_date($db->jdate($obj->date_demande), 'day')."'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''.price($obj->amount).'

'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.rowid as socid"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print '
'; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print '
'.$langs->trans("Invoice").''.$langs->trans($tradinvoice).''.$langs->trans("ThirdParty").''.$langs->trans("RIB").''.$langs->trans("RUM").'

'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.rowid as socid"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print '
'; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print '
'; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +225,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
'.$langs->trans("LatestBankTransferReceipts", $limit).'
'.$langs->trans("LatestBankTransferReceipts", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
'.$langs->trans("None").'
'.$langs->trans("None").'

"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 193d352ae35..5db9ccde671 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -118,7 +119,7 @@ class BonPrelevement extends CommonObject /** * Add invoice to withdrawal * - * @param int $facture_id id invoice to add + * @param int $invoice_id id invoice to add * @param int $client_id id invoice customer * @param string $client_nom customer name * @param int $amount amount of invoice @@ -126,14 +127,16 @@ class BonPrelevement extends CommonObject * @param string $code_guichet code of bank's office * @param string $number bank account number * @param string $number_key number key of account number + * @param string $type 'debit-order' or 'bank-transfer' * @return int >0 if OK, <0 if KO */ - public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) + public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order') { // phpcs:enable $result = 0; $line_id = 0; + // Add lines $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key); if ($result == 0) @@ -141,10 +144,14 @@ class BonPrelevement extends CommonObject if ($line_id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture ("; - $sql .= "fk_facture"; + if ($type != 'bank-transfer') { + $sql .= "fk_facture"; + } else { + $sql .= "fk_facture_fourn"; + } $sql .= ",fk_prelevement_lignes"; $sql .= ") VALUES ("; - $sql .= $facture_id; + $sql .= $invoice_id; $sql .= ", ".$line_id; $sql .= ")"; @@ -155,19 +162,19 @@ class BonPrelevement extends CommonObject else { $result = -1; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -2; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -3; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } return $result; @@ -686,7 +693,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns amount of withdrawal + * Returns amount waiting for direct debit payment or credit transfer payment * * @param string $mode 'direct-debit' or 'bank-transfer' * @return double db->query($sql); @@ -749,7 +757,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Get number of invoices to withdrawal + * Get number of invoices to pay * * @param string $type 'direct-debit' or 'bank-transfer' * @return int global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; @@ -874,6 +893,12 @@ class BonPrelevement extends CommonObject { $row = $this->db->fetch_row($resql); $factures[$i] = $row; // All fields + if ($row[7] == 0) { + $error++; + dol_syslog(__METHOD__."::Read invoices error Found a null invoice", LOG_ERR); + $this->invoice_in_error[$row[0]] = "Error for invoice id ".$row[0].", found a null amount"; + break; + } $i++; } $this->db->free($resql); @@ -891,15 +916,19 @@ class BonPrelevement extends CommonObject require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $soc = new Societe($this->db); - // Check RIB + // Check BAN $i = 0; - dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG); + dol_syslog(__METHOD__."::Check BAN", LOG_DEBUG); if (count($factures) > 0) { foreach ($factures as $key => $fac) { - $fact = new Facture($this->db); + if ($type != 'bank-transfer') { + $fact = new Facture($this->db); + } else { + $fact = new FactureFournisseur($this->db); + } $resfetch = $fact->fetch($fac[0]); if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice { @@ -908,13 +937,15 @@ class BonPrelevement extends CommonObject $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $soc->id); - if ($format == 'FRST' && $bac->frstrecur != 'FRST') - { - continue; - } - if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) - { - continue; + if ($type != 'bank-transfer') { + if ($format == 'FRST' && $bac->frstrecur != 'FRST') + { + continue; + } + if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) + { + continue; + } } if ($bac->verif() >= 1) @@ -927,32 +958,32 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read invoice", LOG_WARNING); } } } else { - dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN No invoice to process", LOG_WARNING); } } $ok = 0; // Withdraw invoices in factures_prev array - $out = count($factures_prev)." invoices will be withdrawn."; + $out = count($factures_prev)." invoices will be included."; //print $out."\n"; dol_syslog($out); @@ -982,14 +1013,14 @@ class BonPrelevement extends CommonObject { /* * We are in real mode. - * We create withdraw receipt and build withdraw into disk + * We create order and build file into disk */ $this->db->begin(); $now = dol_now(); /* - * Traitements + * Process order generation */ if (!$error) { @@ -1001,7 +1032,7 @@ class BonPrelevement extends CommonObject $sql .= " AND entity = ".$conf->entity; $sql .= " ORDER BY ref DESC LIMIT 1"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1009,18 +1040,23 @@ class BonPrelevement extends CommonObject $row = $this->db->fetch_row($resql); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT); - $dir = $conf->prelevement->dir_output.'/receipts'; + if ($type != 'bank-transfer') { + $dir = $conf->prelevement->dir_output.'/receipts'; + } else { + $dir = $conf->paymentbybanktransfer->dir_output.'/receipts'; + } if (!is_dir($dir)) dol_mkdir($dir); $this->filename = $dir.'/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; - $sql .= " ref, entity, datec"; + $sql .= " ref, entity, datec, type"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($ref)."'"; $sql .= ", ".$conf->entity; $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'"; $sql .= ")"; $resql = $this->db->query($sql); @@ -1058,7 +1094,9 @@ class BonPrelevement extends CommonObject /* * Add standing order * - * + * $fac[0] : invoice_id + * $fac[1] : ??? + * $fac[2] : third party id * $fac[3] : banque * $fac[4] : guichet * $fac[5] : number @@ -1067,7 +1105,8 @@ class BonPrelevement extends CommonObject * $fac[8] : client nom * $fac[2] : client id */ - $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]); + + $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type); if ($ri <> 0) { $error++; @@ -1080,13 +1119,12 @@ class BonPrelevement extends CommonObject $sql .= ", fk_prelevement_bons = ".$this->id; $sql .= " WHERE rowid = ".$fac[1]; - dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; - dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR); + dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR); } } } @@ -1095,11 +1133,10 @@ class BonPrelevement extends CommonObject if (!$error) { /* - * Create direct debit order in a XML file + * Create file of direct debit order or credit transfer into a XML file */ - dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG); - + dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG); if (count($factures_prev) > 0) { @@ -1126,7 +1163,7 @@ class BonPrelevement extends CommonObject $this->context['factures_prev'] = $factures_prev; // Generation of SEPA file $this->filename - $this->generate($format, $executiondate); + $result = $this->generate($format, $executiondate); } dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } @@ -1149,8 +1186,13 @@ class BonPrelevement extends CommonObject if (!$error && !$notrigger) { + $triggername = 'DIRECT_DEBIT_ORDER_CREATE'; + if ($type != 'bank-transfer') { + $triggername = 'CREDIT_TRANSFER_ORDER_CREATE'; + } + // Call trigger - $result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user); + $result = $this->call_trigger($triggername, $user); if ($result < 0) $error++; // End call triggers } @@ -1419,9 +1461,9 @@ class BonPrelevement extends CommonObject * - Others countries: Warning message * File is generated with name this->filename * - * @param string $format FRST, RCUR or ALL - * @param string $executiondate Date to execute transfer - * @return int 0 if OK, <0 if KO + * @param string $format FRST, RCUR or ALL + * @param string $executiondate Date to execute transfer + * @return int >=0 if OK, <0 if KO */ public function generate($format = 'ALL', $executiondate = '') { @@ -1468,7 +1510,7 @@ class BonPrelevement extends CommonObject $this->total = 0; /* - * section Debiteur (sepa Debiteurs bloc lines) + * Section Debitor (sepa Debiteurs bloc lines) */ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; @@ -1593,13 +1635,15 @@ class BonPrelevement extends CommonObject $langs->load('withdrawals'); // TODO Add here code to generate a generic file - fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code)); + fputs($this->file, $langs->transnoentitiesnoconv('WithdrawalFileNotCapable', $mysoc->country_code)); } fclose($this->file); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($this->file, octdec($conf->global->MAIN_UMASK)); - return $result; + } + + return $result; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index f05e4f422d4..a6bc41734d4 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -5,7 +5,7 @@ * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France - * Copyright (C) 2019 Markus Welters + * Copyright (C) 2019 Markus Welters * * 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 @@ -24,7 +24,7 @@ /** * \file htdocs/compta/prelevement/create.php * \ingroup prelevement - * \brief Prelevement creation page + * \brief Page to create a direct debit order or a credit transfer order */ require '../../main.inc.php'; @@ -77,11 +77,17 @@ if (empty($reshook)) } if ($action == 'create') { - // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty + $delayindays = 0; + if ($type != 'bank-transfer') { + $conf->global->PRELEVEMENT_ADDDAYS; + } else { + $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS; + } $bprev = new BonPrelevement($db); - $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); + $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int')); - $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate); + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore) + $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type); if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); @@ -257,8 +263,10 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND f.total_ttc > 0"; +//$sql .= " AND pfd.amount > 0"; +$sql .= " AND f.total_ttc > 0"; // Avoid credit notes $sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; if ($type == 'bank-transfer') { $sql .= " AND pfd.fk_facture_fourn = f.rowid"; } else { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 72c318a1024..ef451146f55 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/prelevement/index.php * \ingroup prelevement - * \brief Prelevement index page + * \brief Home page for direct debit orders */ @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -176,8 +178,9 @@ print '
'; /* - * Withdraw receipts + * Direct debit orders */ + $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; @@ -194,7 +197,8 @@ if ($result) print"\n\n"; print '
'; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +226,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
'.$langs->trans("LastWithdrawalReceipt", $limit).'
'.$langs->trans("LastWithdrawalReceipt", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
'.$langs->trans("None").'
'.$langs->trans("None").'

"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e80d433e7e0..730e66eaab8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2388,44 +2388,44 @@ class Societe extends CommonObject $label .= '
'; - if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') + if ($option == 'customer' || $option == 'compta' || $option == 'category') { - $label .= ''.$langs->trans("ShowCustomer").''; + $label .= ''.$langs->trans("Customer").''; $linkstart = ''; + $label .= ''.$langs->trans("Prospect").''; $linkstart = ''; + $label .= ''.$langs->trans("Supplier").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = 'LT12 1000 0111 0100 1000
FR14 2004 1010 0505 0001 3M02 606
LU28 0019 4006 4475 0000
DE89 3704 0044 0532 0130 00'; } elseif ($val == 'BIC') { $name = 'bic'; $size = 12; + $content = $companybankaccount->bic; if ($companybankaccount->needIBAN()) $require = true; + $tooltip = $langs->trans("Example").': LIABLT2XXXX'; } - print ''.$langs->trans($val).''; + print ''; + if ($tooltip) { + print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); + } else { + print $langs->trans($val); + } + print ''; print ''; print ''; } From d6ded950ac9d0f6eca6ef3996d57c2524f5a392b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:07:18 +0200 Subject: [PATCH 64/75] Update doc --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a39c27e119f..edb66756ff2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -104,8 +104,8 @@ NEW: class tool for converting units NEW: Close #13011 Add button create thirdparty when creating intervention NEW: Colorful theme for TakePOS NEW: columns units in product list -NEW: compatibility of translabel with more dict -NEW: Confirm file delete on fracture card +NEW: compatibility of translabel with more dictionaries +NEW: Confirm file delete on invoice card NEW: "contact_civility" for ODT templates NEW: CUPS printing compatibility for TakePOS NEW: Customer command list - Add date start & date end @@ -113,16 +113,11 @@ NEW: display weight in shipment list NEW: Documentation about PHP support in Dolibarr NEW: Donation - Update FR CERFA to 11580*04 NEW: Easier way to setup the different types of tax. Better visibility. -NEW: enable put for agendaevents api NEW: Expedition list - Add date start & date end NEW: Experiment supplier packaging with option PRODUCT_USE_SUPPLIER_PACKAGING: Using price according to the minimum quantity NEW: Export module, add extrafields for Contract and Contract line NEW: Extend retained warranty to be available for all invoices -NEW: filter by product on supplier order API NEW: French new regions -NEW: get documents for categories with RESP API -NEW: get proposal by ref with API -NEW: Hidden option MAIN_TEMP_DIR NEW: hook and data id NEW: hook on ics generation to add more events in eventarray NEW: hook on product load stats @@ -209,6 +204,11 @@ NEW: Bookkeeping by account - Add selectfields & hook NEW: Can force position of legend of graph on right (instead of top) NEW: Can change destination of "Back to list" using a "backtolist" parameter NEW: add more category types from hook +NEW: enable put for agendaevents api +NEW: filter by product on supplier order API +NEW: get documents for categories with RESP API +NEW: get proposal by ref with API +NEW: Hidden option MAIN_TEMP_DIR WARNING: From d76ca6f569588de73f7156040b8838921e5d82ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:09:52 +0200 Subject: [PATCH 65/75] Update doc --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index edb66756ff2..19c77c702fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -190,7 +190,6 @@ NEW: API filter bankaccounts by category NEW: API filter contacts by category NEW: API filter members by category NEW: API filter projects by category -NEW: API filter thirdpartie by category NEW: API filter thirdparty by category NEW: API filter user by category NEW: API filter warehouses by categorie From a5431a40daf64c1e7025ba3e838cee2cea2fb7a0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Jul 2020 10:16:20 +0200 Subject: [PATCH 66/75] FIX missing possibility to change entity when propal cloning --- htdocs/comm/propal/card.php | 15 +++++++-------- htdocs/comm/propal/class/propal.class.php | 4 +++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 28fdc7845d2..996ad2e31af 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -194,7 +194,7 @@ if (empty($reshook)) } } - $result = $object->createFromClone($user, $socid); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1832,10 +1832,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("CreateEmptyPropal").''; + print ''; } - if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; - dol_fiche_end(); $langs->load("bills"); @@ -1878,11 +1877,11 @@ if ($action == 'create') if ($action == 'clone') { // Create an array for form $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => - // 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0101805cd88..3fd122c0103 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1324,9 +1324,10 @@ class Propal extends CommonObject * * @param User $user User making the clone * @param int $socid Id of thirdparty + * @param int $forceentity Entity id to force * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0) + public function createFromClone(User $user, $socid = 0, $forceentity = null) { global $conf, $hookmanager; @@ -1382,6 +1383,7 @@ class Propal extends CommonObject $object->id = 0; $object->ref = ''; + $object->entity = (! empty($forceentity) ? $forceentity : $object->entity); $object->statut = self::STATUS_DRAFT; // Clear fields From 642e75c3dd29b03d7eaf71f21678f05d2f5521d1 Mon Sep 17 00:00:00 2001 From: quentin Date: Thu, 2 Jul 2020 11:34:59 +0200 Subject: [PATCH 67/75] FIX wrong origin --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54506a4a816..c92de067c8e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1014,7 +1014,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - + $origin = !empty($line->origin) ? $line->origin : $this->element; $result = $this->addline( $line->desc, $line->subprice, @@ -1039,7 +1039,7 @@ class Commande extends CommonOrder $line->label, $line->array_options, $line->fk_unit, - $this->element, + $origin, $line->id ); if ($result < 0) From 16b327f1066ab297ef065f4ed959433c671a2fb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 15:45:11 +0200 Subject: [PATCH 68/75] Debug module credit transfer --- htdocs/compta/prelevement/create.php | 20 ++++++++++++++++---- htdocs/langs/en_US/withdrawals.lang | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index a6bc41734d4..80055b20d72 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2015 Laurent Destailleur + * Copyright (C) 2010-2020 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI @@ -120,7 +120,11 @@ if (empty($reshook)) $form = new Form($db); $thirdpartystatic = new Societe($db); -$invoicestatic = new Facture($db); +if ($type != 'bank-transfer') { + $invoicestatic = new Facture($db); +} else { + $invoicestatic = new FactureFournisseur($db); +} $bprev = new BonPrelevement($db); llxHeader('', $langs->trans("NewStandingOrder")); @@ -183,6 +187,7 @@ print '
'."\n"; print ''; print ''; +print ''; if ($nb) { if ($pricetowithdraw) { print $langs->trans('ExecutionDate').' '; @@ -190,8 +195,13 @@ if ($nb) { if ($mysoc->isInEEC()) { $title = $langs->trans("CreateForSepa"); + if ($type == 'bank-transfer') { + $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer"); + } - print ''; + if ($type != 'bank-transfer') { + print ''; + } print ''; } else { $title = $langs->trans("CreateAll"); @@ -363,7 +373,9 @@ if ($resql) print ''; print $thirdpartystatic->display_rib('rum'); $format = $thirdpartystatic->display_rib('format'); - if ($format) print ' ('.$format.')'; + if ($type != 'bank-transfer') { + if ($format) print ' ('.$format.')'; + } print ''; // Amount print ''; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 1f9c91719da..df8aada28dc 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -10,8 +10,8 @@ PaymentByBankTransferReceipts=Credit transfer orders PaymentByBankTransferLines=Credit transfer order lines WithdrawalsReceipts=Direct debit orders WithdrawalReceipt=Direct debit order -BankTransferReceipts=Credit transfer receipts -BankTransferReceipt=Credit transfer receipt +BankTransferReceipts=Credit transfer order +BankTransferReceipt=Credit transfer order LatestBankTransferReceipts=Latest %s credit transfer orders LastWithdrawalReceipts=Latest %s direct debit files WithdrawalsLine=Direct debit order line From 6c01cc16f8fc46667d55c5b5a7af619f48caa0a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:14:22 +0200 Subject: [PATCH 69/75] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c92de067c8e..e356a4d5936 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1014,7 +1014,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - $origin = !empty($line->origin) ? $line->origin : $this->element; + $origin = (!empty($line->origin) ? $line->origin : $this->element); $result = $this->addline( $line->desc, $line->subprice, From 0a13e037923e34cd149ded1085bb521277b499c6 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 1 Jul 2020 22:19:10 +0200 Subject: [PATCH 70/75] FIX : Correct ModuleBuilder left menu --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 30cde322422..ee750447636 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2934,7 +2934,7 @@ elseif (!empty($module)) print ''; print ''; - print $menu['left']; + print $menu['leftmenu']; print ''; print ''; From bce0a93227cf989c0a8ebde77b1033da81b3a9ad Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 30 Jun 2020 15:20:30 +0200 Subject: [PATCH 71/75] Hotfix for an error in v12 --- htdocs/comm/propal/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 996ad2e31af..8f743015f06 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1138,6 +1138,9 @@ if (empty($reshook)) $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records + if ($ret > 0) { + $object->fetch_thirdparty(); + } $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } From b45bfd258df2e7ab09e707fb5e4850a19b091116 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:53:48 +0200 Subject: [PATCH 72/75] fix #14143 --- htdocs/core/class/evalmath.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index b0fcc963eba..984324a7563 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -194,7 +194,7 @@ class EvalMath * * @return string Output */ - private function vars() + public function vars() { $output = $this->v; unset($output['pi']); From fd617658efd5c51a822eea2d816de81ca7942292 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:36:56 +0200 Subject: [PATCH 73/75] Fix syntax --- htdocs/core/class/evalmath.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 984324a7563..7e02aa57032 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -270,10 +270,11 @@ class EvalMath // =============== } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis? while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last ( - if (is_null($o2)) + if (is_null($o2)) { return $this->trigger(5, "unexpected ')'", ")"); - else + } else { $output[] = $o2; + } } if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function? $fnn = $matches[1]; // get the function name @@ -293,10 +294,11 @@ class EvalMath // =============== } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument? while (($o2 = $stack->pop()) != '(') { - if (is_null($o2)) + if (is_null($o2)) { return $this->trigger(5, "unexpected ','", ","); // oops, never had a ( - else + } else { $output[] = $o2; // pop the argument expression stuff and push onto the output + } } // make sure there was a function if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) From 18fa4c41058a446ff57ec0c5a8cfcc10b083f1be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:38:31 +0200 Subject: [PATCH 74/75] Update card.php --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a65d7f6ed81..336b39224f1 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1255,8 +1255,7 @@ if (empty($reshook)) if ($_POST['type'] == Facture::TYPE_DEPOSIT) { $typeamount = GETPOST('typedeposit', 'alpha'); - $valuedeposit = GETPOST('valuedeposit'); - $valuedeposit = price2num($valuedeposit, 'MU'); + $valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU'); $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) From ca66eac76c86585536344be88935b229ff9d121a Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 29 Jun 2020 14:01:48 +0200 Subject: [PATCH 75/75] Update project.class.php Fix order of delete extra prev table of project --- htdocs/projet/class/project.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 860a6b6b92f..a0b6e38423b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,7 +747,18 @@ class Project extends CommonObject } } + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; + $sql .= " WHERE fk_object=".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } // Delete project if (!$error) @@ -763,18 +774,7 @@ class Project extends CommonObject } } - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } if (empty($error)) { // We remove directory