From b73df2698dbf7310473d40f2ad8a35c955c13c9b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 May 2019 14:25:41 +0200 Subject: [PATCH 001/255] FIX better compatibility with Multicompany --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/card.php | 167 +++++++++--------- htdocs/commande/class/commande.class.php | 16 +- htdocs/commande/document.php | 6 +- htdocs/commande/index.php | 12 +- htdocs/commande/list.php | 8 +- htdocs/commande/orderstoinvoice.php | 4 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/files.lib.php | 20 +-- htdocs/core/lib/order.lib.php | 2 +- .../doc/doc_generic_order_odt.modules.php | 2 +- .../commande/doc/pdf_einstein.modules.php | 4 +- .../commande/doc/pdf_eratosthene.modules.php | 4 +- .../modules/commande/mod_commande_marbre.php | 2 +- .../modules/commande/mod_commande_saphir.php | 5 +- htdocs/support/index.php | 2 +- 19 files changed, 133 insertions(+), 131 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0b9863f287b..4945ff63305 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1138,7 +1138,7 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql.= " SET fk_delivery_address = ".$this->fk_delivery_address; $sql.= " WHERE ref = '".$this->db->escape($this->ref)."'"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity = ".$this->entity; $result=$this->db->query($sql); } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b02f788f040..01b07e0d08d 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -998,7 +998,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 05d02c487c0..32863263d7f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -96,9 +96,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('ordercard','globalcard')); -$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->commande->creer; // Used by the include of actions_dellink.inc.php -$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php +$usercanread = $user->rights->commande->lire; +$usercancreate = $user->rights->commande->creer; +$usercanclose = $user->rights->commande->cloturer; +$usercandelete = $user->rights->commande->supprimer; +$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))); +$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler))); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send); + +$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php +$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php /* @@ -129,7 +137,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once // Action clone object - if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer) + if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) { if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { @@ -159,7 +167,7 @@ if (empty($reshook)) } // Reopen a closed order - elseif ($action == 'reopen' && $user->rights->commande->creer) + elseif ($action == 'reopen' && $usercancreate) { if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED) { @@ -176,7 +184,7 @@ if (empty($reshook)) } // Remove order - elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { $result = $object->delete($user); if ($result > 0) @@ -191,7 +199,7 @@ if (empty($reshook)) } // Remove a product line - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { $result = $object->deleteline($user, $lineid); if ($result > 0) @@ -222,13 +230,13 @@ if (empty($reshook)) } // Link to a project - elseif ($action == 'classin' && $user->rights->commande->creer) + elseif ($action == 'classin' && $usercancreate) { $object->setProject(GETPOST('projectid', 'int')); } // Add order - elseif ($action == 'add' && $user->rights->commande->creer) + elseif ($action == 'add' && $usercancreate) { $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -252,6 +260,7 @@ if (empty($reshook)) $db->begin(); $object->date_commande = $datecommande; + $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); $object->note_private = GETPOST('note_private', 'none'); $object->note_public = GETPOST('note_public', 'none'); $object->source = GETPOST('source_id'); @@ -481,7 +490,7 @@ if (empty($reshook)) } } - elseif ($action == 'classifybilled' && $user->rights->commande->creer) + elseif ($action == 'classifybilled' && $usercancreate) { $ret=$object->classifyBilled($user); @@ -489,7 +498,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - elseif ($action == 'classifyunbilled' && $user->rights->commande->creer) + elseif ($action == 'classifyunbilled' && $usercancreate) { $ret=$object->classifyUnBilled(); if ($ret < 0) { @@ -498,7 +507,7 @@ if (empty($reshook)) } // Positionne ref commande client - elseif ($action == 'setref_client' && $user->rights->commande->creer) { + elseif ($action == 'setref_client' && $usercancreate) { $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) { @@ -506,7 +515,7 @@ if (empty($reshook)) } } - elseif ($action == 'setremise' && $user->rights->commande->creer) { + elseif ($action == 'setremise' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise')); if ($result < 0) { @@ -514,7 +523,7 @@ if (empty($reshook)) } } - elseif ($action == 'setabsolutediscount' && $user->rights->commande->creer) { + elseif ($action == 'setabsolutediscount' && $usercancreate) { if (GETPOST('remise_id')) { if ($object->id > 0) { $object->insert_discount(GETPOST('remise_id')); @@ -524,7 +533,7 @@ if (empty($reshook)) } } - elseif ($action == 'setdate' && $user->rights->commande->creer) { + elseif ($action == 'setdate' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year')); @@ -534,7 +543,7 @@ if (empty($reshook)) } } - elseif ($action == 'setdate_livraison' && $user->rights->commande->creer) { + elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -544,35 +553,35 @@ if (empty($reshook)) } } - elseif ($action == 'setmode' && $user->rights->commande->creer) { + elseif ($action == 'setmode' && $usercancreate) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } // Multicurrency Code - elseif ($action == 'setmulticurrencycode' && $user->rights->commande->creer) { + elseif ($action == 'setmulticurrencycode' && $usercancreate) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } // Multicurrency rate - elseif ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) { + elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } - elseif ($action == 'setavailability' && $user->rights->commande->creer) { + elseif ($action == 'setavailability' && $usercancreate) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - elseif ($action == 'setdemandreason' && $user->rights->commande->creer) { + elseif ($action == 'setdemandreason' && $usercancreate) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - elseif ($action == 'setconditions' && $user->rights->commande->creer) { + elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); if ($result < 0) { dol_print_error($db, $object->error); @@ -604,7 +613,7 @@ if (empty($reshook)) } // bank account - elseif ($action == 'setbankaccount' && $user->rights->commande->creer) { + elseif ($action == 'setbankaccount' && $usercancreate) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -612,7 +621,7 @@ if (empty($reshook)) } // shipping method - elseif ($action == 'setshippingmethod' && $user->rights->commande->creer) { + elseif ($action == 'setshippingmethod' && $usercancreate) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -620,23 +629,23 @@ if (empty($reshook)) } // warehouse - elseif ($action == 'setwarehouse' && $user->rights->commande->creer) { + elseif ($action == 'setwarehouse' && $usercancreate) { $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - elseif ($action == 'setremisepercent' && $user->rights->commande->creer) { + elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise_percent')); } - elseif ($action == 'setremiseabsolue' && $user->rights->commande->creer) { + elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); } // Add a new line - elseif ($action == 'addline' && $user->rights->commande->creer) + elseif ($action == 'addline' && $usercancreate) { $langs->load('errors'); $error = 0; @@ -999,7 +1008,7 @@ if (empty($reshook)) /* * Update a line */ - elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save')) + elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { // Clean parameters $date_start=''; @@ -1133,15 +1142,12 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { + } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition exit(); } - elseif ($action == 'confirm_validate' && $confirm == 'yes' && - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) - ) + elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1195,7 +1201,7 @@ if (empty($reshook)) } // Go back to draft status - elseif ($action == 'confirm_modif' && $user->rights->commande->creer) { + elseif ($action == 'confirm_modif' && $usercancreate) { $idwarehouse = GETPOST('idwarehouse'); $qualified_for_stock_change=0; @@ -1243,17 +1249,14 @@ if (empty($reshook)) } } - elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { + elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) { $result = $object->cloture($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - elseif ($action == 'confirm_cancel' && $confirm == 'yes' && - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) - ) + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1310,7 +1313,7 @@ if (empty($reshook)) if ($error) $action = 'edit_extras'; } - if ($action == 'set_thirdparty' && $user->rights->commande->creer) + if ($action == 'set_thirdparty' && $usercancreate) { $object->fetch($id); $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); @@ -1321,7 +1324,7 @@ if (empty($reshook)) // add lines from objectlinked if($action == 'import_lines_from_object' - && $user->rights->commande->creer + && $usercancreate && $object->statut == Commande::STATUS_DRAFT ) { @@ -1405,8 +1408,8 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = $conf->commande->dir_output; - $permissioncreate = $user->rights->commande->creer; + $upload_dir = $conf->commande->multidir_output[$object->entity]; + $permissioncreate = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails @@ -1417,7 +1420,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer) + if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate) { if ($action == 'addcontact') { @@ -1478,7 +1481,7 @@ $formmargin = new FormMargin($db); if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } // Mode creation -if ($action == 'create' && $user->rights->commande->creer) +if ($action == 'create' && $usercancreate) { print load_fiche_titre($langs->trans('CreateOrder'), '', 'title_commercial.png'); @@ -2069,8 +2072,8 @@ if ($action == 'create' && $user->rights->commande->creer) $morehtmlref='
'; // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherOrders").')'; @@ -2079,7 +2082,7 @@ if ($action == 'create' && $user->rights->commande->creer) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->commande->creer) + if ($usercancreate) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; @@ -2159,7 +2162,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Date print ''; - $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; print $form->editfieldkey("Date", 'date', '', $object, $editenable); print ''; if ($action == 'editdate') { @@ -2180,7 +2183,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery date planed print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); print ''; if ($action == 'editdate_livraison') { @@ -2202,7 +2205,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Shipping Method if (! empty($conf->expedition->enabled)) { print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); print ''; if ($action == 'editshippingmethod') { @@ -2220,7 +2223,7 @@ if ($action == 'create' && $user->rights->commande->creer) require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct=new FormProduct($db); print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); print ''; if ($action == 'editwarehouse') { @@ -2234,7 +2237,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Terms of payment print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); print ''; if ($action == 'editconditions') { @@ -2248,7 +2251,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Mode of payment print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); print ''; if ($action == 'editmode') { @@ -2264,7 +2267,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency code print ''; print ''; - $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT; + $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); print ''; if ($action == 'editmulticurrencycode') { @@ -2277,7 +2280,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Multicurrency rate print ''; print ''; - $editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT; + $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT; print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -2298,7 +2301,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Delivery delay print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); print ''; if ($action == 'editavailability') { @@ -2310,7 +2313,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Source reason (why we have an ordrer) print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable); print ''; if ($action == 'editdemandreason') { @@ -2323,7 +2326,7 @@ if ($action == 'create' && $user->rights->commande->creer) // TODO Order mode (how we receive order). Not yet implemented /* print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); print ''; if ($action == 'editinputmode') { @@ -2355,7 +2358,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Incoterms if (!empty($conf->incoterm->enabled)) { print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); print ''; print ''; @@ -2373,7 +2376,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) { print ''; - $editenable = $user->rights->commande->creer; + $editenable = $usercancreate; print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); print ''; if ($action == 'editbankaccount') { @@ -2497,7 +2500,7 @@ if ($action == 'create' && $user->rights->commande->creer) /* * Form to add new line */ - if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines') + if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($action != 'editline') { @@ -2528,22 +2531,19 @@ if ($action == 'create' && $user->rights->commande->creer) if (empty($reshook)) { // Send if ($object->statut > Commande::STATUS_DRAFT) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) { + if ($usercansend) { print ''; } else print ''; } // Valid - if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) - ) + if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate) { print ''; } // Edit - if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->creer) { + if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) { print ''; } // Create event @@ -2597,12 +2597,12 @@ if ($action == 'create' && $user->rights->commande->creer) } // Reopen a closed order - if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $user->rights->commande->creer) { + if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { print ''; } // Set to shipped - if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $user->rights->commande->cloturer) { + if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { print ''; } @@ -2612,31 +2612,28 @@ if ($action == 'create' && $user->rights->commande->creer) if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { print ''; } - if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { + if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { print ''; } } if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { - if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { + if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { print ''; } } // Clone - if ($user->rights->commande->creer) { + if ($usercancreate) { print ''; } // Cancel order - if ($object->statut == Commande::STATUS_VALIDATED && - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler))) - ) + if ($object->statut == Commande::STATUS_VALIDATED && (! empty($usercanclose) || ! empty($usercancancel))) { print ''; } // Delete order - if ($user->rights->commande->supprimer) { + if ($usercandelete) { if ($numshipping == 0) { print ''; } else { @@ -2659,18 +2656,18 @@ if ($action == 'create' && $user->rights->commande->creer) // Documents $comref = dol_sanitizeFileName($object->ref); $relativepath = $comref . '/' . $comref . '.pdf'; - $filedir = $conf->commande->dir_output . '/' . $comref; + $filedir = $conf->commande->multidir_output[$object->entity] . '/' . $comref; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; - $genallowed = $user->rights->commande->lire; - $delallowed = $user->rights->commande->creer; - print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + $genallowed = $usercanread; + $delallowed = $usercancreate; + print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object); // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $compatibleImportElementsList = false; - if($user->rights->commande->creer + if($usercancreate && $object->statut == Commande::STATUS_DRAFT) { $compatibleImportElementsList = array('commande','propal'); // import from linked elements @@ -2707,7 +2704,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Presend form $modelmail='order_send'; $defaulttopic='SendOrderRef'; - $diroutput = $conf->commande->dir_output; + $diroutput = $conf->commande->multidir_output[$object->entity]; $trackid = 'ord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 35cb8335232..fdf9703eb8f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -427,8 +427,8 @@ class Commande extends CommonOrder // in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); - $dirsource = $conf->commande->dir_output.'/'.$oldref; - $dirdest = $conf->commande->dir_output.'/'.$newref; + $dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref; + $dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref; if (file_exists($dirsource)) { dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest); @@ -437,7 +437,7 @@ class Commande extends CommonOrder { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); + $listoffiles=dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); foreach($listoffiles as $fileentry) { $dirsource=$fileentry['name']; @@ -776,6 +776,7 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft + if (empty($this->entity)) $this->entity = $conf->entity; // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); @@ -859,7 +860,7 @@ class Commande extends CommonOrder $sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0); $sql.= ", ".(int) $this->fk_incoterms; $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".$conf->entity; + $sql.= ", ".$this->entity; $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql.= ", ".(int) $this->fk_multicurrency; @@ -1232,6 +1233,7 @@ class Commande extends CommonOrder $this->lines[$i] = $line; } + $this->entity = $object->entity; $this->socid = $object->socid; $this->fk_project = $object->fk_project; $this->cond_reglement_id = $object->cond_reglement_id; @@ -3320,10 +3322,10 @@ class Commande extends CommonOrder { // Remove directory with files $comref = dol_sanitizeFileName($this->ref); - if ($conf->commande->dir_output && !empty($this->ref)) + if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref)) { - $dir = $conf->commande->dir_output . "/" . $comref ; - $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; + $dir = $conf->commande->multidir_output[$this->entity] . "/" . $comref ; + $file = $conf->commande->multidir_output[$this->entity] . "/" . $comref . "/" . $comref . ".pdf"; if (file_exists($file)) // We must delete all files before deleting directory { dol_delete_preview($this); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 37cbc70cd40..ec6ed2fd91b 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -72,7 +72,7 @@ $object = new Commande($db); if ($object->fetch($id)) { $object->fetch_thirdparty(); - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); } include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; @@ -92,7 +92,7 @@ if ($id > 0 || ! empty($ref)) { $object->fetch_thirdparty(); - $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $head = commande_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, 'order'); @@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref)) $modulepart = 'commande'; $permission = $user->rights->commande->creer; $permtoedit = $user->rights->commande->creer; - $param = '&id=' . $object->id; + $param = '&id=' . $object->id.'&entity=' . (! empty($object->entity)?$object->entity:$conf->entity); include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index c0091b43af0..123bb64b837 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -235,7 +235,7 @@ $max=5; * Last modified orders */ -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; +$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; $sql.= " s.nom as name, s.rowid as socid"; $sql.= ", s.client"; $sql.= ", s.code_client"; @@ -291,7 +291,7 @@ if ($resql) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print ''; @@ -317,7 +317,7 @@ else dol_print_error($db); */ if (! empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; $sql.= ", s.client"; $sql.= ", s.code_client"; $sql.= ", s.canvas"; @@ -371,7 +371,7 @@ if (! empty($conf->commande->enabled)) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print ''; @@ -399,7 +399,7 @@ if (! empty($conf->commande->enabled)) */ if (! empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; $sql.= ", s.client"; $sql.= ", s.code_client"; $sql.= ", s.canvas"; @@ -453,7 +453,7 @@ if (! empty($conf->commande->enabled)) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir); print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ad3fd777a5c..073228194b5 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -91,7 +91,7 @@ $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int')); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande', $id, ''); -$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id; +$diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id; // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -217,7 +217,7 @@ if (empty($reshook)) $objectlabel='Orders'; $permtoread = $user->rights->commande->lire; $permtodelete = $user->rights->commande->supprimer; - $uploaddir = $conf->commande->dir_output; + $uploaddir = $conf->commande->multidir_output[$conf->entity]; $trigger_name='ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -928,7 +928,7 @@ if ($resql) print ''; $filename=dol_sanitizeFileName($obj->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); + $filedir=$conf->commande->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print ''; @@ -1075,7 +1075,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index fe017a6b1aa..a960c703eba 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -548,7 +548,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) '; $filename=dol_sanitizeFileName($objp->ref); - $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); + $filedir=$conf->commande->multidir_output[$objp->entity] . '/' . dol_sanitizeFileName($objp->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); print ''; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 44f69f512bd..9a8f308a0d1 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref)) { $object->fetch_thirdparty(); - $upload_dir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($object->ref); + $upload_dir = $conf->facture->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $head = facture_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 05ce6cc3504..b89d257e258 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1202,7 +1202,7 @@ if ($resql) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i); $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 576aff4db66..858d16948e2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1228,7 +1228,7 @@ class FormFile print ''; } // Preview link - if (! $editline) print $this->showPreview($file, $modulepart, $filepath); + if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$onf->entity)); print "\n"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e00f79b27bc..c7585b65254 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2186,10 +2186,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file=$conf->adherent->dir_output.'/'.$original_file; } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output)) + elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { if ($fuser->rights->facture->{$lire}) $accessallowed=1; - $original_file=$conf->facture->dir_output.'/'.$original_file; + $original_file=$conf->facture->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu propal elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) @@ -2198,10 +2198,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $original_file=$conf->propal->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) + elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { if ($fuser->rights->commande->{$lire}) $accessallowed=1; - $original_file=$conf->commande->dir_output.'/'.$original_file; + $original_file=$conf->commande->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les apercu intervention elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) @@ -2397,13 +2397,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping for invoices - elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output)) + elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) { if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed=1; } - $original_file=$conf->facture->dir_output.'/'.$original_file; + $original_file=$conf->facture->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping for mass actions @@ -2421,7 +2421,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { $accessallowed=1; } - $original_file=$conf->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file=$conf->commande->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_invoices') { @@ -2429,7 +2429,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, { $accessallowed=1; } - $original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + $original_file=$conf->facture->multidir_output[$entity].'/temp/massgeneration/'.$user->id.'/'.$original_file; } elseif ($modulepart == 'massfilesarea_expensereport') { @@ -2513,13 +2513,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Wrapping pour les commandes - elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output)) + elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity])) { if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed=1; } - $original_file=$conf->commande->dir_output.'/'.$original_file; + $original_file=$conf->commande->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 6e276dcf8f4..5727ececb5e 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -96,7 +96,7 @@ function commande_prepare_head(Commande $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); + $upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 5685a839314..eced22d03d8 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -244,7 +244,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } } - $dir = $conf->commande->dir_output; + $dir = $conf->commande->multidir_output[$object->entity]; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 5975da49fbe..78cb2adc9f9 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -239,13 +239,13 @@ class pdf_einstein extends ModelePDFCommandes // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->commande->dir_output; + $dir = $conf->commande->multidir_output[$conf->entity]; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->commande->dir_output . "/" . $objectref; + $dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1abc6c95e20..d0c5197587f 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -281,13 +281,13 @@ class pdf_eratosthene extends ModelePDFCommandes // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->commande->dir_output; + $dir = $conf->commande->multidir_output[$conf->entity]; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->commande->dir_output . "/" . $objectref; + $dir = $conf->commande->multidir_output[$object->entity] . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 28d488eb6fb..160a07635f4 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -121,7 +121,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."commande"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('ordernumber', 1, $object).")"; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 8c96c237a0f..f722a017c0b 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -137,9 +137,12 @@ class mod_commande_saphir extends ModeleNumRefCommandes return 0; } + // Get entities + $entity = getEntity('ordernumber', 1, $object); + $date = ($object->date_commande ? $object->date_commande : $object->date); - $numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date); + $numFinal=get_next_value($db, $mask, 'commande', 'ref', '', $objsoc, $date, 'next', false, null, $entity); return $numFinal; } diff --git a/htdocs/support/index.php b/htdocs/support/index.php index c5f0494eb59..9bc1027805a 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -73,7 +73,7 @@ print '
'.img_picto('', 'who.png', 'class="valigntex print ''.$langs->trans("CommunitySupport").''; print '
'.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommunauty").''; print '
'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '; -print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1); +print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1); print '
'; print ''; From 82ee85b665f7f5fc2155f2c7f22090c0208b3d81 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 May 2019 14:29:41 +0200 Subject: [PATCH 002/255] FIX remove test --- htdocs/support/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 9bc1027805a..c5f0494eb59 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -73,7 +73,7 @@ print '
'.img_picto('', 'who.png', 'class="valigntex print ''.$langs->trans("CommunitySupport").''; print '
'.$langs->trans("TypeOfSupport").': '.$langs->trans("TypeSupportCommunauty").''; print '
'.$langs->trans("TypeOfHelp").'/'.$langs->trans("Efficiency").'/'.$langs->trans("Price").': '; -print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom minwidth50"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1); +print $langs->trans("TypeHelpDev").'/'.img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).img_picto_common('', 'redstar', 'class="valigntextbottom"', 1).'/'.img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1).img_picto_common('', 'star', 'class="valigntextbottom"', 1); print '
'; print ''; From 62489d1f5ef67fa97e263cecf12de883eb8e70fc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 May 2019 14:41:30 +0200 Subject: [PATCH 003/255] FIX replace "dir_output" with "multidir_output" --- htdocs/compta/facture/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index beebe3cb561..3733fda8e67 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2425,7 +2425,7 @@ $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GET include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc - $upload_dir = $conf->facture->dir_output; + $upload_dir = $conf->facture->multidir_output[$object->entity]; $permissioncreate=$usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -4859,12 +4859,12 @@ elseif ($id > 0 || ! empty($ref)) // Documents generes $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); + $filedir = $conf->facture->multidir_output[$object->entity] . '/' . dol_sanitizeFileName($object->ref); $urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id; $genallowed = $usercanread; $delallowed = $usercancreate; - print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object); $somethingshown = $formfile->numoffiles; // Show links to link elements @@ -4911,7 +4911,7 @@ elseif ($id > 0 || ! empty($ref)) // Presend form $modelmail='facture_send'; $defaulttopic='SendBillRef'; - $diroutput = $conf->facture->dir_output; + $diroutput = $conf->facture->multidir_output[$object->entity]; $trackid = 'inv'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; From 3cb6ca34e9596587779fa0f722b0c76365dcb1ef Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 May 2019 16:06:16 +0200 Subject: [PATCH 004/255] FIX multicompany compatibility --- htdocs/core/class/conf.class.php | 3 +++ htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 861c273e28a..d3ca2c6126f 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -327,6 +327,9 @@ class Conf } // For mycompany storage + $this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany"); + $this->mycompany->multidir_temp = array($this->entity => $rootfordata."/mycompany/temp"); + // For backward compatibility $this->mycompany->dir_output=$rootfordata."/mycompany"; $this->mycompany->dir_temp=$rootfordata."/mycompany/temp"; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 78cb2adc9f9..63f9093842b 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1255,7 +1255,8 @@ class pdf_einstein extends ModelePDFCommandes // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + var_dump($conf->mycompany); exit; + $logo=$conf->mycompany->dir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) From 156b25a702665077d880a3212a591f51297fdd7b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 12 May 2019 16:36:29 +0200 Subject: [PATCH 005/255] FIX use "multidir_output" instead "dir_output" --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 5 ++--- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 6 +++--- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 4 ++-- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 4 ++-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 63f9093842b..f9c62a197ff 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -290,7 +290,7 @@ class pdf_einstein extends ModelePDFCommandes // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -1255,8 +1255,7 @@ class pdf_einstein extends ModelePDFCommandes // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - var_dump($conf->mycompany); exit; - $logo=$conf->mycompany->dir_output[$object->entity].'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d0c5197587f..ff1c84a2783 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -331,7 +331,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -1390,7 +1390,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index a641e209f9e..dd6300f4296 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -340,7 +340,7 @@ class pdf_crabe extends ModelePDFFactures // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -1582,7 +1582,7 @@ class pdf_crabe extends ModelePDFFactures // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 9c7c7797841..fbe5bdfb5da 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -352,7 +352,7 @@ class pdf_sponge extends ModelePDFFactures // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -449,7 +449,7 @@ class pdf_sponge extends ModelePDFFactures complete_substitutions_array($substitutionarray, $outputlangs, $object); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); - + $pdf->startTransaction(); $pdf->SetFont('', '', $default_font_size - 1); @@ -1600,7 +1600,7 @@ class pdf_sponge extends ModelePDFFactures // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 54fe56421ea..5f5b2dcf4cb 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -344,7 +344,7 @@ class pdf_azur extends ModelePDFPropales // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -1459,7 +1459,7 @@ class pdf_azur extends ModelePDFPropales // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 14a2456157a..0ba7cf574ce 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -330,7 +330,7 @@ class pdf_cyan extends ModelePDFPropales // Set path to the background PDF File if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) { - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); $tplidx = $pdf->importPage(1); } @@ -1505,7 +1505,7 @@ class pdf_cyan extends ModelePDFPropales // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + $logo=$conf->mycompany->multidir_output[$object->entity].'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { if (is_readable($logo)) From 38246b408815c26ee0655f95f10a9af53339d426 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Jun 2019 11:13:26 +0200 Subject: [PATCH 006/255] NEW add new function "setEntity()" --- htdocs/commande/card.php | 1 - htdocs/commande/class/commande.class.php | 3 +-- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/functions.lib.php | 22 +++++++++++++++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 32863263d7f..a0552586ffe 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -260,7 +260,6 @@ if (empty($reshook)) $db->begin(); $object->date_commande = $datecommande; - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); $object->note_private = GETPOST('note_private', 'none'); $object->note_public = GETPOST('note_public', 'none'); $object->source = GETPOST('source_id'); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 37f4ac4b9b2..d43e3eb6041 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -776,7 +776,6 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - if (empty($this->entity)) $this->entity = $conf->entity; // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); @@ -860,7 +859,7 @@ class Commande extends CommonOrder $sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0); $sql.= ", ".(int) $this->fk_incoterms; $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".$this->entity; + $sql.= ", ".setEntity($this); $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql.= ", ".(int) $this->fk_multicurrency; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 135fd2969d3..d965ca9f245 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1238,7 +1238,7 @@ class FormFile print ''; } // Preview link - if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$onf->entity)); + if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$conf->entity)); print "\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19b39fd776d..de52d3a74d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -75,7 +75,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * @param int $shared 0=Return id of current entity only, * 1=Return id of current entity + shared entities (default) * @param object $currentobject Current object if needed - * @return mixed Entity id(s) to use + * @return mixed Entity id(s) to use */ function getEntity($element, $shared = 1, $currentobject = null) { @@ -95,6 +95,26 @@ function getEntity($element, $shared = 1, $currentobject = null) } } +/** + * Get entity id to use when to create an object + * + * @param object $currentobject Current object + * @return mixed Entity id to use + */ +function setEntity($currentobject) +{ + global $conf, $mc; + + if (is_object($mc)) + { + return $mc->setEntity($currentobject); + } + else + { + return $conf->entity; + } +} + /** * Return information about user browser * From fc83585574254e32ecc0ed9131bcd05227b35f0e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Jun 2019 11:37:04 +0200 Subject: [PATCH 007/255] FIX use setEntity() to move code in multicompany module --- htdocs/comm/propal/card.php | 1 - htdocs/comm/propal/class/propal.class.php | 7 +++-- htdocs/compta/facture/card.php | 6 +---- htdocs/compta/facture/class/facture.class.php | 27 +++++++++++-------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c8cba5c3dda..c2d765afab7 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -380,7 +380,6 @@ if (empty($reshook)) } } else { $object->ref = GETPOST('ref'); - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; $object->date_livraison = $date_delivery; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4945ff63305..599f3685f8d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -890,7 +890,6 @@ class Propal extends CommonObject $now=dol_now(); // Clean parameters - if (empty($this->entity)) $this->entity = $conf->entity; if (empty($this->date)) $this->date=$this->datep; $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600); if (empty($this->availability_id)) $this->availability_id=0; @@ -1000,7 +999,7 @@ class Propal extends CommonObject $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".(int) $this->fk_incoterms; $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".$this->entity; + $sql.= ", ".setEntity($this); $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; @@ -1091,7 +1090,7 @@ class Propal extends CommonObject $vatrate = $line->tva_tx; if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')'; - $result = $this->addline( + $result = $this->addline( $line->desc, $line->subprice, $line->qty, @@ -1138,7 +1137,7 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql.= " SET fk_delivery_address = ".$this->fk_delivery_address; $sql.= " WHERE ref = '".$this->db->escape($this->ref)."'"; - $sql.= " AND entity = ".$this->entity; + $sql.= " AND entity = ".setEntity($this); $result=$this->db->query($sql); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a7ce35974fb..f3361eb78ee 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -912,7 +912,6 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); // Proprietes particulieres a facture de remplacement $object->fk_facture_source = $_POST['fac_replacement']; @@ -946,7 +945,7 @@ if (empty($reshook)) if (! $error) { - if(!empty($originentity)){ + if (!empty($originentity)) { $object->entity = $originentity; } $object->socid = GETPOST('socid', 'int'); @@ -968,7 +967,6 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); // Proprietes particulieres a facture avoir $object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : ''; @@ -1150,7 +1148,6 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); // Source facture $object->fac_rec = GETPOST('fac_rec', 'int'); @@ -1201,7 +1198,6 @@ if (empty($reshook)) $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); if (GETPOST('type') == Facture::TYPE_SITUATION) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 686190c359b..991569ec4ae 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -303,7 +303,6 @@ class Facture extends CommonInvoice if (! $this->cond_reglement_id) $this->cond_reglement_id = 0; if (! $this->mode_reglement_id) $this->mode_reglement_id = 0; $this->brouillon = 1; - if (empty($this->entity)) $this->entity = $conf->entity; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); @@ -474,7 +473,7 @@ class Facture extends CommonInvoice $sql.= ")"; $sql.= " VALUES ("; $sql.= "'(PROV)'"; - $sql.= ", ".$this->entity; + $sql.= ", ".setEntity($this); $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); $sql.= ", '".$this->db->escape($this->type)."'"; $sql.= ", '".$socid."'"; @@ -913,8 +912,8 @@ class Facture extends CommonInvoice $facture->remise_absolue = $this->remise_absolue; $facture->remise_percent = $this->remise_percent; - $facture->origin = $this->origin; - $facture->origin_id = $this->origin_id; + $facture->origin = $this->origin; + $facture->origin_id = $this->origin_id; $facture->lines = $this->lines; // Tableau des lignes de factures $facture->products = $this->lines; // Tant que products encore utilise @@ -1582,7 +1581,11 @@ class Facture extends CommonInvoice $this->tab_previous_situation_invoice = array(); $this->tab_next_situation_invoice = array(); - $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC'; + $sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture'; + $sql.= ' WHERE rowid <> '.$this->id; + $sql.= ' AND entity = '.$this->entity; + $sql.= ' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref; + $sql.= ' ORDER BY situation_counter ASC'; dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG); $result = $this->db->query($sql); @@ -3648,11 +3651,11 @@ class Facture extends CommonInvoice $sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement $sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir - if($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE){ + if (! empty($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE)) { // Select the last situation invoice $sqlSit = 'SELECT MAX(fs.rowid)'; $sqlSit.= " FROM ".MAIN_DB_PREFIX."facture as fs"; - $sqlSit.= " WHERE fs.entity = ".$conf->entity; + $sqlSit.= " WHERE fs.entity IN (".getEntity('invoice').")"; $sqlSit.= " AND fs.type = ".self::TYPE_SITUATION; $sqlSit.= " AND fs.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")"; $sqlSit.= " GROUP BY fs.situation_cycle_ref"; @@ -4178,7 +4181,7 @@ class Facture extends CommonInvoice public function newCycle() { $sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f'; - $sql.= " WHERE f.entity in (".getEntity('invoice', 0).")"; + $sql.= " WHERE f.entity IN (".getEntity('invoice', 0).")"; $resql = $this->db->query($sql); if ($resql) { if ($resql->num_rows > 0) @@ -4222,8 +4225,8 @@ class Facture extends CommonInvoice global $conf; $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; - $sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref; - $sql .= ' and situation_counter < ' . $this->situation_counter; + $sql .= ' WHERE situation_cycle_ref = ' . $this->situation_cycle_ref; + $sql .= ' AND situation_counter < ' . $this->situation_counter; $sql .= ' AND entity = '. ($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); $res = array(); @@ -4304,7 +4307,9 @@ class Facture extends CommonInvoice if (!empty($this->situation_cycle_ref)) { // No point in testing anything if we're not inside a cycle - $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity); + $sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture'; + $sql.= ' WHERE situation_cycle_ref = ' . $this->situation_cycle_ref; + $sql.= ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity); $resql = $this->db->query($sql); if ($resql && $resql->num_rows > 0) { From b0042995ac7fb8bf00d23033b41154d02f195f7a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Jun 2019 12:04:17 +0200 Subject: [PATCH 008/255] FIX add docs --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de52d3a74d1..69fde6369e6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -75,7 +75,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * @param int $shared 0=Return id of current entity only, * 1=Return id of current entity + shared entities (default) * @param object $currentobject Current object if needed - * @return mixed Entity id(s) to use + * @return mixed Entity id(s) to use ( eg. entity IN ('.getEntity(elementname).')' ) */ function getEntity($element, $shared = 1, $currentobject = null) { @@ -96,10 +96,10 @@ function getEntity($element, $shared = 1, $currentobject = null) } /** - * Get entity id to use when to create an object + * Set entity id to use when to create an object * * @param object $currentobject Current object - * @return mixed Entity id to use + * @return mixed Entity id to use ( eg. entity = '.getEntity($object) ) */ function setEntity($currentobject) { From e5e611154436f64b8b43d1d237a1ec76ff97c0b5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Jun 2019 12:05:58 +0200 Subject: [PATCH 009/255] FIX wrong function name --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 69fde6369e6..978c360f60d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -99,7 +99,7 @@ function getEntity($element, $shared = 1, $currentobject = null) * Set entity id to use when to create an object * * @param object $currentobject Current object - * @return mixed Entity id to use ( eg. entity = '.getEntity($object) ) + * @return mixed Entity id to use ( eg. entity = '.setEntity($object) ) */ function setEntity($currentobject) { From 7ffc46e1da538cac9b848c4702f645842e7cafce Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 19 Jul 2019 09:47:05 +0200 Subject: [PATCH 010/255] FIX When we are in update mode, so we use $this->entity --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index db32cc787e5..6e52660206f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Christophe Combelles - * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2005-2019 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2018 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -111,7 +111,7 @@ function setEntity($currentobject) } else { - return $conf->entity; + return ((is_object($currentobject) && $currentobject->id > 0 && $currentobject->entity > 0) ? $currentobject->entity : $conf->entity); } } From 5a385bf1ccd2731090975ac75d7bd9c734404fc4 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 18 Jul 2019 11:53:36 +0200 Subject: [PATCH 011/255] ADD extrafields on global search --- htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/admin/product.php | 11 +++++++++++ htdocs/product/list.php | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index d4135c2273e..b759a023bf3 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -340,3 +340,4 @@ ErrorDestinationProductNotFound=Produit destination non trouvé ErrorProductCombinationNotFound=Variante du produit non trouvé ActionAvailableOnVariantProductOnly=Action disponible uniquement sur la variante du produit ProductsPricePerCustomer=Prix produit par clients +GlobalSearchOnExtrafield=Recherche globale : Appliquer la recherche sur les extrafields (Attention : les dates sont au format YYYY-MM-DD) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index a7e45d488e1..1fb2ac73fcf 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -146,6 +146,10 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); + + $value = GETPOST('activate_globalSearchOnExtrafield', 'alpha'); + $res = dolibarr_set_const($db, "PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD", $value,'chaine',0,'',$conf->entity); + if ($value) { $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; $resql = $db->query($sql_test); @@ -675,6 +679,13 @@ if (! empty($conf->fournisseur->enabled)) print ''; } +print ''; +print ''.$langs->trans("GlobalSearchOnExtrafield").''; +print ''; +print $form->selectyesno("activate_globalSearchOnExtrafield", (! empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD)?$conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD:0), 1); +print ''; +print ''; + if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { // Add canvas feature diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 1a9b5fa1f6f..54a60d8e9bf 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -148,6 +148,22 @@ if (! empty($conf->barcode->enabled)) { $fieldstosearchall['p.barcode']='Gencod'; $fieldstosearchall['pfp.barcode']='GencodBuyPrice'; } +//global search on extrafields +if(!empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD) && !empty($extralabels)) { + foreach($extralabels as $codeExtra => $labelExtra) { + $TExtraTypeNotHandled=array( + 'boolean', + 'select', + 'sellist', + 'radio', + 'checkbox', + 'chkbxlst', + 'link', + 'separate', + ); + if(!in_array($extrafields->attribute_type[$codeExtra], $TExtraTypeNotHandled)) $fieldstosearchall['ef.' . $codeExtra] = $labelExtra; + } +} if (empty($conf->global->PRODUIT_MULTIPRICES)) { From 03ed4eb14191aa33170abbc6aa8f18da7de5a17c Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 19 Jul 2019 14:39:30 +0200 Subject: [PATCH 012/255] modif rowspan --- htdocs/product/admin/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 1fb2ac73fcf..ed0bcb88e74 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -552,7 +552,7 @@ print ' '."\n"; * Other parameters */ -$rowspan = 4; +$rowspan = 5; if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++; From 0ff121e7f1d51aba44675e532d2368d9644d4ff5 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 23 Jul 2019 16:51:08 +0200 Subject: [PATCH 013/255] add some new field on global search --- htdocs/product/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 54a60d8e9bf..a3dac45dcab 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -136,6 +136,11 @@ $fieldstosearchall = array( 'p.label'=>"ProductLabel", 'p.description'=>"Description", "p.note"=>"Note", + "p.note_public"=>"NotePublic", + "p.url"=>"PublicUrl", + "p.accountancy_code_sell"=>"AccountancyCodeSell", + "p.accountancy_code_buy"=>"AccountancyCodeBuy", + ); // multilang if (! empty($conf->global->MAIN_MULTILANGS)) @@ -148,6 +153,7 @@ if (! empty($conf->barcode->enabled)) { $fieldstosearchall['p.barcode']='Gencod'; $fieldstosearchall['pfp.barcode']='GencodBuyPrice'; } + //global search on extrafields if(!empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD) && !empty($extralabels)) { foreach($extralabels as $codeExtra => $labelExtra) { From efd89588e56999ba34b3bf9ea48660a8aec74f81 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 25 Jul 2019 12:21:28 +0200 Subject: [PATCH 014/255] fix trans --- htdocs/langs/en_US/products.lang | 3 ++- htdocs/langs/fr_FR/products.lang | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 36ca0ede002..d9cf127b40d 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -340,4 +340,5 @@ ErrorCopyProductCombinations=There was an error while copying the product varian ErrorDestinationProductNotFound=Destination product not found ErrorProductCombinationNotFound=Product variant not found ActionAvailableOnVariantProductOnly=Action only available on the variant of product -ProductsPricePerCustomer=Product prices per customers \ No newline at end of file +ProductsPricePerCustomer=Product prices per customers +GlobalSearchOnExtrafield=Global search : apply on extrafields too (Warning : date format is YYYY-MM-DD) diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index b759a023bf3..7ab9f7a0f03 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -339,5 +339,4 @@ ErrorCopyProductCombinations=Une erreur s'est produite lors de la copie des vari ErrorDestinationProductNotFound=Produit destination non trouvé ErrorProductCombinationNotFound=Variante du produit non trouvé ActionAvailableOnVariantProductOnly=Action disponible uniquement sur la variante du produit -ProductsPricePerCustomer=Prix produit par clients -GlobalSearchOnExtrafield=Recherche globale : Appliquer la recherche sur les extrafields (Attention : les dates sont au format YYYY-MM-DD) +ProductsPricePerCustomer=Prix produit par clients \ No newline at end of file From 9a0e0fbdd2a03e3fc9ebf80cdbcb6303be719157 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jul 2019 18:01:16 +0200 Subject: [PATCH 015/255] Update product.php --- htdocs/product/admin/product.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ed0bcb88e74..ae911c04b81 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -147,8 +147,8 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); - $value = GETPOST('activate_globalSearchOnExtrafield', 'alpha'); - $res = dolibarr_set_const($db, "PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD", $value,'chaine',0,'',$conf->entity); + //$value = GETPOST('activate_globalSearchOnExtrafield', 'alpha'); + //$res = dolibarr_set_const($db, "PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD", $value,'chaine',0,'',$conf->entity); if ($value) { $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; @@ -679,12 +679,12 @@ if (! empty($conf->fournisseur->enabled)) print ''; } -print ''; +/*print ''; print ''.$langs->trans("GlobalSearchOnExtrafield").''; print ''; print $form->selectyesno("activate_globalSearchOnExtrafield", (! empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD)?$conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD:0), 1); print ''; -print ''; +print '';*/ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { From 0c6499f1935d4ed030dbd5379ab376ebe815a25c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jul 2019 18:01:47 +0200 Subject: [PATCH 016/255] Update product.php --- htdocs/product/admin/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ae911c04b81..464ab169456 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -552,7 +552,7 @@ print ' '."\n"; * Other parameters */ -$rowspan = 5; +$rowspan = 4; if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $rowspan++; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++; From bd2f5ba037ff02c713a560f229696110fcd7257c Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 26 Jul 2019 14:16:54 +0200 Subject: [PATCH 017/255] FIX Replace conf by hidden conf editable by user --- htdocs/product/admin/product.php | 9 --------- htdocs/product/list.php | 23 ++--------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 464ab169456..279265b8e96 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -147,9 +147,6 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); - //$value = GETPOST('activate_globalSearchOnExtrafield', 'alpha'); - //$res = dolibarr_set_const($db, "PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD", $value,'chaine',0,'',$conf->entity); - if ($value) { $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; $resql = $db->query($sql_test); @@ -679,12 +676,6 @@ if (! empty($conf->fournisseur->enabled)) print ''; } -/*print ''; -print ''.$langs->trans("GlobalSearchOnExtrafield").''; -print ''; -print $form->selectyesno("activate_globalSearchOnExtrafield", (! empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD)?$conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD:0), 1); -print ''; -print '';*/ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index a3dac45dcab..460e9d5ee45 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -136,10 +136,6 @@ $fieldstosearchall = array( 'p.label'=>"ProductLabel", 'p.description'=>"Description", "p.note"=>"Note", - "p.note_public"=>"NotePublic", - "p.url"=>"PublicUrl", - "p.accountancy_code_sell"=>"AccountancyCodeSell", - "p.accountancy_code_buy"=>"AccountancyCodeBuy", ); // multilang @@ -153,23 +149,8 @@ if (! empty($conf->barcode->enabled)) { $fieldstosearchall['p.barcode']='Gencod'; $fieldstosearchall['pfp.barcode']='GencodBuyPrice'; } - -//global search on extrafields -if(!empty($conf->global->PRODUIT_GLOBAL_SEARCH_ON_EXTRAFIELD) && !empty($extralabels)) { - foreach($extralabels as $codeExtra => $labelExtra) { - $TExtraTypeNotHandled=array( - 'boolean', - 'select', - 'sellist', - 'radio', - 'checkbox', - 'chkbxlst', - 'link', - 'separate', - ); - if(!in_array($extrafields->attribute_type[$codeExtra], $TExtraTypeNotHandled)) $fieldstosearchall['ef.' . $codeExtra] = $labelExtra; - } -} +// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel' +if (! empty($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS)) $fieldstosearchall=dolExplodeIntoArray($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS); if (empty($conf->global->PRODUIT_MULTIPRICES)) { From 9e92b73d4aaa514c3395629047fe7c1c5469eca0 Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 29 Jul 2019 17:12:41 +0200 Subject: [PATCH 018/255] Move open dashboard --- htdocs/index.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index d6ce8c90067..bce4c521ad5 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -100,7 +100,7 @@ if (! empty($conf->global->MAIN_MOTD)) } -print '
'; + /* @@ -112,7 +112,7 @@ $boxstat=''; // Load translation files required by page $langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts')); -if (empty($user->societe_id)) +if (empty($user->societe_id) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $boxstat.='
'; $boxstat.=''; @@ -359,9 +359,8 @@ if (empty($user->societe_id)) $boxstat.='
'; $boxstat.='
'; } -//print $boxstat; -print '
'; + /* @@ -636,7 +635,13 @@ $boxwork.=''; $boxwork.=''; // End table array of working board $boxwork.='
'; -print '
'; + + +print '
'; +print $boxwork; +print '
'; + +print '
'; print '
'; @@ -649,7 +654,7 @@ $boxlist.='
'; $boxlist.='
'; -$boxlist.=$boxwork; +//$boxlist.=$boxwork; $boxlist.=$resultboxes['boxlista']; $boxlist.= '
'; From 8b56ca8cd03ecf02a7b0fb7045b5f906a57d1819 Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 29 Jul 2019 17:14:52 +0200 Subject: [PATCH 019/255] Little css and images change --- htdocs/theme/eldy/img/title_bank.png | Bin 638 -> 501 bytes htdocs/theme/eldy/img/title_commercial.png | Bin 650 -> 431 bytes htdocs/theme/eldy/img/title_home.png | Bin 474 -> 750 bytes htdocs/theme/eldy/img/title_products.png | Bin 374 -> 687 bytes htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/img/title_bank.png b/htdocs/theme/eldy/img/title_bank.png index c916e89d8f65eb07682f788919715f2d829aad7b..5bd5d25a1eaf5da8b760719867d116addbb76666 100644 GIT binary patch literal 501 zcmVKQbqZWJ*-SB^#rf*p+c#me8wBh|4C|AHiY~5S%X-dE4-6Ufw@?2 z6Q>EJigKDe4LP0ysW``iQubxrKntC?yfyPxw#oNLeO!~ia%-VbJQ@2qkgehrTqvmA zKTFrIL(r|^zag`Ktz0vWU|AZ$vNVEaX#~sC2$rQ0EX&jj#3mf7i{{TC+>5OI&zJxbV3s{usHY(s2CpZfmUz+Sf=%I3r7olKp3Z&xnxL+i# r-;_KRE$$b|7CxqP8Oc#QNa literal 638 zcmV-^0)hRBP)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^-6 z4KXAJaWQiM00I6!AMY|_yYV@l!P0AL_>qZ z0g#dt;G6(Mk7RC;Kt;7Q<7l;V91|yT41UrUYme=x-M4RM*J6yJs@S2zsL9vlYw{Js zZq`i^X#+ut{6b?)xDnaqXnqffL}UmwfnL?zrUjh+{O% z7ce>71PGkxLrw8XzpdBuzO$djZ9)vb3S8@g4sAyQB5jF7HLY4@ zv<EEoX&~e z2adI@NH8o@^KPwuw;)$1fZ#5n0JeS5fkhy66(*-7;P~&$P;L z8{dh)ToC`6@{LJZ3)Xk~_rO<1{E1VUdPR0)g~=ymtOWFsqWy2+NNXHBk)4;Fq>>VO zmVm71y*a)f<$U*AlhiC(xx~{7vz&=(WD*ylh diff --git a/htdocs/theme/eldy/img/title_commercial.png b/htdocs/theme/eldy/img/title_commercial.png index 6671810c5deaa7447b9e6fe41a32f6b57066791c..cbfe44fa539763fba67dabc62f1083f714ac8afb 100644 GIT binary patch literal 431 zcmV;g0Z{&lP)XN3KY{M5=Ct7dY#w-|I#$p&c3(S%xbg@q>(kqncxzm$h;Na@Y+B#h#WJN zi7{L6)jHD_%xz-23xo3(4bDSFV`^{}xxS84U=7CzmRr8v2j<>3)lM}Sn%_7#_Nv%B z8-oR&u~c2y+X!unnB3*sOR-s4U=bmhtsr{eB!AxEdBB>B6oI3ZWIW*!-!=Q+qzDYt zOe%xHR1U&mpPQr{;iGF8HN59I!FAV8D!8M)hsm~MhWz(5GQkzj+WZ9#_{57HJ{A8j ZegNWfxVi$fRiyv`002ovPDHLkV1l%2vTgtX literal 650 zcmV;50(Jd~P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^-6 z4KXu?qO`OC00Ih0L_t(o!_`^Aje{@{oIT|qO5iHMCD6f90wquaC8UIuKnbCO^L60s zfK;&e*+?A1hQNXWX&(`Gc0Afyk1;Vb&iZ`d#Lub0U$*#DA}Rso08#)Q01Ln}bEBGw znbiV-0pI|zCmeu6EuSLrG5~rQ_rrh}#`(>-t<6gst&)f=fNVj@(yF{`!4r`I@I5iC z1@Mq~Jsp5_jfge6O%izbBU*3(3JKGjml4q?GrK6=rq>QfMG2txynjWtH1|cJ)jA?d zrLVtOZ2-8LT1aB=u$7cV*DH~^A~sPsDFMq1qh6XA@B*? zoF3&cl7>V%var>n)dXMr4jmIBPNE7{#8-JB^09*s$L-wJJZOm+-EOHqW z>ib2MvXNt8Hp8^F+U#qTO(^lR=Uqaj^R;Bt+8Vrl!}=Dxf+wOpAk-oFDbJtp&HNNw zuGbhIhhlyPTSK;g17oiu{_Vkwz_Pi_&n%sEFXks%8u^%H*Z${TmkX`(L48;7iN`9$ zzg!S-&D?XUjJKLLLBrSN^7YrdfC=E8j7ekqc_ZH4dH@c8H?lh?Q7;!fZPW0dCgj%@yM{6#xJL07*qoM6N<$f{ThDTmS$7 diff --git a/htdocs/theme/eldy/img/title_home.png b/htdocs/theme/eldy/img/title_home.png index 505d18ab403a14820316e0e9e51ba20c6cec9784..e89613dcd753d62536d1192b0f4b89b0e75ab093 100644 GIT binary patch literal 750 zcmV>vum$-o5fcGq#Gi6tCJx87~+KWLHQZa}<0srTWw}5-q zf~&zvj1=j#fFC%IX@3iH4sHbCvT+NwlMT59k17OA;t7^c7UWj+1wdZlX#82MzAtWH zRmdY43IN=}{Ma`iw*$T*#n_F_R8ss{32a@)pDdjzguW{Ws9I7zSgdkgmN1#JA!bH=2G2pv|nXzw?@Qf7j zU_5ZsMH_G^*)`0Ly$f-_gtvf)F<`kb6k6M3REzdNf+5lAl4vbnmjO(o2OCmt5952l zdlw5rfDL#aX!su6Qr=w{s1PuTucCFEs0D8W-d9+i1>Av;fd=W5qTE?sF0yBNz3|C3 zhQBUlU09Q9RO&6vD~A2PYpg(LTz5i7EvQR9 zuc|U!Hqvi%9X4kHi>YyvAsa&=*=zkjsj^2i|GT-8T&V1 gR-K~T_>`)upQk|lC+m|yIRF3v07*qoM6N<$g0pf*Q~&?~ literal 474 zcmV<00VV#4P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2i^-6 z4KoLpAR>bR00CM_L_t(o!|j>dZG$irhQCwwy^N3z!Ukc4jKBu%2+anJkWt76bOX8p z8=Srvi69aV#9XZUNWX+EUp~;e*jQARQ0SeAeKJOMS`t7Qk8OG+o z7jSeAobo9QcXKZV@A^K2e)$Ew!viT$8lk(&HiHKe z;5q}kRRg4}!@EFiUI1@Z0m<6%K2=(I_E@A&B2t80VLwIW>@Ckbm#J288*>0#pc7YB zbpzGU0vJPeY&HTP4d6%6hna= zJNRRCn+PA_Bm5%pRj}}?+8FlZzOD3`=g;n!NU{)Y4P4r1>phjkOXQ904^L8r#{ED; Q#Q*>R07*qoM6N<$f*aez@c;k- diff --git a/htdocs/theme/eldy/img/title_products.png b/htdocs/theme/eldy/img/title_products.png index 100edf445f129bfc7d97186aea3337af6f07f4b2..c608a2c7a8607a03af4088de526a0335749ae105 100644 GIT binary patch literal 687 zcmV;g0#N;lP)kfMciIoofjr%x>wRM8+#uz?yfy%Sb7{~sq zpf=zP=1M^2**q>t$|6YpUSX&WTmt)W1s_WWT)?H&7D~>2kIUGT2elsO@wBAl@0i4K zNygh6O0P|(W6JoP!#S*LJKKn7C7sOTEQa%*IHTco>}<&xk0rHlyx@dIT*cl3PNw$iv-XOqkS${@h3y}$@Ir8bgYD>}c0TU7#P1GNTxux>2T0Ygh;RRN1EuG#_1wx?PF?_zra zsGfj%TU`u2!mCgxRRTuQf51@vOMqQjnv!1?tEnbV<9U~R%T2tkm*=mtV3XL@Wz6d) zuGdMW7+703NILw4_>For2W-CJ{F^%V>cg0>0I)3BG!Eq_HTlQ)AOhe;oWPTU<7Xrv zxP^5@SVn)u%2+?e%4l%L>H>`p77Mg;ut7m<2kTTGXcVwUsDq3S;8=Qo4-aEF{R2xY V!0-roM&1Ab002ovPDHLkV1h=`GfMyf literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^`arDB!3HE>Y`eG%NHG=%xjQkeJ16rJ$YD$Jc6R~N zK=9LfcRi5eEbxddW?zuQ z;~{U815aywFY^x0zJk0%Tz(8W2RM2Tu)SjId%%(R;m_ietw&<^$T6O&KFR8I>7Kjh z(xVd}}!@Z;ra>sqxe8_%!lYXGq?-l!hhBmKW ze6@b|(kU;lI(Np&I=uZLyzk>uC3%^`&fM2db(=0NQ_h^vy5Ka6rSG3RA diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index f02c25113ef..c1ea24c3070 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -38,9 +38,9 @@ $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); // Colors $colorbackhmenu1='60,70,100'; // topmenu -$colorbackvmenu1='248,248,248'; // vmenu +$colorbackvmenu1='249,250,252'; // vmenu $colortopbordertitle1='200,200,200'; // top border of title -$colorbacktitle1='220,220,223'; // title of tables,list +$colorbacktitle1='233,234,238'; // title of tables,list $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; $colorbacklineimpair1='255,255,255'; // line impair From 9b84987cc1499eaa9fe1e55fe948965d4202fb32 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 1 Aug 2019 12:33:19 +0200 Subject: [PATCH 020/255] prepare new dashboard --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + htdocs/comm/propal/class/propal.class.php | 5 +- htdocs/commande/class/commande.class.php | 1 + htdocs/compta/facture/class/facture.class.php | 1 + htdocs/contrat/class/contrat.class.php | 4 + htdocs/core/class/workboardresponse.class.php | 12 + .../class/expensereport.class.php | 2 + .../class/fournisseur.commande.class.php | 1 + .../fourn/class/fournisseur.facture.class.php | 1 + htdocs/holiday/class/holiday.class.php | 1 + htdocs/index.php | 223 +++++++++++++++--- htdocs/langs/en_US/contracts.lang | 3 + htdocs/langs/en_US/main.lang | 3 + htdocs/langs/en_US/members.lang | 3 +- htdocs/projet/class/project.class.php | 1 + .../class/supplier_proposal.class.php | 4 + htdocs/theme/eldy/global.inc.php | 8 + htdocs/theme/eldy/img/title_document.png | Bin 0 -> 570 bytes htdocs/theme/eldy/info-box.inc.php | 114 +++++++++ htdocs/theme/md/img/title_document.png | Bin 0 -> 570 bytes 21 files changed, 359 insertions(+), 30 deletions(-) create mode 100644 htdocs/theme/eldy/img/title_document.png create mode 100644 htdocs/theme/eldy/info-box.inc.php create mode 100644 htdocs/theme/md/img/title_document.png diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dc894663e4c..12825d9a780 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2315,6 +2315,7 @@ class Adherent extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); + $response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; $response->img=img_object('', "user"); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6e4e3fb941b..79ae09c1678 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1103,6 +1103,7 @@ class ActionComm extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $conf->agenda->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); + $response->labelShort = $langs->trans("ActionsToDoShort"); $response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda'; if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; $response->img = img_object('', "action", 'class="inline-block valigntextmiddle"'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c1dde5e2aa4..481f6a5096f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3277,21 +3277,24 @@ class Propal extends CommonObject $delay_warning = 0; $statut = 0; - $label = ''; + $label = $labelShort = ''; if ($mode == 'opened') { $delay_warning=$conf->propal->cloture->warning_delay; $statut = self::STATUS_VALIDATED; $label = $langs->trans("PropalsToClose"); + $labelShort = $langs->trans("ToClose"); } if ($mode == 'signed') { $delay_warning=$conf->propal->facturation->warning_delay; $statut = self::STATUS_SIGNED; $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered + $labelShort = $langs->trans("ToBill"); } $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; + $response->labelShort = $labelShort; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; $response->img = img_object('', "propal"); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b1e2262f109..fb246c7e232 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3411,6 +3411,7 @@ class Commande extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); + $response->labelShort = $langs->trans("ToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; $response->img=img_object('', "order"); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e5b8c0795ed..00b25b64506 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3889,6 +3889,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); + $response->labelShort=$langs->trans("Unpaid"); $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills'; $response->img=img_object('', "bill"); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0fb460466ef..666b80fb2d4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2186,23 +2186,27 @@ class Contrat extends CommonObject if ($mode == 'inactive') { $warning_delay = $conf->contrat->services->inactifs->warning_delay; $label = $langs->trans("BoardNotActivatedServices"); + $labelShort = $langs->trans("BoardNotActivatedServicesShort"); $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc'; } elseif ($mode == 'expired') { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc'; $label = $langs->trans("BoardExpiredServices"); + $labelShort = $langs->trans("BoardExpiredServicesShort"); } else { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc'; //$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year']; //if ($warning_delay >= 0) $url.='&filter=expired'; $label = $langs->trans("BoardRunningServices"); + $labelShort = $langs->trans("BoardRunningServicesShort"); } $response = new WorkboardResponse(); $response->warning_delay = $warning_delay/60/60/24; $response->label = $label; + $response->labelShort = $labelShort; $response->url = $url; $response->img = img_object('', "contract"); diff --git a/htdocs/core/class/workboardresponse.class.php b/htdocs/core/class/workboardresponse.class.php index 35449693599..3af5feaecbc 100644 --- a/htdocs/core/class/workboardresponse.class.php +++ b/htdocs/core/class/workboardresponse.class.php @@ -37,6 +37,18 @@ class WorkboardResponse */ public $label; + /** + * Short Label of the warning + * @var string + */ + public $labelShort; + + /** + * infoKey of the warning + * @var string + */ + public $infoKey = 'todo'; + /** * URL to list to do items * @var string diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 34f60120925..272125530e3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2333,12 +2333,14 @@ class ExpenseReport extends CommonObject { $response->warning_delay=$conf->expensereport->approve->warning_delay/60/60/24; $response->label=$langs->trans("ExpenseReportsToApprove"); + $response->labelShort=$langs->trans("ToApprove"); $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=2'; } else { $response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24; $response->label=$langs->trans("ExpenseReportsToPay"); + $response->labelShort=$langs->trans("ToPay"); $response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5'; } $response->img=img_object('', "trip"); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9d5bfce0189..a77206d5f42 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2835,6 +2835,7 @@ class CommandeFournisseur extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SuppliersOrdersToProcess"); + $response->labelShort=$langs->trans("ToProcess"); $response->url=DOL_URL_ROOT.'/fourn/commande/list.php?statut=1,2,3&mainmenu=commercial&leftmenu=orders_suppliers'; $response->img=img_object('', "order"); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 41ac2f126a7..dcafc3bdbf2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2213,6 +2213,7 @@ class FactureFournisseur extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); + $response->labelShort=$langs->trans("ToPay"); $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills'; $response->img=img_object($langs->trans("Bills"), "bill"); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 533f6c9c748..b540ba8248e 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2243,6 +2243,7 @@ class Holiday extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->holiday->approve->warning_delay/60/60/24; $response->label=$langs->trans("HolidaysToApprove"); + $response->labelShort=$langs->trans("ToApprove"); $response->url=DOL_URL_ROOT.'/holiday/list.php?search_statut=2&mainmenu=hrm&leftmenu=holiday'; $response->img=img_object('', "holiday"); diff --git a/htdocs/index.php b/htdocs/index.php index bce4c521ad5..6276d85f579 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -374,13 +374,15 @@ $dashboardlines=array(); // Do not include sections without management permission require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; + + // Number of actions to do (late) if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board=new ActionComm($db); - - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; // deprecated } // Number of project opened @@ -388,7 +390,8 @@ if (! empty($conf->projet->enabled) && $user->rights->projet->lire) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $board=new Project($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of tasks to do (late) @@ -396,7 +399,8 @@ if (! empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) { include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $board=new Task($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of commercial proposals opened (expired) @@ -404,9 +408,13 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board=new Propal($db); - $dashboardlines[] = $board->load_board($user, "opened"); - // Number of commercial proposals CLOSED signed (billed) - $dashboardlines[] = $board->load_board($user, "signed"); + + $workBoard = $board->load_board($user, "opened"); + $dashboardlines[$board->element.'_opened'] = $workBoard; + + $workBoard = $board->load_board($user, "signed"); + $dashboardlines[$board->element.'_signed'] = $workBoard; + } // Number of commercial proposals opened (expired) @@ -414,9 +422,13 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos { include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $board=new SupplierProposal($db); - $dashboardlines[] = $board->load_board($user, "opened"); + + $workBoard = $board->load_board($user, "opened"); + $dashboardlines[$board->element.'_opened'] = $workBoard; + // Number of commercial proposals CLOSED signed (billed) - $dashboardlines[] = $board->load_board($user, "signed"); + $workBoard = $board->load_board($user, "signed"); + $dashboardlines[$board->element.'_signed'] = $workBoard; } // Number of customer orders a deal @@ -424,7 +436,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $board=new Commande($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of suppliers orders a deal @@ -432,7 +445,8 @@ if (! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->comma { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board=new CommandeFournisseur($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of services enabled (delayed) @@ -440,16 +454,20 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $board=new Contrat($db); - $dashboardlines[] = $board->load_board($user, "inactive"); + $workBoard = $board->load_board($user, "inactive"); + $dashboardlines[$board->element.'_inactive'] = $workBoard; + // Number of active services (expired) - $dashboardlines[] = $board->load_board($user, "active"); + $workBoard = $board->load_board($user, "active"); + $dashboardlines[$board->element.'_active'] = $workBoard; } // Number of invoices customers (has paid) if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $board=new Facture($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of supplier invoices (has paid) @@ -457,7 +475,8 @@ if (! empty($conf->supplier_invoice->enabled) && ! empty($user->rights->fourniss { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board=new FactureFournisseur($db); - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } // Number of transactions to conciliate @@ -468,7 +487,8 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate if ($nb > 0) { - $dashboardlines[] = $board->load_board($user); + $workBoard = $board->load_board($user); + $dashboardlines[$board->element] = $workBoard; } } @@ -477,7 +497,7 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s { include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; $board=new RemiseCheque($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['RemiseCheque'] = $board->load_board($user); } // Number of foundation members @@ -485,7 +505,7 @@ if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire && ! $use { include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $board=new Adherent($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['Adherent'] = $board->load_board($user); } // Number of expense reports to approve @@ -493,7 +513,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->appr { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board=new ExpenseReport($db); - $dashboardlines[] = $board->load_board($user, 'toapprove'); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'toapprove'); } // Number of expense reports to pay @@ -501,7 +521,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->to_p { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $board=new ExpenseReport($db); - $dashboardlines[] = $board->load_board($user, 'topay'); + $dashboardlines['ExpenseReport'] = $board->load_board($user, 'topay'); } // Number of holidays to approve @@ -509,7 +529,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->approve) { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $board=new Holiday($db); - $dashboardlines[] = $board->load_board($user); + $dashboardlines['Holiday'] = $board->load_board($user); } $object=new stdClass(); @@ -520,15 +540,103 @@ if ($reshook == 0) { $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); } +/* grouping dashboard stats */ +$dashboardgroup = array ( + 'action' => + array ( + 'groupName' => 'Agenda', + 'stats' => array ('action'), + ), + 'project' => + array ( + 'groupName' => 'Projects', + 'stats' => array ('project','project_task'), + ), + 'propal' => + array ( + 'groupName' => 'Proposals', + 'stats' => + array ('propal_opened','propal_signed'), + ), + 'supplier_proposal' => + array ( + 'groupName' => 'SupplierProposals', + 'stats' => + array ('supplier_proposal_opened','supplier_proposal_signed'), + ), + 'commande' => + array ( + 'groupName' => 'Orders', + 'stats' => + array ('commande'), + ), + 'order_supplier' => + array ( + 'groupName' => 'SuppliersOrders', + 'stats' => + array ('order_supplier'), + ), + 'contrat' => + array ( + 'groupName' => 'Contracts', + 'stats' => + array ('contrat_inactive','contrat_active'), + ), + 'facture' => + array ( + 'groupName' => 'Invoices', + 'stats' => + array ('facture'), + ), + 'invoice_supplier' => + array ( + 'groupName' => 'SupplierInvoices', + 'stats' => + array ('invoice_supplier'), + ), + 'bank_account' => + array ( + 'groupName' => 'BankAccount', + 'stats' => + array ('bank_account','RemiseCheque'), + ), + /*'RemiseCheque' => + array ( + 'groupName' => 'BankChecks', + 'stats' => + array ('RemiseCheque'), + ),*/ + 'Adherent' => + array ( + 'groupName' => 'Members', + 'stats' => + array ('Adherent'), + ), + 'ExpenseReport' => + array ( + 'groupName' => 'ExpenseReport', + 'stats' => + array ('ExpenseReport'), + ), + 'Holiday' => + array ( + 'groupName' => 'Holidays', + 'stats' => + array ('Holiday'), + ), +); + + + // Calculate total nb of late $totallate=$totaltodo=0; //Remove any invalid response //load_board can return an integer if failed or WorkboardResponse if OK $valid_dashboardlines=array(); -foreach($dashboardlines as $tmp) +foreach($dashboardlines as $infoKey => $tmp) { - if ($tmp instanceof WorkboardResponse) $valid_dashboardlines[] = $tmp; + if ($tmp instanceof WorkboardResponse) $valid_dashboardlines[$infoKey] = $tmp; } // We calculate $totallate. Must be defined before start of next loop because it is show in first fetch on next loop @@ -578,14 +686,64 @@ $boxwork.=''."\n"; $nbworkboardempty=0; if (! empty($valid_dashboardlines)) { + $openedDashBoard = ''; + $boxwork.='
'; - foreach($valid_dashboardlines as $board) + foreach($dashboardgroup as $groupKey => $groupElement) { + + $boards = array(); + foreach ($groupElement['stats'] as $infoKey) + { + if(!empty($valid_dashboardlines[$infoKey])) + { + $boards[] = $valid_dashboardlines[$infoKey]; + } + } + + if(!empty($boards)) + { + $groupName = $langs->trans($groupElement['groupName']); + $groupKeyLowerCase = strtolower($groupKey); + + $openedDashBoard.= '
'."\n"; + $openedDashBoard.= '
'."\n"; + $openedDashBoard.= ' '."\n"; + $openedDashBoard.= '
'."\n"; + + $openedDashBoard .= ' '.$groupName.'' . "\n"; + + foreach($boards as $board) { + $infoName = !empty($board->labelShort) ? $board->labelShort : $board->label ; + + $textLateTitle = $langs->trans("NActionsLate", $board->nbtodolate); + $textLateTitle.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; + + $textLate = img_picto($textLateTitle, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').''; + $textLate .= ''; + $textLate .= $board->nbtodolate; + $textLate .= ''; + + $openedDashBoard .= ' '.$infoName.' : '.$board->nbtodo.''.$textLate.'' . "\n"; + } + + + $openedDashBoard.= '
'."\n"; + $openedDashBoard.= '
'."\n"; + $openedDashBoard.= '
'."\n"; + $openedDashBoard.="\n"; + } + + } + + + foreach($valid_dashboardlines as $infoKey => $board) { if (empty($board->nbtodo)) $nbworkboardempty++; - $textlate = $langs->trans("NActionsLate", $board->nbtodolate); - $textlate.= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; + + + $boxwork .='
'; $boxwork .= '
'; @@ -611,6 +769,15 @@ if (! empty($valid_dashboardlines)) } $boxwork.='
'; $boxwork .="\n"; + + + + + + + + + } $boxwork .='
'; @@ -638,7 +805,7 @@ $boxwork.='
'; print '
'; -print $boxwork; +print '
'.$openedDashBoard.'
'; print '
'; print '
'; @@ -654,7 +821,7 @@ $boxlist.='
'; $boxlist.='
'; -//$boxlist.=$boxwork; +$boxlist.=$boxwork; $boxlist.=$resultboxes['boxlista']; $boxlist.= '
'; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 129b7d8416a..47572c355ab 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -51,6 +51,7 @@ ListOfClosedServices=List of closed services ListOfRunningServices=List of running services NotActivatedServices=Inactive services (among validated contracts) BoardNotActivatedServices=Services to activate among validated contracts +BoardNotActivatedServicesShort=Services to activate LastContracts=Latest %s contracts LastModifiedServices=Latest %s modified services ContractStartDate=Start date @@ -65,7 +66,9 @@ DateEndReal=Real end date DateEndRealShort=Real end date CloseService=Close service BoardRunningServices=Services running +BoardRunningServicesShort=Services running BoardExpiredServices=Services expired +BoardExpiredServicesShort=Services expired ServiceStatus=Status of service DraftContracts=Drafts contracts CloseRefusedBecauseOneServiceActive=Contract can't be closed as there is at least one open service on it diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1cadc32f4ab..7f99a51a064 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -981,3 +981,6 @@ PaymentInformation=Payment information ValidFrom=Valid from ValidUntil=Valid until NoRecordedUsers=No users +ToClose=To close +ToProcess=To process +ToApprove=To approve diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index acae5aa73fb..5886c598d52 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -29,6 +29,7 @@ MenuMembersUpToDate=Up to date members MenuMembersNotUpToDate=Out of date members MenuMembersResiliated=Terminated members MembersWithSubscriptionToReceive=Members with subscription to receive +MembersWithSubscriptionToReceiveShort=Subscription to receive DateSubscription=Subscription date DateEndSubscription=Subscription end date EndSubscription=End subscription @@ -197,4 +198,4 @@ SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subsc SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5') MembershipPaid=Membership paid for current period (until %s) YouMayFindYourInvoiceInThisEmail=You may find your invoice attached to this email -XMembersClosed=%s member(s) closed \ No newline at end of file +XMembersClosed=%s member(s) closed diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index eecf314dbf6..6e2b0a73a5e 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1796,6 +1796,7 @@ class Project extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $conf->projet->warning_delay/60/60/24; $response->label = $langs->trans("OpenedProjects"); + $response->labelShort = $langs->trans("Opened"); if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/list.php?search_project_user=-1&search_status=1&mainmenu=project'; $response->img = img_object('', "projectpub"); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f3e0315c75f..e871652a56d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2281,20 +2281,24 @@ class SupplierProposal extends CommonObject $resql=$this->db->query($sql); if ($resql) { + $label = $labelShort = ''; if ($mode == 'opened') { $delay_warning=$conf->supplier_proposal->cloture->warning_delay; $statut = self::STATUS_VALIDATED; $label = $langs->trans("SupplierProposalsToClose"); + $labelShort = $langs->trans("ToClose"); } if ($mode == 'signed') { $delay_warning=$conf->supplier_proposal->facturation->warning_delay; $statut = self::STATUS_SIGNED; $label = $langs->trans("SupplierProposalsToProcess"); // May be billed or ordered + $labelShort = $langs->trans("ToProcess"); } $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; + $response->labelShort = $labelShort; $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut; $response->img = img_object('', "propal"); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d0a0c5958ef..15f87cb6203 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3198,7 +3198,13 @@ span.boxstatsindicator { font-size: 130%; font-weight: normal; line-height: 29px; + flex-grow: 1; + } + + + + span.dashboardlineindicator, span.dashboardlineindicatorlate { font-size: 130%; font-weight: normal; @@ -5750,3 +5756,5 @@ div.tabsElem a.tab { %A_P)R3T1Tlqm)FKby#{*c} zDu|8v1U`WX78Zh~d4L45vP&YQFp$ziaOSeModMvj>-Z*}e=BO$VaQ$wCR>+T&{!AF?Kmr6Q+vncZ( z6A?U#hm~|{(E27B3)ZE|F_X&=JjVA#>fP`fcOG#loe@mi>EMI5S!5X zR#-}tD|i}T>lSH!ll-@WA4h8Ohuz%7d2ATn7lm(lBJnTj7X$X6)0gJvOaK4?07*qo IM6N<$f_KdB8~^|S literal 0 HcmV?d00001 diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php new file mode 100644 index 00000000000..51d32ebc45f --- /dev/null +++ b/htdocs/theme/eldy/info-box.inc.php @@ -0,0 +1,114 @@ + +/*