From 6844d603ff898d46bed757b6a3a3e4557946ddfa Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:23:15 +0200 Subject: [PATCH 01/34] update code --- htdocs/comm/action/class/api_agendaevents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index e7745f1d5fd..8c13709b250 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -124,7 +124,7 @@ class AgendaEvents extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } - if (empty($conf->societe->enabled)) { + if (!isModEnabled('societe')) { $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists } From bc421ce1608aac9941ccf3e31110a9d085870d6a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:25:33 +0200 Subject: [PATCH 02/34] update code --- htdocs/don/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index c867418cfbb..bf9ba2e6388 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -460,7 +460,7 @@ if ($action == 'create') { print $form->selectyesno("public", $public_donation, 1); print "\n"; - if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!isModEnabled('societe') || empty($conf->global->DONATION_USE_THIRDPARTIES)) { print "".''.$langs->trans("Company").''; print "".''.$langs->trans("Lastname").''; print "".''.$langs->trans("Firstname").''; From 16646006603f3194ae0e1a3e9a0828db5aced354 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:26:32 +0200 Subject: [PATCH 03/34] update code --- htdocs/ecm/index_auto.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 4ffe606c79e..49bd25d0b90 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -314,7 +314,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { $rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if (isModEnabled("societe")) { - $rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); + $rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } if (isModEnabled("propal")) { $rowspan++; $sectionauto[] = array('position'=>30, 'level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); From 455c41cacb388a02dcfa8a3f736de4de68143eae Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:27:24 +0200 Subject: [PATCH 04/34] update code --- htdocs/ecm/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index d04983fff11..6bbca0026e1 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -117,7 +117,7 @@ if (isModEnabled("product") || isModEnabled("service")) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if (isModEnabled("societe")) { - $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } if (isModEnabled("propal")) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); From 0632855be6cf3f5518f4c58ffe01c4cc3100c876 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:29:11 +0200 Subject: [PATCH 05/34] update code --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c1e18d60309..7cfb66288e1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -199,7 +199,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; // Add non object fields to fields for list -$arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>21, 'enabled'=>(empty($conf->societe->enabled) ? 0 : 1)); +$arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>21, 'enabled'=>(!isModEnabled('societe') ? 0 : 1)); $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'checked'=>0, 'position'=>22); $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23); $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>-1, 'position'=>120); From f1e8ee671e464a51c14b09bbff11dceeba1e9ec3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 29 Aug 2022 09:29:56 +0200 Subject: [PATCH 06/34] update code --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index a7b78174cf1..f2357c96a16 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -550,7 +550,7 @@ class Thirdparties extends DolibarrApi { global $conf; - if (empty($conf->societe->enabled)) { + if (!isModEnabled('societe')) { throw new RestException(501, 'Module "Thirdparties" needed for this request'); } From a955f88bb6b89f50620a0aa174850175761fdf01 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 29 Aug 2022 11:22:27 +0200 Subject: [PATCH 07/34] Fix : categhory view permission --- htdocs/categories/viewcat.php | 1211 +++++++++++++++++---------------- 1 file changed, 629 insertions(+), 582 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5405b33d994..0e5da0735ce 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -487,753 +487,800 @@ $typeid = $type; // List of products or services (type is type of category) if ($type == Categorie::TYPE_PRODUCT) { - $permission = ($user->rights->produit->creer || $user->rights->service->creer); + if ($user->hasRight("product", "read")) { + $permission = ($user->rights->produit->creer || $user->rights->service->creer); + + $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($prods < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddProductServiceIntoCategory").'  '; + $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); + print '
'; + print '
'; + } - $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($prods < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddProductServiceIntoCategory").'  '; - $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); - print ''."\n"; - print ''."\n"; + print '
'.$langs->trans("Ref").'
'."\n"; + print ''."\n"; - if (count($prods) > 0) { - $i = 0; - foreach ($prods as $prod) { - $i++; - if ($i > $limit) { - break; + if (count($prods) > 0) { + $i = 0; + foreach ($prods as $prod) { + $i++; + if ($i > $limit) { + break; + } + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $prod->getNomUrl(1); + print "'.$prod->label."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $prod->getNomUrl(1); - print "'.$prod->label."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of customers if ($type == Categorie::TYPE_CUSTOMER) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("societe", "read")) { + $permission = $user->rights->societe->creer; + + $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($socs < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddCustomerIntoCategory").'  '; + print $form->select_company('', 'elemid', 's.client IN (1,3)'); + print '
'; + print '
'; + } - $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($socs < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddCustomerIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.client IN (1,3)'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); + print ''."\n"; + print ''."\n"; - print '
'.$langs->trans("Name").'
'."\n"; - print ''."\n"; + if (count($socs) > 0) { + $i = 0; + foreach ($socs as $key => $soc) { + $i++; + if ($i > $limit) { + break; + } - if (count($socs) > 0) { - $i = 0; - foreach ($socs as $key => $soc) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name").'
'; + print $soc->getNomUrl(1); + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $soc->getNomUrl(1); - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of suppliers if ($type == Categorie::TYPE_SUPPLIER) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("fournisseur", "read")) { + $permission = $user->rights->societe->creer; + + $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($socs < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddSupplierIntoCategory").'  '; + print $form->select_company('', 'elemid', 's.fournisseur = 1'); + print '
'; + print '
'; + } - $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($socs < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddSupplierIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.fournisseur = 1'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); + print ''."\n"; + print '\n"; - print '
'.$langs->trans("Name")."
'."\n"; - print '\n"; + if (count($socs) > 0) { + $i = 0; + foreach ($socs as $soc) { + $i++; + if ($i > $limit) { + break; + } - if (count($socs) > 0) { - $i = 0; - foreach ($socs as $soc) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name")."
'; + print $soc->getNomUrl(1); + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $soc->getNomUrl(1); - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of members if ($type == Categorie::TYPE_MEMBER) { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + if ($user->hasRight("adherent", "read")) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $permission = $user->rights->adherent->creer; + $permission = $user->rights->adherent->creer; + + $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($prods < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AssignCategoryTo").'  '; + print $form->selectMembers('', 'elemid'); + print '
'; + print '
'; + } - $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($prods < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AssignCategoryTo").'  '; - print $form->selectMembers('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer); + print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer); - print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Name").'
\n"; - print ''."\n"; + if (count($prods) > 0) { + $i = 0; + foreach ($prods as $key => $member) { + $i++; + if ($i > $limit) { + break; + } - if (count($prods) > 0) { - $i = 0; - foreach ($prods as $key => $member) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name").'
'; + $member->ref = $member->login; + print $member->getNomUrl(1, 0); + print "'.$member->lastname."'.$member->firstname."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - $member->ref = $member->login; - print $member->getNomUrl(1, 0); - print "'.$member->lastname."'.$member->firstname."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of contacts if ($type == Categorie::TYPE_CONTACT) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("societe", "read")) { + $permission = $user->rights->societe->creer; - $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if (is_numeric($contacts) && $contacts < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; + $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); + if (is_numeric($contacts) && $contacts < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AssignCategoryTo").'  '; + print $form->selectContacts('', '', 'elemid'); + print '
'; + print '
'; + } print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AssignCategoryTo").'  '; - print $form->selectContacts('', '', 'elemid'); - print '
'; - print '
'; - } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; - $num = count($contacts); - $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - $objsoc = new Societe($db); - print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit); + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($contacts); + $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + $objsoc = new Societe($db); + print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit); - print ''."\n"; - print ''."\n"; + print '
'.$langs->trans("Ref").'
'."\n"; + print ''."\n"; - if (is_array($contacts) && count($contacts) > 0) { - $i = 0; - foreach ($contacts as $key => $contact) { - $i++; - if ($i > $limit) { - break; + if (is_array($contacts) && count($contacts) > 0) { + $i = 0; + foreach ($contacts as $key => $contact) { + $i++; + if ($i > $limit) { + break; + } + + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $contact->getNomUrl(1, 'category'); + if ($contact->socid > 0) { + $objsoc->fetch($contact->socid); + print ' - '; + print $objsoc->getNomUrl(1, 'contact'); + } + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $contact->getNomUrl(1, 'category'); - if ($contact->socid > 0) { - $objsoc->fetch($contact->socid); - print ' - '; - print $objsoc->getNomUrl(1, 'contact'); - } - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of bank accounts if ($type == Categorie::TYPE_ACCOUNT) { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + if ($user->hasRight("banque", "read")) { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $permission = $user->rights->banque->creer; + $permission = $user->rights->banque->creer; + + $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($accounts < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddAccountIntoCategory").'  '; + $form->select_comptes('', 'elemid'); + print '
'; + print '
'; + } - $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($accounts < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddAccountIntoCategory").'  '; - $form->select_comptes('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = ''; - print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Ref").'
\n"; - print ''."\n"; + if (count($accounts) > 0) { + $i = 0; + foreach ($accounts as $key => $account) { + $i++; + if ($i > $limit) { + break; + } - if (count($accounts) > 0) { - $i = 0; - foreach ($accounts as $key => $account) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $account->getNomUrl(1, 0); + print "'.$account->bank."'.$account->number."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - print $account->getNomUrl(1, 0); - print "'.$account->bank."'.$account->number."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of Project if ($type == Categorie::TYPE_PROJECT) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + if ($user->hasRight("project", "read")) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $permission = $user->rights->projet->creer; + $permission = $user->rights->projet->creer; + + $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($objects < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddProjectIntoCategory").'  '; + $form->selectProjects('', 'elemid'); + print '
'; + print '
'; + } - $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($objects < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; - $form->selectProjects('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit); - print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Ref").'
\n"; - print ''."\n"; + if (count($objects) > 0) { + $i = 0; + foreach ($objects as $key => $project) { + $i++; + if ($i > $limit) { + break; + } - if (count($objects) > 0) { - $i = 0; - foreach ($objects as $key => $project) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $project->getNomUrl(1); + print "'.$project->ref."'.$project->title."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - print $project->getNomUrl(1); - print "'.$project->ref."'.$project->title."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of users -if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) { - require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +if ($type == Categorie::TYPE_USER) { + if ($user->hasRight("user", "user", "read")) { + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $users = $object->getObjectsInCateg($type); - if ($users < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; + $users = $object->getObjectsInCateg($type); + if ($users < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddObjectIntoCategory").'  '; + print $form->select_dolusers('', 'elemid'); + print '
'; + print '
'; + } print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddObjectIntoCategory").'  '; - print $form->select_dolusers('', 'elemid'); - print '
'; - print '
'; - } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; - print '
'; + print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; - $num = count($users); + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($users); - print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit); + print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit); - print "\n"; - print ''."\n"; + print "
'.$langs->trans("Users").' '.$num.'
\n"; + print ''."\n"; - if (count($users) > 0) { - // Use "$userentry" here, because "$user" is the current user - foreach ($users as $key => $userentry) { - print "\t".''."\n"; - print '\n"; - print '\n"; + if (count($users) > 0) { + // Use "$userentry" here, because "$user" is the current user + foreach ($users as $key => $userentry) { + print "\t".''."\n"; + print '\n"; + print '\n"; - // Link to delete from category - print '\n"; } - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Users").' '.$num.'
'; - print $userentry->getNomUrl(1); - print "'.$userentry->job."
'; + print $userentry->getNomUrl(1); + print "'.$userentry->job."'; - if ($user->rights->user->user->creer) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; + // Link to delete from category + print ''; + if ($user->rights->user->user->creer) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } -} else { - print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } // List of warehouses if ($type == Categorie::TYPE_WAREHOUSE) { - $permission = $user->rights->stock->creer; + if ($user->hasRight("warehouse", "read")) { + $permission = $user->rights->stock->creer; - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($objects < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - - print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit); - - print "\n"; - print ''."\n"; - - if (count($objects) > 0) { - $i = 0; - foreach ($objects as $key => $project) { - $i++; - if ($i > $limit) { - break; - } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; - } + $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($objects < 0) { + dol_print_error($db, $object->error, $object->errors); } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; - print $project->getNomUrl(1); - print "'.$project->ref."'.$project->title."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; - - print '
'."\n"; - } -} - -// List of tickets -if ($type == Categorie::TYPE_TICKET) { - $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer); - - $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($tickets < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddTicketIntoCategory").'  '; - $form->selectTickets('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = ''; - print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); + print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print '
'.$langs->trans("Ref").'
'."\n"; - print ''."\n"; + if (count($objects) > 0) { + $i = 0; + foreach ($objects as $key => $project) { + $i++; + if ($i > $limit) { + break; + } - if (count($tickets) > 0) { - $i = 0; - foreach ($tickets as $ticket) { - $i++; - if ($i > $limit) break; - - print "\t".''."\n"; - print '\n"; - print '\n"; - // Link to delete from category - print ''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; - print $ticket->getNomUrl(1); - print "'.$ticket->label."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; + print "\t".'
'; + print $project->getNomUrl(1); + print "'.$project->ref."'.$project->title."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + } +} + +// List of tickets +if ($type == Categorie::TYPE_TICKET) { + if ($user->hasRight("ticket", "read")) { + $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer); + + $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($tickets < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddTicketIntoCategory").'  '; + $form->selectTickets('', 'elemid'); + print '
'; + print '
'; + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); + + + print ''."\n"; + print ''."\n"; + + if (count($tickets) > 0) { + $i = 0; + foreach ($tickets as $ticket) { + $i++; + if ($i > $limit) break; + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; + } + } else { + print ''; + } + print "
'.$langs->trans("Ref").'
'; + print $ticket->getNomUrl(1); + print "'.$ticket->label."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + + print '
'."\n"; + } + } else { + print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } From aca6609f2111871837da77f865bd31e479cb58c6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 29 Aug 2022 11:36:19 +0200 Subject: [PATCH 08/34] Close Remove trigger ORDER_SUPPLIER_DISPATCH #18486 --- ChangeLog | 1 + .../interface_99_modZapier_ZapierTriggers.class.php | 2 +- htdocs/fourn/commande/dispatch.php | 13 ------------- ...erface_99_modMyModule_MyModuleTriggers.class.php | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e99731fe548..cfcbac83dac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product +* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. ***** ChangeLog for 16.0.0 compared to 15.0.0 ***** diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index d706488129e..b131dd0391f 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -236,7 +236,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'ORDER_SUPPLIER_REFUSE': // case 'ORDER_SUPPLIER_CANCEL': // case 'ORDER_SUPPLIER_SENTBYMAIL': - // case 'ORDER_SUPPLIER_DISPATCH': + // case 'ORDER_SUPPLIER_RECEIVE': // case 'LINEORDER_SUPPLIER_DISPATCH': // case 'LINEORDER_SUPPLIER_CREATE': // case 'LINEORDER_SUPPLIER_UPDATE': diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5dd20832088..2f0f7966679 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -373,19 +373,6 @@ if ($action == 'dispatch' && $permissiontoreceive) { } } - if (!$error) { - global $conf, $langs, $user; - // Call trigger - - $result = $object->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); - // End call triggers - - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - } - if ($result >= 0 && !$error) { $db->commit(); diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 3c6196cee2f..2c76818ab84 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -177,7 +177,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_REFUSE': //case 'ORDER_SUPPLIER_CANCEL': //case 'ORDER_SUPPLIER_SENTBYMAIL': - //case 'ORDER_SUPPLIER_DISPATCH': + //case 'ORDER_SUPPLIER_RECEIVE': //case 'LINEORDER_SUPPLIER_DISPATCH': //case 'LINEORDER_SUPPLIER_CREATE': //case 'LINEORDER_SUPPLIER_UPDATE': From 525b662b2411872b7ba1f4a1f7dc693b89958368 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:35:23 +0200 Subject: [PATCH 09/34] Update websiteaccount_card.php --- htdocs/website/websiteaccount_card.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 249398c322e..261839940e5 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/website/lib/websiteaccount.lib.php'; $langs->loadLangs(array("website", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -43,7 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $object = new SocieteAccount($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -68,9 +68,10 @@ if (empty($action) && empty($id) && empty($ref)) { //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); -$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +// Permissions +$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. From b81ae9008804abe786c7c0388070fbdafe771c81 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:40:32 +0200 Subject: [PATCH 10/34] Update index.php --- htdocs/website/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0f9595f6206..0b599ba640b 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -30,6 +30,7 @@ if (!defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); //header('X-XSS-Protection:0'); // Disable XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -45,8 +46,10 @@ require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +// Load translation files required by the page $langs->loadLangs(array("admin", "other", "website", "errors")); +// Security check if (!$user->rights->website->read) { accessforbidden(); } From 5de5c5c11ad10e64530d0add2db1440d3745dfd4 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:51:52 +0200 Subject: [PATCH 11/34] Update agenda.php --- htdocs/ticket/agenda.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 2f919aa436d..17cb8ad785e 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -21,11 +21,12 @@ * \brief Page with events on ticket */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -40,12 +41,12 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; if (!$sortfield) { $sortfield = "a.datep,a.id"; } @@ -64,6 +65,7 @@ if (GETPOST('actioncode', 'array')) { } else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } + $search_agenda_label = GETPOST('search_agenda_label'); $object = new Ticket($db); From ad42d6b796a2e9043cddd4645221e1c696d809f6 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:03:39 +0200 Subject: [PATCH 12/34] Update card.php --- htdocs/societe/card.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5d557d30a02..06fdbfba0a5 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -34,6 +34,8 @@ * \brief Third party card page */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -62,7 +64,10 @@ if (! empty($conf->eventorganization->enabled)) { } +// Load translation files required by the page + $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); + if (!empty($conf->adherent->enabled)) { $langs->load("members"); } @@ -81,13 +86,15 @@ if (!empty($conf->accounting->enabled)) { $error = 0; $errors = array(); + +// Get parameters $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); if ($user->socid) { @@ -96,6 +103,7 @@ if ($user->socid) { if (empty($socid) && $action == 'view') { $action = 'create'; } + $id = $socid; $object = new Societe($db); @@ -128,12 +136,13 @@ if (!empty($canvas)) { $objcanvas->getCanvas('thirdparty', 'card', $canvas); } -$permissiontoread = $user->rights->societe->lire; -$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +// Permissions +$permissiontoread = $user->rights->societe->lire; +$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0); -$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php -$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; +$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php +$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); From e586f8f3914eba42ecdf9079e18f6dd344709fd8 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:06:28 +0200 Subject: [PATCH 13/34] Update consumption.php --- htdocs/societe/consumption.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 03c78a0c07b..53408fd00ff 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -26,12 +26,18 @@ * \brief Add a tab on thirdparty view to list all products/services bought or sells by thirdparty */ +// Load Dolibarr environment require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); + + $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist'; // Security check @@ -46,11 +52,11 @@ if ($socid > 0) { } // Sort & Order fields -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); if (empty($page) || $page == -1) { $page = 0; @@ -78,12 +84,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $year = ''; $month = ''; } + // Customer or supplier selected in drop box $thirdTypeSelect = GETPOST("third_select_id", 'az09'); $type_element = GETPOST('type_element') ? GETPOST('type_element') : ''; -// Load translation files required by the page -$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('consumptionthirdparty', 'globalcard')); From 6ba8ac8475c0159e57d937f86e36e2c3039f612b Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:09:44 +0200 Subject: [PATCH 14/34] Update contact.php --- htdocs/societe/contact.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 4ecfc2a8cf4..1bc64658735 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -31,6 +31,7 @@ * \brief Page of contacts of thirdparties */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -46,7 +47,9 @@ if (!empty($conf->adherent->enabled)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); } @@ -59,18 +62,23 @@ if (!empty($conf->notification->enabled)) { $mesg = ''; $error = 0; $errors = array(); + +// Get parameters $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); -$cancel = GETPOST('cancel', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$confirm = GETPOST('confirm'); -$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +$confirm = GETPOST('confirm'); +$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); + if ($user->socid) { $socid = $user->socid; } + if (empty($socid) && $action == 'view') { $action = 'create'; } +// Initialize objects $object = new Societe($db); $extrafields = new ExtraFields($db); From ffe1a7f8acd65193a776a8f5612efd3860253e9e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:12:47 +0200 Subject: [PATCH 15/34] Update document.php --- htdocs/societe/document.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 707c573f116..92c7efb63d9 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -26,30 +26,36 @@ * \ingroup societe */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "other")); -$action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm'); -$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); -$ref = GETPOST('ref', 'alpha'); // Get parameters -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm'); +$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); +$ref = GETPOST('ref', 'alpha'); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; + +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; @@ -65,6 +71,7 @@ if (!$sortfield) { $sortfield = "position_name"; } +// Initialize objects $object = new Societe($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); From 98b8d8db6b6c87efe11743767d4b58eecbde756a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:15:50 +0200 Subject: [PATCH 16/34] Update index.php --- htdocs/societe/index.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a13d8a3de99..7ea3f591cb6 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -27,16 +27,21 @@ * \brief Home page for third parties area */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -$hookmanager = new HookManager($db); + +// Load translation files required by the page +$langs->load("companies"); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager = new HookManager($db); $hookmanager->initHooks(array('thirdpartiesindex')); -$langs->load("companies"); + $socid = GETPOST('socid', 'int'); if ($user->socid) { @@ -51,6 +56,7 @@ $thirdparty_static = new Societe($db); if (!isset($form) || !is_object($form)) { $form = new Form($db); } + // Load $resultboxes $resultboxes = FormOther::getBoxesArea($user, "3"); From 997c9e763a1e587b4cfbfe654f78ffcc256408a2 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:18:55 +0200 Subject: [PATCH 17/34] Update list.php --- htdocs/societe/list.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bf3ec6eb041..c8f0045d619 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -34,6 +34,8 @@ * \brief Page to show list of third parties */ + +// Load Dolibarr environment require_once '../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -42,20 +44,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); -$action = GETPOST('action', 'aZ09'); + +// Get parameters +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist'; -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); + if ($contextpage == 'poslist') { $optioncss = 'print'; } + $mode = GETPOST("mode", 'alpha'); +// search fields $search_all = trim(GETPOST('search_all', 'alphanohtml') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars @@ -98,6 +107,7 @@ $search_stcomm = GETPOST('search_stcomm', 'int'); $search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_parent_name = trim(GETPOST('search_parent_name', 'alpha')); + $type = GETPOST('type', 'alpha'); $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant From 1b90446cc5d4c3d1150a754b3c75d37fc04da204 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:22:10 +0200 Subject: [PATCH 18/34] Update note.php --- htdocs/societe/note.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index b932fb11595..dabc5d7e39e 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -26,20 +26,28 @@ * \ingroup societe */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -$action = GETPOST('action', 'aZ09'); +// Load translation files required by the page $langs->load("companies"); -$id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); +// Get parameters +$id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); +$action = GETPOST('action', 'aZ09'); + + +// Initialize objects $object = new Societe($db); if ($id > 0) { $object->fetch($id); } +// Permissions $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -50,6 +58,7 @@ if ($user->socid > 0) { unset($action); $socid = $user->socid; } + $result = restrictedArea($user, 'societe', $object->id, '&societe'); From 9cba037ea3adb90adc9a5db33fa45788598a863f Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:24:16 +0200 Subject: [PATCH 19/34] Update paymentmodes.php --- htdocs/societe/paymentmodes.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 2c2c125530b..5b9bd1046ef 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -29,6 +29,8 @@ * \brief Tab of payment modes for the customer */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; @@ -40,8 +42,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "banks", "bills", 'paypal', 'stripe', 'withdrawals')); + // Security check $socid = GETPOST("socid", "int"); if ($user->socid) { @@ -49,12 +54,15 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', '', ''); + +// Get parameters $id = GETPOST("id", "int"); $source = GETPOST("source", "alpha"); // source can be a source or a paymentmode $ribid = GETPOST("ribid", "int"); $action = GETPOST("action", 'alpha', 3); $cancel = GETPOST('cancel', 'alpha'); +// Initialize objects $object = new Societe($db); $object->fetch($socid); @@ -70,6 +78,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('thirdpartybancard', 'globalcard')); +// Permissions $permissiontoread = $user->rights->societe->lire; $permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php From a3918e8d96318ad123336a983bb30dfc549b13ee Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:26:32 +0200 Subject: [PATCH 20/34] Update price.php --- htdocs/societe/price.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 314fb663631..a9f17f4b50a 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -26,6 +26,8 @@ * \brief Page to show product prices by customer */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -38,13 +40,17 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $prodcustprice = new Productcustomerprice($db); } + +// Load translation files required by the page $langs->loadLangs(array("products", "companies", "bills")); -$action = GETPOST('action', 'aZ09'); -$search_prod = GETPOST('search_prod', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$search_label = GETPOST('search_label', 'alpha'); -$search_price = GETPOST('search_price'); + +// Get parameters +$action = GETPOST('action', 'aZ09'); +$search_prod = GETPOST('search_prod', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$search_label = GETPOST('search_label', 'alpha'); +$search_price = GETPOST('search_price'); $search_price_ttc = GETPOST('search_price_ttc'); // Security check @@ -54,6 +60,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', $socid, '&societe'); +// Initialize objects $object = new Societe($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context From c8aefcb7c509758fa94ab8b7659e58f19097845a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:28:08 +0200 Subject: [PATCH 21/34] Update project.php --- htdocs/societe/project.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index ef68a03ab78..f704273db60 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -28,11 +28,14 @@ * \brief Page of third party projects */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->loadLangs(array("companies", "projects")); +// Load translation files required by the page +$langs->loadLangs(array('companies', 'projects')); // Security check $socid = GETPOST('socid', 'int'); From 7dd0535a5c5c7416df528a1903ca4f059436b7d0 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:30:50 +0200 Subject: [PATCH 22/34] Update societecontact.php --- htdocs/societe/societecontact.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index b1e5174820c..a061933ba11 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -26,14 +26,18 @@ * \brief Onglet de gestion des contacts additionnel d'une société */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -$langs->loadLangs(array("orders", "companies")); +// Load translation files required by the page +$langs->loadLangs(array('companies', 'orders')); +// Get parameters $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -62,6 +66,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', $id, ''); + +// Initialize objects $object = new Societe($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context From 43601b09f325bf5d076423b4a1ee16c426b451c6 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:33:03 +0200 Subject: [PATCH 23/34] Update website.php --- htdocs/societe/website.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 2d346282c4c..424d18c2058 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -28,6 +28,8 @@ * \brief Page of web sites accounts */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -35,13 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "website")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... -$show_files = GETPOST('show_files', 'int'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +// Get parameters +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$show_files = GETPOST('show_files', 'int'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Security check $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); From 7657bc35d7a21e262321d00944689f5130c827f8 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:43:06 +0200 Subject: [PATCH 24/34] Update list.php --- htdocs/product/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ebcfed98c80..38c3c0c80ea 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -33,6 +33,8 @@ * \brief Page to list products and services */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -51,12 +53,15 @@ if (!empty($conf->productbatch->enabled)) { $langs->load("productbatch"); } + +// Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +// Search Criterias $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_id = GETPOST("search_id", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); From 5b8f7cf00c8e2d2b2bbe15ac939691680d2ca5c6 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:45:11 +0200 Subject: [PATCH 25/34] Update card.php --- htdocs/product/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 761fe2a148f..5f0159ce567 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -41,6 +41,8 @@ * \brief Page to show product */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -88,6 +90,7 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; +// Get parameters $id = GETPOST('id', 'int'); $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null); $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); @@ -107,6 +110,7 @@ $accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); $checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha'); + // by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml'; From eb83c818acce16e747dfb513a38306fcc24745f1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:47:35 +0200 Subject: [PATCH 26/34] Update index.php --- htdocs/product/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f2b29926b21..e976e176224 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -28,6 +28,8 @@ * \brief Homepage products and services */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -47,6 +49,7 @@ $langs->loadLangs(array('products', 'stocks')); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks $hookmanager->initHooks(array('productindex')); +// Initialize objects $product_static = new Product($db); // Security check From c9826f975cf241eff7de98aa06e0b05da0f4e19c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:49:48 +0200 Subject: [PATCH 27/34] Update document.php --- htdocs/product/document.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/product/document.php b/htdocs/product/document.php index d83a684a308..2aaa2356879 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -28,6 +28,8 @@ * \brief Page des documents joints sur les produits */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -38,9 +40,12 @@ if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php'; } + // Load translation files required by the page $langs->loadLangs(array('other', 'products')); + +// Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -74,7 +79,7 @@ if (!$sortfield) { $sortfield = "position_name"; } - +// Initialize objects $object = new Product($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); @@ -93,6 +98,7 @@ if ($id > 0 || !empty($ref)) { } } } + $modulepart = 'produit'; From 2b59e9261b219036cc96f3237780f7bb6d5d49fa Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:58:51 +0200 Subject: [PATCH 28/34] Update index.php --- htdocs/commande/index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 03644fe5690..57f61f3d9f7 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -25,6 +25,8 @@ * \brief Home page of customer order module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; @@ -32,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('orders', 'bills')); + + if (!$user->rights->commande->lire) { accessforbidden(); } @@ -41,8 +48,6 @@ $hookmanager = new HookManager($db); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('ordersindex')); -// Load translation files required by the page -$langs->loadLangs(array('orders', 'bills')); // Security check $socid = GETPOST('socid', 'int'); From 2f9bb23a120c980d1b1bf7da866b868c62d24b9d Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:00:39 +0200 Subject: [PATCH 29/34] Update index.php --- htdocs/accountancy/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 911197994c1..2745ab4784a 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -23,6 +23,8 @@ * \brief Home accounting module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; From 7e57ba7658d6282675692dccb4c7bf5cb35612d6 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:02:52 +0200 Subject: [PATCH 30/34] Update index.php --- htdocs/adherents/index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 1ef98dddb6d..388d51be376 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -27,19 +27,24 @@ * \brief Home page of membership module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "members")); + + $hookmanager = new HookManager($db); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('membersindex')); -// Load translation files required by the page -$langs->loadLangs(array("companies", "members")); // Security check $result = restrictedArea($user, 'adherent'); From 88dbf3aaff9ae0d28fc4855d7e1eb2f003185b9c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:05:31 +0200 Subject: [PATCH 31/34] Update card.php --- htdocs/adherents/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 63527452fe1..6816023f8de 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -29,6 +29,8 @@ * \brief Page of a member */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -44,9 +46,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); From bcce09d7071cfa15cb48f7852f9c655a33cdde9a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:07:55 +0200 Subject: [PATCH 32/34] Update list.php --- htdocs/adherents/list.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index f9208daf70d..2c2efdd00a6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -27,14 +27,20 @@ * \brief Page to list all members of foundation */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// Load translation files required by the page $langs->loadLangs(array("members", "companies")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -42,6 +48,8 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search + +// Search fields $search = GETPOST("search", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha'); From 9dc61d32433dc5a5dbff22d50abe6a8cebc9cf7a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 19:10:12 +0200 Subject: [PATCH 33/34] Update note.php --- htdocs/adherents/note.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 2d98dfe5fbc..0d05bb85523 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -23,25 +23,34 @@ * \brief Tab for note of a member */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "members", "bills")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alphanohtml'); + +// Initialize objects $object = new Adherent($db); + $result = $object->fetch($id); if ($result > 0) { $adht = new AdherentType($db); $result = $adht->fetch($object->typeid); } + $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php // Fetch object From 35dbee5bbfaff7c7d5896da70d476eeea1c98818 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Aug 2022 19:56:57 +0200 Subject: [PATCH 34/34] NEW On a form to send an email, we show all emails of contacts of object --- htdocs/core/tpl/card_presend.tpl.php | 44 ++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 5fbb227bc69..596feae69d1 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -156,7 +156,7 @@ if ($action == 'presend') { $formmail->inreplyto = empty($inreplyto) ? '' : $inreplyto; $formmail->withfrom = 1; - // Fill list of recipient with email inside <>. + // Define $liste, a list of recipients with email inside <>. $liste = array(); if ($object->element == 'expensereport') { $fuser = new User($db); @@ -202,16 +202,6 @@ if ($action == 'presend') { } } - $formmail->withto = $liste; - $formmail->withtofree = (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1'); - $formmail->withtocc = $liste; - $formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC'); - $formmail->withtopic = $topicmail; - $formmail->withfile = 2; - $formmail->withbody = 1; - $formmail->withdeliveryreceipt = 1; - $formmail->withcancel = 1; - //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); if (!isset($arrayoffamiliestoexclude)) { $arrayoffamiliestoexclude = null; @@ -219,6 +209,7 @@ if ($action == 'presend') { // Make substitution in email content if ($object) { + // First we set ->substit (useless, it will be erased later) and ->substit_lines $formmail->setSubstitFromObject($object, $langs); } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); @@ -237,7 +228,7 @@ if ($action == 'presend') { ); complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters); - // Find the good contact address + // Find all external contact addresses $tmpobject = $object; if (($object->element == 'shipping' || $object->element == 'reception')) { $origin = $object->origin; @@ -289,17 +280,46 @@ if ($action == 'presend') { if (is_array($contactarr) && count($contactarr) > 0) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $contactstatic = new Contact($db); + $tmpcompany = new Societe($db); foreach ($contactarr as $contact) { $contactstatic->fetch($contact['id']); + // Complete substitution array $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($outputlangs, 1); $substitutionarray['__CONTACT_LASTNAME_'.$contact['code'].'__'] = $contactstatic->lastname; $substitutionarray['__CONTACT_FIRSTNAME_'.$contact['code'].'__'] = $contactstatic->firstname; $substitutionarray['__CONTACT_TITLE_'.$contact['code'].'__'] = $contactstatic->getCivilityLabel(); + + // Complete $liste with the $contact + if (empty($liste[$contact['id']])) { // If this contact id not already into the $liste + $contacttoshow = ''; + if (isset($object->thirdparty) && is_object($object->thirdparty)) { + if ($contactstatic->fk_soc != $object->thirdparty->id) { + $tmpcompany->fetch($contactstatic->fk_soc); + if ($tmpcompany->id > 0) { + $contacttoshow .= $tmpcompany->name.': '; + } + } + } + $contacttoshow .= $contactstatic->getFullName($outputlangs, 1); + $contacttoshow .= " <".($contactstatic->email ? $contactstatic->email : $langs->transnoentitiesnoconv("NoEMail")) .">"; + $liste[$contact['id']] = $contacttoshow; + } } } + $formmail->withto = $liste; + $formmail->withtofree = (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1'); + $formmail->withtocc = $liste; + $formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC'); + $formmail->withtopic = $topicmail; + $formmail->withfile = 2; + $formmail->withbody = 1; + $formmail->withdeliveryreceipt = 1; + $formmail->withcancel = 1; + // Array of substitutions $formmail->substit = $substitutionarray;