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/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';
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');
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');
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');
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
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 '
';
+ }
- $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 ''."\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 '';
+ }
- $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 ''."\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 '';
+ }
- $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 ''."\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 '';
+ }
- $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 ''."\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 ''."\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 '';
+ }
- $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 ''."\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 '';
+ }
- $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 ''."\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 ''."\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 ''."\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 ''."\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 ''."\n";
+ }
+ } else {
+ print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket');
+ accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
}
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
}
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');
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/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").' | |
';
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")));
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")));
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':
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';
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';
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
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');
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);
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);
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');
}
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'));
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);
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);
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");
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
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');
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
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
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');
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
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');
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);
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();
}
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.