From 19bae333c90fb566ca96070df3a5aca3f4896e7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 9 May 2021 22:07:08 +0200 Subject: [PATCH 01/26] Add option MAIN_SHOW_PASSWORD_INTO_LOG --- htdocs/core/lib/functions.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9ce3948efdf..77f0df8379b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1386,7 +1386,9 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = return; } - $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log + if (empty($conf->global->MAIN_SHOW_PASSWORD_INTO_LOG)) { + $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log + } // If adding log inside HTML page is required if ((!empty($_REQUEST['logtohtml']) && !empty($conf->global->MAIN_ENABLE_LOG_TO_HTML)) From ed18045807bae1edcd874f9e738ace3db796ce75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 11:30:37 +0200 Subject: [PATCH 02/26] FIX The comment of a reception was not correctly managed --- htdocs/fourn/commande/dispatch.php | 2 +- htdocs/reception/card.php | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index b183092972e..ea061b157ce 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -397,7 +397,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fourn $qty = $supplierorderdispatch->qty; $entrepot = $supplierorderdispatch->fk_entrepot; $product = $supplierorderdispatch->fk_product; - $price = GETPOST('price'); + $price = price2num(GETPOST('price', 'alpha'), 'MU'); $comment = $supplierorderdispatch->comment; $eatby = $supplierorderdispatch->eatby; $sellby = $supplierorderdispatch->sellby; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 607efb9606b..07ddf19805c 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -328,8 +328,6 @@ if (empty($reshook)) { $sellby = "dluo".$i; $batch = "batch".$i; - $timeFormat = '%d/%m/%Y'; - if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; @@ -354,7 +352,6 @@ if (empty($reshook)) { $eatbydate = str_replace('/', '-', $eatby); $sellbydate = str_replace('/', '-', $sellby); - $ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha')); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -958,6 +955,7 @@ if ($action == 'create') { if ($numAsked) { print ''; print ''.$langs->trans("Description").''; + print ''.$langs->trans("Comment").''; print ''.$langs->trans("QtyOrdered").''; print ''.$langs->trans("QtyReceived").''; print ''.$langs->trans("QtyToReceive"); @@ -1056,18 +1054,22 @@ if ($action == 'create') { print "\n"; } + // Comment + //$defaultcomment = 'Line create from order line id '.$line->id; + $defaultcomment = ''; + print ''; + print ''; + print ''; + // Qty print ''.$line->qty; - print 'id.'\' />'; - print ''; + print ''; print ''; print ''; $qtyProdCom = $line->qty; // Qty already received print ''; - - $quantityDelivered = $object->receptions[$line->id]; print $quantityDelivered; print ''; @@ -1137,8 +1139,8 @@ if ($action == 'create') { print ''; } } - print "\n"; } + print "\n"; //Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines) > 0) { @@ -1584,7 +1586,7 @@ if ($action == 'create') { // Product/Service print ''.$langs->trans("Products").''; // Comment - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Comment").''; // Qty print ''.$langs->trans("QtyOrdered").''; if ($origin && $origin_id > 0) { @@ -1747,9 +1749,9 @@ if ($action == 'create') { } if ($action == 'editline' && $lines[$i]->id == $line_id) { - print ''; + print ''; } else { - print ''.$lines[$i]->comment.''; + print ''.dol_escape_htmltag($lines[$i]->comment).''; } @@ -1778,7 +1780,7 @@ if ($action == 'create') { $htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour')); if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) { $warehousestatic->fetch($receptionline_var['warehouse']); - $htmltext .= '
'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1); + $htmltext .= '
'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1); } print ' '.$form->textwithpicto('', $htmltext, 1); } From a2cd181435f52ff5d7062bee83019b1ab5738681 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 11:53:19 +0200 Subject: [PATCH 03/26] FIX Debug reception module --- htdocs/core/lib/pdf.lib.php | 2 +- .../modules/reception/doc/pdf_squille.modules.php | 12 ++++++++++++ htdocs/reception/class/reception.class.php | 9 ++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 086152a974b..d1c793c621c 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1233,7 +1233,7 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, /** * Output line description into PDF * - * @param TCPDF $pdf PDF object + * @param TCPDF $pdf PDF object * @param Object $object Object * @param int $i Current line number * @param Translate $outputlangs Object lang for output diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 4400cce2937..0e4474b6b8c 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -388,6 +388,18 @@ class pdf_squille extends ModelePdfReception // Description of product line $curX = $this->posxdesc - 1; + // The desc of line is not store into reception, so we force it to the value of product. + /* + if (empty($object->lines[0]->desc)) { + // TODO We must get value from fk_commendefourndet + $sqldesc = 'SELECT description FROM '.MAIN_DB_PREFIX.' WHERE rowid = '.((int) $object->lines[0]->fk_commandefourndet); + $resqldesc = $this->db->query($sqldesc); + if ($resqldesc) { + $objdesc = $this->db->fetch_object($resqldesc); + $object->lines[0]->desc = $objdesc->description; + } + }*/ + $pdf->startTransaction(); pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 946990f0c7b..33034f290d1 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1043,13 +1043,15 @@ class Reception extends CommonObject $line = new CommandeFournisseurDispatch($this->db); $line->fetch($obj->rowid); $line->fetch_product(); - $sql_commfourndet = 'SELECT qty, ref, label, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet; + $sql_commfourndet = 'SELECT qty, ref, label, description, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent'; + $sql_commfourndet .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet'; + $sql_commfourndet .= ' WHERE rowid = '.((int) $line->fk_commandefourndet); $resql_commfourndet = $this->db->query($sql_commfourndet); if (!empty($resql_commfourndet)) { $obj = $this->db->fetch_object($resql_commfourndet); $line->qty_asked = $obj->qty; - $line->description = $line->comment; - $line->desc = $line->comment; + $line->description = $obj->description; + $line->desc = $obj->description; $line->tva_tx = $obj->tva_tx; $line->vat_src_code = $obj->vat_src_code; $line->subprice = $obj->subprice; @@ -1060,6 +1062,7 @@ class Reception extends CommonObject } else { $line->qty_asked = 0; $line->description = ''; + $line->desc = ''; $line->label = $obj->label; } From 2dd3148e3f2eb7e026a98977b46ce1db7d8e758d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 15:24:07 +0200 Subject: [PATCH 04/26] Fix look and feel v14 --- htdocs/admin/commande_fournisseur_dispatch_extrafields.php | 2 +- htdocs/admin/reception_extrafields.php | 2 +- htdocs/admin/reception_setup.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php index d0c7c85463e..ac8f4fced4d 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php @@ -84,7 +84,7 @@ print "
\n"; $head = reception_admin_prepare_head(); -print dol_get_fiche_head($head, 'attributeslines_reception', $langs->trans("Receptions"), -1, 'sending'); +print dol_get_fiche_head($head, 'attributeslines_reception', $langs->trans("Receptions"), -1, 'reception'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/reception_extrafields.php b/htdocs/admin/reception_extrafields.php index ab7d18b1331..8e4205a7bdc 100644 --- a/htdocs/admin/reception_extrafields.php +++ b/htdocs/admin/reception_extrafields.php @@ -84,7 +84,7 @@ print "
\n"; $head = reception_admin_prepare_head(); -print dol_get_fiche_head($head, 'attributes_reception', $langs->trans("Receptions"), -1, 'sending'); +print dol_get_fiche_head($head, 'attributes_reception', $langs->trans("Receptions"), -1, 'reception'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 734c953a092..6ea6d195040 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -172,7 +172,7 @@ print load_fiche_titre($langs->trans("ReceptionsSetup"), $linkback, 'title_setup print '
'; $head = reception_admin_prepare_head(); -print dol_get_fiche_head($head, 'reception', $langs->trans("Receptions"), -1, 'sending'); +print dol_get_fiche_head($head, 'reception', $langs->trans("Receptions"), -1, 'reception'); // Reception numbering model diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 77f0df8379b..9316b871a08 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3511,7 +3511,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', 'error', 'warning', - 'recruitmentcandidature', 'recruitmentjobposition', 'resource', + 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'uncheck', 'user-cog', 'website', 'workstation', From 64992706193d51c4aa630aded01a87c91a98e6c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 15:29:23 +0200 Subject: [PATCH 05/26] v14 --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/modules/modAsset.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9316b871a08..727bfaee5b8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3598,7 +3598,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'info', 'project', 'workstation'))) { $morecss = 'em088'; } - if (in_array($pictowithouttext, array('intervention', 'payment', 'loan', 'partnership', 'stock', 'technic'))) { + if (in_array($pictowithouttext, array('asset', 'intervention', 'payment', 'loan', 'partnership', 'stock', 'technic'))) { $morecss = 'em080'; } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 12b58bfcc38..3a51a366970 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -69,7 +69,7 @@ class modAsset extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'accounting'; + $this->picto = 'asset'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable) From 73f63509e38e40f5afa689ccee04b1e4ef127614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 19:12:03 +0200 Subject: [PATCH 06/26] Fix permissions --- htdocs/reception/card.php | 41 +++++++++++++++++++++++------------- htdocs/reception/contact.php | 12 +++-------- htdocs/reception/note.php | 11 +++++----- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 07ddf19805c..4c8aeac030b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -117,6 +117,26 @@ $permissiondellink = $user->rights->reception->creer; // Used by the include of $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); +$object = new Reception($db); +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); + + if (!empty($object->origin)) { + $origin = $object->origin; + + $object->fetch_origin(); + $typeobject = $object->origin; + } + + // Linked documents + if ($origin == 'order_supplier' && $object->$typeobject->id && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))) { + $origin_id = $object->$typeobject->id; + $objectsrc = new CommandeFournisseur($db); + $objectsrc->fetch($object->$typeobject->id); + } +} + // Security check $socid = ''; if ($user->socid) { @@ -124,13 +144,10 @@ if ($user->socid) { } if ($origin == 'reception') { - $result = restrictedArea($user, $origin, $id); + $result = restrictedArea($user, 'reception', $id); } else { - $result = restrictedArea($user, 'reception'); - if ($origin == 'supplierorder') { - if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) { - accessforbidden(); - } + if ($origin == 'supplierorder' || $origin == 'order_supplier') { + $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { accessforbidden(); } @@ -150,14 +167,12 @@ if ($reshook < 0) { if (empty($reshook)) { if ($cancel) { $action = ''; - $object->fetch($id); // show reception also after canceling modification } include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once // Reopen if ($action == 'reopen' && $user->rights->reception->creer) { - $object->fetch($id); $result = $object->reOpen(); } @@ -192,7 +207,6 @@ if (empty($reshook)) { } if ($action == 'setref_supplier') { - $result = $object->fetch($id); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -528,14 +542,12 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); } } elseif ($action == 'classifybilled') { - $object->fetch($id); $result = $object->setBilled(); if ($result >= 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); } } elseif ($action == 'classifyclosed') { - $object->fetch($id); $result = $object->setClosed(); if ($result >= 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); @@ -543,7 +555,6 @@ if (empty($reshook)) { } } elseif ($action == 'deleteline' && !empty($line_id)) { // delete a line - $object->fetch($id); $lines = $object->lines; $line = new CommandeFournisseurDispatch($db); @@ -1331,7 +1342,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Linked documents if ($typeobject == 'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) { @@ -1495,11 +1506,11 @@ if ($action == 'create') { print '
'; print '
'; - print '
'; + print '
'; // Reception method print '
'; - print '
'; + print ''; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index c99b44074eb..7e293f3b67c 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -35,9 +35,7 @@ if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -$langs->load("orders"); -$langs->load("receptions"); -$langs->load("companies"); +$langs->loadLangs(array("orders", "receptions", "companies")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -62,7 +60,6 @@ if ($id > 0 || !empty($ref)) { } } - // Security check if ($user->socid > 0) { $socid = $user->socid; @@ -70,11 +67,8 @@ if ($user->socid > 0) { if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); } else { - $result = restrictedArea($user, 'reception'); - if ($origin == 'supplierorder') { - if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) { - accessforbidden(); - } + if ($origin == 'supplierorder' || $origin == 'order_supplier') { + $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { accessforbidden(); } diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index a3a2b31589c..d23aebd28b7 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -70,13 +70,14 @@ if ($user->socid > 0) { if ($origin == 'reception') { $result = restrictedArea($user, $origin, $object->id); } else { - $result = restrictedArea($user, 'reception'); - if ($origin == 'supplierorder') { - if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) { + if ($origin == 'reception') { + $result = restrictedArea($user, $origin, $object->id); + } else { + if ($origin == 'supplierorder' || $origin == 'order_supplier') { + $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); + } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { accessforbidden(); } - } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { - accessforbidden(); } } From 23d19a8af3ae7807dcdb37ea1f323b99dfa25f13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 19:20:17 +0200 Subject: [PATCH 07/26] Fix permissions --- htdocs/expedition/card.php | 27 +++++++++------------------ htdocs/expedition/contact.php | 7 ------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c204afcef72..0c7d51edcfe 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -82,21 +82,6 @@ if (empty($origin_id)) { $ref = GETPOST('ref', 'alpha'); $line_id = GETPOST('lineid', 'int') ?GETPOST('lineid', 'int') : ''; -// Security check -$socid = ''; -if ($user->socid) { - $socid = $user->socid; -} - -if ($origin == 'expedition') { - $result = restrictedArea($user, $origin, $id); -} else { - $result = restrictedArea($user, 'expedition'); - if (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { - accessforbidden(); - } -} - $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); @@ -121,18 +106,24 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expeditioncard', 'globalcard')); -$permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php -//var_dump($object->lines[0]->detail_batch); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + $object->fetch_thirdparty(); +} + // Security check +$socid = ''; if ($user->socid) { $socid = $user->socid; } $result = restrictedArea($user, 'expedition', $object->id, ''); +$permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php +//var_dump($object->lines[0]->detail_batch); + /* * Actions diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index cd9febc685d..f6f6fb7e1c7 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -108,13 +108,6 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) { dol_print_error($db); } } -/* -elseif ($action == 'setaddress' && $user->rights->expedition->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* From 1ca73e609c768f6ce591105e93c600d373545911 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 19:26:47 +0200 Subject: [PATCH 08/26] Clean code --- htdocs/reception/card.php | 1 - htdocs/reception/contact.php | 14 +------------- htdocs/reception/note.php | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4c8aeac030b..75f5401d401 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1334,7 +1334,6 @@ if ($action == 'create') { } $morehtmlref .= ''; - $object->picto = 'sending'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 7e293f3b67c..609cb0d12b7 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -113,13 +113,6 @@ if ($action == 'addcontact' && $user->rights->reception->creer) { dol_print_error($db); } } -/* -elseif ($action == 'setaddress' && $user->rights->reception->creer) -{ - $object->fetch($id); - $result=$object->setDeliveryAddress($_POST['fk_address']); - if ($result < 0) dol_print_error($db,$object->error); -}*/ /* @@ -135,11 +128,7 @@ $contactstatic = new Contact($db); $userstatic = new User($db); -/* *************************************************************************** */ -/* */ -/* Mode vue et edition */ -/* */ -/* *************************************************************************** */ +// View mode if ($id > 0 || !empty($ref)) { $langs->trans("OrderCard"); @@ -193,7 +182,6 @@ if ($id > 0 || !empty($ref)) { } $morehtmlref .= ''; - $object->picto = 'sending'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index d23aebd28b7..f343e56e14d 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -148,7 +148,6 @@ if ($id > 0 || !empty($ref)) { } $morehtmlref .= ''; - $object->picto = 'sending'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); From f8581a1a011a0ccdc58237501f36e2d299201ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 19:33:45 +0200 Subject: [PATCH 09/26] Look and feel v14 --- htdocs/expedition/card.php | 2 +- htdocs/expedition/contact.php | 2 +- htdocs/expedition/document.php | 2 +- htdocs/expedition/note.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0c7d51edcfe..cc441d9f50f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1516,7 +1516,7 @@ if ($action == 'create') { $res = $object->fetch_optionals(); $head = shipping_prepare_head($object); - print dol_get_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, $object->picto); $formconfirm = ''; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index f6f6fb7e1c7..164935a1437 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) { $langs->trans("OrderCard"); $head = shipping_prepare_head($object); - print dol_get_fiche_head($head, 'contact', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'contact', $langs->trans("Shipment"), -1, $object->picto); // Shipment card diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index c5e13967abc..c392187d607 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -99,7 +99,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->expedition->dir_output.'/sending/'.dol_sanitizeFileName($object->ref); $head = shipping_prepare_head($object); - print dol_get_fiche_head($head, 'documents', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'documents', $langs->trans("Shipment"), -1, $object->picto); // Build file list diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index db28e409309..a9076162015 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -89,7 +89,7 @@ $form = new Form($db); if ($id > 0 || !empty($ref)) { $head = shipping_prepare_head($object); - print dol_get_fiche_head($head, 'note', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'note', $langs->trans("Shipment"), -1, $object->picto); // Shipment card From d7a5e342ab1dba46c09e6b276bda7fcdbbdceab7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 20:16:51 +0200 Subject: [PATCH 10/26] Optimize some widgets --- htdocs/core/boxes/box_factures_fourn.php | 7 ++++--- htdocs/core/boxes/box_factures_fourn_imp.php | 7 ++++--- htdocs/core/boxes/box_factures_imp.php | 2 ++ htdocs/fourn/class/fournisseur.facture.class.php | 9 ++++----- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 3bf3bcb07c2..a2ce199faee 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -142,6 +142,10 @@ class box_factures_fourn extends ModeleBoxes $facturestatic->status = $objp->status; $facturestatic->ref_supplier = $objp->ref_supplier; + $alreadypaid = $facturestatic->getSommePaiement(); + + $facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0; + $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->name_alias = $objp->name_alias; @@ -188,9 +192,6 @@ class box_factures_fourn extends ModeleBoxes 'text' => dol_print_date($date, 'day'), ); - $fac = new FactureFournisseur($this->db); - $fac->fetch($objp->facid); - $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type), diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 826c89cf2de..aea07802fdf 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -134,6 +134,10 @@ class box_factures_fourn_imp extends ModeleBoxes $facturestatic->statut = $objp->status; $facturestatic->status = $objp->status; + $alreadypaid = $facturestatic->getSommePaiement(); + + $facturestatic->alreadypaid = $alreadypaid ? $alreadypaid : 0; + $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->name_alias = $objp->name_alias; @@ -174,9 +178,6 @@ class box_factures_fourn_imp extends ModeleBoxes 'text' => dol_print_date($datelimite, 'day'), ); - $fac = new FactureFournisseur($this->db); - $fac->fetch($objp->facid); - $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type), diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 54d3a950a79..1830dcd5c7a 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -132,7 +132,9 @@ class box_factures_imp extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); + $datelimite = $this->db->jdate($objp->datelimite); + $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->ref; $facturestatic->type = $objp->type; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index dd1ea179553..78925c74b9f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2501,6 +2501,10 @@ class FactureFournisseur extends CommonInvoice } if (isset($this->status)) { $alreadypaid = -1; + if (isset($this->alreadypaid)) { + $alreadypaid = $this->alreadypaid; + } + $label .= ' '.$this->getLibStatut(5, $alreadypaid); } if (!empty($this->ref)) { @@ -2527,9 +2531,6 @@ class FactureFournisseur extends CommonInvoice if ($moretitle) { $label .= ' - '.$moretitle; } - if (isset($this->statut) && isset($this->alreadypaid)) { - $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5, $this->alreadypaid); - } $ref = $this->ref; if (empty($ref)) { @@ -2567,8 +2568,6 @@ class FactureFournisseur extends CommonInvoice $result .= ''; $result .= img_picto('', 'note'); $result .= ''; - //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); - //$result.=''; $result .= ''; } } From b01e7957232a99ac9ec449a337efa2e253c63ada Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 May 2021 21:28:11 +0200 Subject: [PATCH 11/26] Fix of build package --- htdocs/modulebuilder/index.php | 56 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 9cb22f735e6..f8ca876eafc 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1521,7 +1521,7 @@ if ($dirins && $action == 'generatepackage') { $arrayversion = explode('.', $moduleobj->version, 3); if (count($arrayversion)) { - $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].($arrayversion[1] ? '.'.$arrayversion[1] : '').($arrayversion[2] ? '.'.$arrayversion[2] : '').'.zip'; + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].(empty($arrayversion[1]) ? '.0' : '.'.$arrayversion[1]).($arrayversion[2] ? '.'.$arrayversion[2] : '').'.zip'; $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; @@ -3022,7 +3022,7 @@ if ($module == 'initmodule') { print ''; print '
'; - print '
'; print $langs->trans('ReceptionMethod'); print '
'; + print '
'; print ''; print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); @@ -3044,51 +3044,51 @@ if ($module == 'initmodule') { print ''; print ''; print ''; print ''; print ''; print ''; + + print ''; print ''; print ''; + + print ''; + + print ''; print ''; - - print ''; - - print ''; - - print ''; print ''; print ''; @@ -3447,7 +3447,7 @@ if ($module == 'initmodule') { print ''; } } else { - print ''; } @@ -3792,7 +3792,7 @@ if ($module == 'initmodule') { print $outputfiledoc; print ''; print ''; - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; } print '
'; @@ -3806,7 +3806,7 @@ if ($module == 'initmodule') { print $outputfiledocpdf; print ''; print ''; - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')'; } print '
'; @@ -3860,7 +3860,7 @@ if ($module == 'initmodule') { $arrayversion = explode('.', $moduleobj->version, 3); if (count($arrayversion)) { - $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2] ? ".".$arrayversion[2] : "").".zip"; + $FILENAMEZIP = "module_".$modulelowercase.'-'.$arrayversion[0].(empty($arrayversion[1]) ? '.0' : '.'.$arrayversion[1]).($arrayversion[2] ? ".".$arrayversion[2] : '').".zip"; $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; } @@ -3872,7 +3872,7 @@ if ($module == 'initmodule') { } else { $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; print ''.$outputfilezip.''; - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; } print '
'; From 20724efd44641698ee42d4691c0397f90579ca3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 00:04:11 +0200 Subject: [PATCH 12/26] fix $mysoc not defined (php8 warning) --- htdocs/main.inc.php | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4231160b64f..0c3679adac5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1960,7 +1960,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead */ function top_menu_user($hideloginname = 0, $urllogout = '') { - global $langs, $conf, $db, $hookmanager, $user; + global $langs, $conf, $db, $hookmanager, $user, $mysoc; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; @@ -1985,13 +1985,27 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $dropdownBody .= ' '.$langs->trans("ShowCompanyInfos").''; $dropdownBody .= '
'; - if (!empty($conf->global->MAIN_INFO_SIREN)) $dropdownBody .= '
'.$langs->transcountry("ProfId1Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).''; - if (!empty($conf->global->MAIN_INFO_SIRET)) $dropdownBody .= '
'.$langs->transcountry("ProfId2Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).''; - if (!empty($conf->global->MAIN_INFO_APE)) $dropdownBody .= '
'.$langs->transcountry("ProfId3Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).''; - if (!empty($conf->global->MAIN_INFO_RCS)) $dropdownBody .= '
'.$langs->transcountry("ProfId4Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).''; - if (!empty($conf->global->MAIN_INFO_PROFID5)) $dropdownBody .= '
'.$langs->transcountry("ProfId5Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).''; - if (!empty($conf->global->MAIN_INFO_PROFID6)) $dropdownBody .= '
'.$langs->transcountry("ProfId6Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).''; - if (!empty($conf->global->MAIN_INFO_TVAINTRA)) $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).''; + if (!empty($conf->global->MAIN_INFO_SIREN)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId1Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIREN).''; + } + if (!empty($conf->global->MAIN_INFO_SIRET)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId2Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_SIRET).''; + } + if (!empty($conf->global->MAIN_INFO_APE)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId3Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_APE).''; + } + if (!empty($conf->global->MAIN_INFO_RCS)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId4Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_RCS).''; + } + if (!empty($conf->global->MAIN_INFO_PROFID5)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId5Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID5).''; + } + if (!empty($conf->global->MAIN_INFO_PROFID6)) { + $dropdownBody .= '
'.$langs->transcountry("ProfId6Short", $mysoc->country_code).': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_PROFID6).''; + } + if (!empty($conf->global->MAIN_INFO_TVAINTRA)) { + $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.showValueWithClipboardCPButton($conf->global->MAIN_INFO_TVAINTRA).''; + } $dropdownBody .= '
'; From c2de343b4e4661a81e3df92942e7a26b59843ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:01:13 +0200 Subject: [PATCH 13/26] fix php8 warning --- htdocs/ticket/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index e6f3f21050c..ae79bcb2db2 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2016 Jean-François FERRY * Copyright (C) 2016 Christophe Battarel * Copyright (C) 2018 Laurent Destailleur + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -751,7 +752,7 @@ if ($action == 'create' || $action == 'presend') { || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { if ($res > 0) { // or for unauthorized internals users - if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { + if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden('', 0, 1); } @@ -853,7 +854,7 @@ if ($action == 'create' || $action == 'presend') { print dol_get_fiche_end(); } - if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; @@ -1030,7 +1031,7 @@ if ($action == 'create' || $action == 'presend') { print ''; // Timing (Duration sum of linked fichinter) - if ($conf->fichinter->enabled) { + if ($conf->ficheinter->enabled) { $object->fetchObjectLinked(); $num = count($object->linkedObjects); $timing = 0; From 9725c8f3090cee35345e11bbc85bc993463dafdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:05:30 +0200 Subject: [PATCH 14/26] fix php8 warning --- htdocs/core/tpl/extrafields_view.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 9c15a71f43c..3b826b2ead5 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +60,7 @@ if ($reshook < 0) { //var_dump($extrafields->attributes[$object->table_element]); -if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) { +if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label'])) { $lastseparatorkeyfound = ''; $extrafields_collapse_num = ''; $extrafields_collapse_num_old = ''; From 3c52636c22b22ceee91d9af4e458eb9e04f5ac2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:09:56 +0200 Subject: [PATCH 15/26] fix php8 warnings --- htdocs/ticket/document.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 740061f99ba..5e4d80cd8be 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $langs->loadLangs(array("companies", "other", "ticket", "mails")); $id = GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'alpha'); @@ -104,7 +105,7 @@ if ($object->id) { print dol_get_fiche_end(); } - if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; From edad8cdf8f95bf67d99a37508258f3c2153f8206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:13:40 +0200 Subject: [PATCH 16/26] Update card.php --- htdocs/ticket/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index ae79bcb2db2..4b4b8e594d4 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -212,14 +212,14 @@ if (empty($reshook)) { } // Auto assign user - if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) { + if (!empty($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE)) { $result = $object->assignUser($user, $user->id, 1); $object->add_contact($user->id, "SUPPORTTEC", 'internal'); } // Auto assign contrat $contractid = 0; - if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) { + if (!empty($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE)) { $contrat = new Contrat($db); $contrat->socid = $object->fk_soc; $list = $contrat->getListOfContracts(); @@ -234,7 +234,7 @@ if (empty($reshook)) { } // Auto create fiche intervention - if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) { + if (!empty($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE)) { $fichinter = new Fichinter($db); $fichinter->socid = $object->fk_soc; $fichinter->fk_project = $projectid; From da7f5e462608e81e8595637c94b5ca4142178bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:15:44 +0200 Subject: [PATCH 17/26] fix php8 warning --- htdocs/ticket/messaging.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 527b28c8fac..c3e70def7da 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -91,7 +91,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -146,7 +146,7 @@ if ($socid > 0) { print dol_get_fiche_end(); } -if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { +if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; From 0c8b74b54cd4817002697cb15e5475e74bc505d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:20:31 +0200 Subject: [PATCH 18/26] fix php8 warning --- htdocs/ticket/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 19b352ee936..45a11a9daef 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -118,7 +118,7 @@ foreach ($object->fields as $key => $val) { // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); foreach ($object->fields as $key => $val) { - if ($val['searchall']) { + if (!empty($val['searchall'])) { $fieldstosearchall['t.'.$key] = $val['label']; } } @@ -340,7 +340,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= $hookmanager->resPrint; $sql = preg_replace('/, $/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; From 7e1ed0791033b0fdc144e5921bdacf1cb5e8dbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:26:03 +0200 Subject: [PATCH 19/26] fix php8 warning --- htdocs/core/boxes/box_task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 16cd41ce564..9b7cbfc2fe6 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2020 Frederic France + * Copyright (C) 2015-2021 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,7 +150,7 @@ class box_task extends ModeleBoxes } $sql = "SELECT pt.rowid, pt.ref, pt.fk_projet, pt.fk_task_parent, pt.datec, pt.dateo, pt.datee, pt.datev, pt.label, pt.description, pt.duration_effective, pt.planned_workload, pt.progress"; - $sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title"; + $sql .= ", p.rowid project_id, p.ref project_ref, p.title project_title, p.fk_statut"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; $sql .= " JOIN ".MAIN_DB_PREFIX."projet as p ON (pt.fk_projet = p.rowid)"; From eccfa4039631daef85f4e78beb0ef28ad13ed52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 May 2021 08:28:35 +0200 Subject: [PATCH 20/26] fix php8 warning remove variables not used --- htdocs/core/boxes/box_last_modified_ticket.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 7cc20bd1b89..320a23f745b 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -2,7 +2,7 @@ /* Module descriptor for ticket system * Copyright (C) 2013-2016 Jean-François FERRY * 2016 Christophe Battarel - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -113,9 +113,6 @@ class box_last_modified_ticket extends ModeleBoxes while ($i < $num) { $objp = $this->db->fetch_object($resql); $datec = $this->db->jdate($objp->datec); - $dateterm = $this->db->jdate($objp->fin_validite); - $dateclose = $this->db->jdate($objp->date_cloture); - $late = ''; $ticket = new Ticket($this->db); $ticket->id = $objp->id; @@ -162,7 +159,6 @@ class box_last_modified_ticket extends ModeleBoxes ); $r++; - // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="right"', From 73972bcbd06cf5be82e1d41d44209402ba6c8858 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 10:30:46 +0200 Subject: [PATCH 21/26] More complete log --- htdocs/compta/facture/class/facture.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8827c56e132..549862c53cc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4956,7 +4956,11 @@ class Facture extends CommonInvoice $resql = $this->db->query($sql); $stmpidate = dol_print_date($tmpidate, 'day', 'gmt'); - $this->output .= $langs->trans("SearchUnpaidInvoicesWithDueDate", $stmpidate).'
'; + $this->output .= $langs->transnoentitiesnoconv("SearchUnpaidInvoicesWithDueDate", $stmpidate); + if (!empty($paymentmode) && $paymentmode != 'all') { + $this->output .= ' ('.$langs->transnoentitiesnoconv("PaymentMode").' '.$paymentmode.')'; + } + $this->output .= '
'; if ($resql) { while ($obj = $this->db->fetch_object($resql)) { From 64cf65c47fbf4dae88eb028279181a2eff71c87a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 10:32:12 +0200 Subject: [PATCH 22/26] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 7a2cf7c2c45..ab0111dc073 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ NEW: Add a security center page with all information and advices related to the NEW: Add a performance center page with all information and advices related to the performance of your instance NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better) NEW: All main menu entries are using the picto of the module +NEW: Add an example of scheduled job to send email reminder for unpayed invoices NEW: Accountancy - Add closure menu NEW: Accountancy - Add FEC import NEW: Accountancy - Add a confirmation form with options on export From 200c36836b34c1eea7fd616d64c76f48f3dabea1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 10:44:53 +0200 Subject: [PATCH 23/26] v14 --- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/list.php | 39 +++++++++++++----------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index faf10596d8c..c0851dfee1d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -344,8 +344,8 @@ class Commande extends CommonOrder 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275), 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index df1c3e096e2..b8c3ad28039 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -163,21 +163,21 @@ $checkedtypetiers = 0; $arrayfields = array( 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>20), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>20), 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1), 'position'=>25), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>31), - 's.town'=>array('label'=>"Town", 'checked'=>1, 'position'=>35), - 's.zip'=>array('label'=>"Zip", 'checked'=>1, 'position'=>40), + 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31), + 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35), + 's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40), 'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0, 'position'=>50), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers, 'position'=>55), 'c.date_commande'=>array('label'=>"OrderDateShort", 'checked'=>1, 'position'=>60), 'c.date_delivery'=>array('label'=>"DateDeliveryPlanned", 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE), 'position'=>65), - 'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)), - 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0, 'position'=>67), - 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0, 'position'=>68), - 'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>0, 'position'=>69), + 'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>-1, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)), + 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>-1, 'position'=>67), + 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>-1, 'position'=>68), + 'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>-1, 'position'=>69), 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), @@ -186,15 +186,15 @@ $arrayfields = array( 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), - 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10, 'position'=>115), - 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500, 'position'=>120), - 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500, 'position'=>125), - 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500, 'position'=>130), - 'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135), - 'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140), - 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>990, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>145), - 'shippable'=>array('label'=>"Shippable", 'checked'=>1, 'position'=>995, 'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>150), - 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000, 'position'=>155) + 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), + 'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120), + 'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125), + 'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130), + 'c.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>135), + 'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140), + 'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990), + 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995), + 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -1115,7 +1115,7 @@ if ($resql) { // Channel if (!empty($arrayfields['c.fk_input_reason']['checked'])) { print '
'; } if (!empty($arrayfields['c.total_ht']['checked'])) { @@ -1838,6 +1838,9 @@ if ($resql) { } } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Billed From c37ccc10b1bfce92757110b56149c5e3a87378dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 14:50:04 +0200 Subject: [PATCH 24/26] Debug v14 --- ChangeLog | 1 - htdocs/core/actions_setmoduleoptions.inc.php | 1 + htdocs/core/lib/functions.lib.php | 7 +- htdocs/cron/card.php | 4 +- htdocs/datapolicy/admin/setup.php | 80 ++++--- .../datapolicy/class/datapolicycron.class.php | 212 ++++++++---------- htdocs/langs/en_US/admin.lang | 2 +- 7 files changed, 157 insertions(+), 150 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab0111dc073..b81719cafd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,7 +14,6 @@ NEW: Add a performance center page with all information and advices related to t NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better) NEW: All main menu entries are using the picto of the module NEW: Add an example of scheduled job to send email reminder for unpayed invoices -NEW: Accountancy - Add closure menu NEW: Accountancy - Add FEC import NEW: Accountancy - Add a confirmation form with options on export NEW: Accountancy - Add select date from/to in already bind customer and supplier list diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 797bb8e4cb7..7bd84e318d6 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -31,6 +31,7 @@ if ($action == 'update' && is_array($arrayofparameters)) { $db->begin(); foreach ($arrayofparameters as $key => $val) { +var_dump($key); // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { if (preg_match('/category:/', $val['type'])) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 727bfaee5b8..0d4b8b177b9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3512,7 +3512,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', 'error', 'warning', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', - 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', + 'shapes', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'uncheck', 'user-cog', 'website', 'workstation', 'conferenceorbooth', 'eventorganization' @@ -3556,7 +3556,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'resource'=>'laptop-house', - 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', + 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', + 'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', 'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card', @@ -3634,7 +3635,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent', 'resource'=>'infobox-action', 'salary'=>'infobox-bank_account', 'shipment'=>'infobox-commande', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', - 'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal', + 'supplier'=>'infobox-order_supplier', 'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal', 'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'expensereport'=>'infobox-expensereport', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action', //'title_setup'=>'infobox-action', 'tools'=>'infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 1683fadf16a..fb8699b911e 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -352,7 +352,7 @@ if (($action == "create") || ($action == "edit")) { print '"; print ""; print "'; foreach ($tab as $key => $val) { print ''; foreach ($tab as $key => $val) { print ''; } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 28a713fb733..965d93754f7 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -54,27 +54,26 @@ class DataPolicyCron $errormsg = ''; $nbupdated = $nbdeleted = 0; - // FIXME Removed hardcoded values of id + // FIXME Exclude data from the selection if there is at least 1 invoice. $arrayofparameters = array( 'DATAPOLICIES_TIERS_CLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s - WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) - AND s.entity = %d + WHERE s.entity = %d AND s.client = 1 AND s.fournisseur = 0 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND s.rowid NOT IN ( - SELECT DISTINCT a.fk_soc - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_soc IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Societe", "file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', 'fields_anonym' => array( - 'name' => $langs->trans('ANONYME'), + 'name' => 'MAKEANONYMOUS', 'name_bis' => '', 'name_alias' => '', 'address' => '', @@ -87,29 +86,28 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), 'DATAPOLICIES_TIERS_PROSPECT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s - WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) - AND s.entity = %d + WHERE s.entity = %d AND s.client = 2 AND s.fournisseur = 0 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND s.rowid NOT IN ( - SELECT DISTINCT a.fk_soc - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_soc IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Societe", "file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', 'fields_anonym' => array( - 'name' => $langs->trans('ANONYME'), + 'name' => 'MAKEANONYMOUS', 'name_bis' => '', 'name_alias' => '', 'address' => '', @@ -122,29 +120,28 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), 'DATAPOLICIES_TIERS_PROSPECT_CLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s - WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) - AND s.entity = %d + WHERE s.entity = %d AND s.client = 3 AND s.fournisseur = 0 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND s.rowid NOT IN ( - SELECT DISTINCT a.fk_soc - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_soc IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Societe", "file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', 'fields_anonym' => array( - 'name' => $langs->trans('ANONYME'), + 'name' => 'MAKEANONYMOUS', 'name_bis' => '', 'name_alias' => '', 'address' => '', @@ -157,29 +154,28 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s - WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) - AND s.entity = %d + WHERE s.entity = %d AND s.client = 0 AND s.fournisseur = 0 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND s.rowid NOT IN ( - SELECT DISTINCT a.fk_soc - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_soc IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Societe", "file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', 'fields_anonym' => array( - 'name' => $langs->trans('ANONYME'), + 'name' => 'MAKEANONYMOUS', 'name_bis' => '', 'name_alias' => '', 'address' => '', @@ -192,28 +188,27 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), 'DATAPOLICIES_TIERS_FOURNISSEUR' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s - WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) - AND s.entity = %d + WHERE s.entity = %d AND s.fournisseur = 1 AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND s.rowid NOT IN ( - SELECT DISTINCT a.fk_soc - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_soc = s.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Societe", "file" => DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php', 'fields_anonym' => array( - 'name' => $langs->trans('ANONYME'), + 'name' => 'MAKEANONYMOUS', 'name_bis' => '', 'name_alias' => '', 'address' => '', @@ -226,7 +221,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -238,17 +233,17 @@ class DataPolicyCron AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) AND s.client = 1 AND s.fournisseur = 0 - AND c.rowid NOT IN ( - SELECT DISTINCT a.fk_contact - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Contact", "file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', 'firstname' => '', 'civility_id' => '', 'poste' => '', @@ -264,8 +259,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', - 'jabberid' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -277,17 +271,17 @@ class DataPolicyCron AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) AND s.client = 2 AND s.fournisseur = 0 - AND c.rowid NOT IN ( - SELECT DISTINCT a.fk_contact - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Contact", "file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', 'firstname' => '', 'civility_id' => '', 'poste' => '', @@ -303,8 +297,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', - 'jabberid' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -316,17 +309,17 @@ class DataPolicyCron AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) AND s.client = 3 AND s.fournisseur = 0 - AND c.rowid NOT IN ( - SELECT DISTINCT a.fk_contact - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Contact", "file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', 'firstname' => '', 'civility_id' => '', 'poste' => '', @@ -342,8 +335,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', - 'jabberid' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -355,17 +347,17 @@ class DataPolicyCron AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) AND s.client = 0 AND s.fournisseur = 0 - AND c.rowid NOT IN ( - SELECT DISTINCT a.fk_contact - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Contact", "file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', 'firstname' => '', 'civility_id' => '', 'poste' => '', @@ -381,8 +373,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', - 'jabberid' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -393,17 +384,17 @@ class DataPolicyCron WHERE c.entity = %d AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) AND s.fournisseur = 1 - AND c.rowid NOT IN ( - SELECT DISTINCT a.fk_contact - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.fk_contact IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_contact = c.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + ) + AND NOT EXISTS ( + SELECT rowid FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.rowid ) ", "class" => "Contact", "file" => DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', 'firstname' => '', 'civility_id' => '', 'poste' => '', @@ -419,8 +410,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', - 'jabberid' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -429,19 +419,15 @@ class DataPolicyCron SELECT a.rowid FROM ".MAIN_DB_PREFIX."adherent as a WHERE a.entity = %d AND a.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.rowid NOT IN ( - SELECT DISTINCT a.fk_element - FROM ".MAIN_DB_PREFIX."actioncomm as a - WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) - AND a.elementtype LIKE 'member' - AND a.fk_element IS NOT NULL + AND NOT EXISTS ( + SELECT id FROM ".MAIN_DB_PREFIX."actioncomm as a WHERE a.fk_element = a.rowid AND a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) AND a.elementtype LIKE 'member' ) ", "class" => "Adherent", "file" => DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php', 'fields_anonym' => array( - 'lastname' => $langs->trans('ANONYME'), - 'firstname' => $langs->trans('ANONYME'), + 'lastname' => 'MAKEANONYMOUS', + 'firstname' => 'MAKEANONYMOUS', 'civility_id' => '', 'societe' => '', 'address' => '', @@ -456,7 +442,7 @@ class DataPolicyCron 'state' => '', 'country' => '', 'state_id' => '', - 'skype' => '', + 'socialnetworks' => '', 'country_id' => '', ) ), @@ -483,27 +469,27 @@ class DataPolicyCron $object->fetch($obj->rowid); $object->id = $obj->rowid; - if ($object->isObjectUsed($obj->rowid) > 0) { // If object to clean is used - foreach ($params['fields_anonym'] as $fields => $val) { - $object->$fields = $val; - } - $result = $object->update($obj->rowid, $user); - if ($result > 0) { - if ($params['class'] == 'Societe') { - // We delete contacts of thirdparty - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$obj->rowid; - $result = $this->db->query($sql); - if ($result < 0) { - $errormsg = $this->db->lasterror(); - $error++; + $action = 'anonymize'; // TODO Offer also action "delete" in setup of module + + if ($action == 'anonymize') { + if ($object->isObjectUsed($obj->rowid) == 0) { // If object to clean is used + foreach ($params['fields_anonym'] as $fields => $val) { + if ($val == 'MAKEANONYMOUS') { + $object->$fields = $fields.'-anonymous-'.$obj->rowid; + } else { + $object->$fields = $val; } } - } else { - $errormsg = $object->error; - $error++; + $result = $object->update($obj->rowid, $user); + if ($result > 0) { + $errormsg = $object->error; + $error++; + } + $nbupdated++; } - $nbupdated++; - } else { // If object to clean is not used + } + + if ($action == 'delete') { // If object to clean is not used if ($object->element == 'adherent') { $result = $object->delete($obj->rowid, $user); } else { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 34852c2ca61..9f4bcfcfbd4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1768,7 +1768,7 @@ AGENDA_DEFAULT_VIEW=Which view do you want to open by default when selecting men AGENDA_REMINDER_BROWSER=Enable event reminder on user's browser (When remind date is reached, a popup is shown by the browser. Each user can disable such notifications from its browser notification setup). AGENDA_REMINDER_BROWSER_SOUND=Enable sound notification AGENDA_REMINDER_EMAIL=Enable event reminder by emails (remind option/delay can be defined on each event). -AGENDA_REMINDER_EMAIL_NOTE=Note: The frequency of the task %s must be enough to be sure that the remind are sent at the correct moment. +AGENDA_REMINDER_EMAIL_NOTE=Note: The frequency of the scheduled job %s must be enough to be sure that the remind are sent at the correct moment. AGENDA_SHOW_LINKED_OBJECT=Show linked object into agenda view ##### Clicktodial ##### ClickToDialSetup=Click To Dial module setup From 5496cc6c9919edcf60d1a41c807e177df3e38a29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 15:25:42 +0200 Subject: [PATCH 25/26] Changlog --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b81719cafd3..df46607b91b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,8 @@ English Dolibarr ChangeLog For users: ---------- -NEW: Feature to make inventories +NEW: Module Recruitement to follow application to job positions is now stable. +NEW: Feature to make Stock Inventories NEW: Several security issues after a second private bug hunting campaign. NEW: Add a security center page with all information and advices related to the security of your instance NEW: Add a performance center page with all information and advices related to the performance of your instance From d8cbb735a308bec9b29f3041086251ee73c66971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 17:58:00 +0200 Subject: [PATCH 26/26] Fix rtl language for pdf --- .../supplier_order/doc/pdf_cornas.modules.php | 17 ++++++++++------- .../supplier_order/doc/pdf_muscadet.modules.php | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 4cb80e0a81e..c60f82e9c4a 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1211,6 +1211,9 @@ class pdf_cornas extends ModelePDFSuppliersOrders { global $langs, $conf, $mysoc; + $ltrdirection = 'L'; + if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings")); @@ -1248,7 +1251,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders } } else { $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } $pdf->SetFont('', 'B', $default_font_size + 3); @@ -1369,7 +1372,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom", 0, 'L'); + $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); @@ -1378,13 +1381,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Show sender name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); $posy = $pdf->getY(); // Show sender information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection); @@ -1422,20 +1425,20 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx + 2, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetXY($posx + 2, $posy); - $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } return $top_shift; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 65d2a97f634..c6d9cf8da14 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1119,6 +1119,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { global $langs, $conf, $mysoc; + $ltrdirection = 'L'; + if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; + // Load translation files required by the page $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings")); @@ -1156,7 +1159,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } } else { $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } $pdf->SetFont('', 'B', $default_font_size + 3); @@ -1277,7 +1280,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L'); + $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); @@ -1286,13 +1289,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show sender name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection); $posy = $pdf->getY(); // Show sender information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection); // If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER' @@ -1329,20 +1332,20 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx + 2, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); // Show recipient information $pdf->SetFont('', '', $default_font_size - 1); $pdf->SetXY($posx + 2, $posy); - $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } return $top_shift;
'; - print $menu['type']; + print dol_escape_htmltag($menu['type']); print ''; - print $menu['fk_menu']; + print dol_escape_htmltag($menu['fk_menu']); print ''; - print $menu['titre']; + print dol_escape_htmltag($menu['titre']); print ''; - print $menu['mainmenu']; + print dol_escape_htmltag($menu['mainmenu']); print ''; - print $menu['leftmenu']; + print dol_escape_htmltag($menu['leftmenu']); + print ''; + print dol_escape_htmltag($menu['url']); print ''; - print $menu['url']; + print dol_escape_htmltag($menu['langs']); print ''; - print $menu['langs']; + print dol_escape_htmltag($menu['position']); + print ''; + print dol_escape_htmltag($menu['enabled']); + print ''; + print dol_escape_htmltag($menu['perms']); print ''; - print $menu['position']; - print ''; - print $menu['enabled']; - print ''; - print $menu['perms']; - print ''; - print $menu['target']; + print dol_escape_htmltag($menu['target']); print ''; - print $menu['user']; + print dol_escape_htmltag($menu['user']); print '
'.$langs->trans("NoWidget"); + print '
'.$langs->trans("WidgetFile").' : '.$langs->trans("NoWidget").''; print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; print '
'; - $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1); + $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1); print '
'; print $langs->trans('CronModule').""; - print "module_name."\" /> "; + print "module_name."\" /> "; print ""; print $form->textwithpicto('', $langs->trans("CronModuleHelp"), 1, 'help'); @@ -370,7 +370,7 @@ if (($action == "create") || ($action == "edit")) { print '
'; print $langs->trans('CronObject').""; - print "objectname."\" /> "; + print "objectname."\" /> "; print ""; print $form->textwithpicto('', $langs->trans("CronObjectHelp"), 1, 'help'); diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index a334b36929e..dde8644571e 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -27,15 +27,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/datapolicy.lib.php'; // Translations -$langs->load('admin'); -$langs->load('companies'); -$langs->load('members'); -$langs->load('datapolicy@datapolicy'); - -// Access control -if (!$user->admin) { - accessforbidden(); -} +$langs->loadLangs(array('admin', 'companies', 'members', 'datapolicy@datapolicy')); // Parameters $action = GETPOST('action', 'aZ09'); @@ -43,35 +35,27 @@ $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters = array(); $arrayofparameters['ThirdParty'] = array( - 'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200'), + 'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'supplier', 'class="pictofixedwidth"')), ); if (!empty($conf->global->DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT)) { $arrayofparameters['Contact'] = array( - 'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'), - 'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200'), + 'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), ); } if (!empty($conf->adherent->enabled)) { $arrayofparameters['Member'] = array( - 'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200'), + 'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'member', 'class="pictofixedwidth"')), ); } - - -/* - * Actions - */ - -include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; - $valTab = array( '' => $langs->trans('Never'), '6' => $langs->trans('NB_MONTHS', 6), @@ -85,6 +69,40 @@ $valTab = array( '240' => $langs->trans('NB_YEARS', 20), ); +// Access control +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +foreach ($arrayofparameters as $title => $tab) { + foreach ($tab as $key => $val) { + // Modify constant only if key was posted (avoid resetting key to the null value) + if (GETPOSTISSET($key)) { + if (preg_match('/category:/', $val['type'])) { + if (GETPOST($key, 'int') == '-1') { + $val_const = ''; + } else { + $val_const = GETPOST($key, 'int'); + } + } else { + $val_const = GETPOST($key, 'alpha'); + } + + $result = dolibarr_set_const($db, $key, $val_const, 'chaine', 0, '', $conf->entity); + if ($result < 0) { + $error++; + break; + } + } + } +} + + /* * View @@ -96,11 +114,11 @@ llxHeader('', $langs->trans($page_name)); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_generic'); +print load_fiche_titre($langs->trans($page_name), $linkback, 'generic'); // Configuration header $head = datapolicyAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy"); +print dol_get_fiche_head($head, 'settings', '', -1, ''); // Setup page goes here echo ''.$langs->trans("datapolicySetupPage").'

'; @@ -118,6 +136,7 @@ if ($action == 'edit') { print '
'.$langs->trans($title).'
'; + print $val['picto']; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; print '
'.$langs->trans($title).'
'; + print $val['picto']; print $form->textwithpicto($langs->trans($key), $langs->trans('DATAPOLICY_Tooltip_SETUP')); print ''.($conf->global->$key == '' ? $langs->trans('None') : $valTab[$conf->global->$key]).'