Update card.php

This commit is contained in:
UT from dolibit 2022-08-29 18:03:39 +02:00 committed by GitHub
parent 49f869352c
commit ad42d6b796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,8 @@
* \brief Third party card page * \brief Third party card page
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.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/images.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")); $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users"));
if (!empty($conf->adherent->enabled)) { if (!empty($conf->adherent->enabled)) {
$langs->load("members"); $langs->load("members");
} }
@ -81,6 +86,8 @@ if (!empty($conf->accounting->enabled)) {
$error = 0; $errors = array(); $error = 0; $errors = array();
// Get parameters
$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
@ -96,6 +103,7 @@ if ($user->socid) {
if (empty($socid) && $action == 'view') { if (empty($socid) && $action == 'view') {
$action = 'create'; $action = 'create';
} }
$id = $socid; $id = $socid;
$object = new Societe($db); $object = new Societe($db);
@ -128,6 +136,7 @@ if (!empty($canvas)) {
$objcanvas->getCanvas('thirdparty', 'card', $canvas); $objcanvas->getCanvas('thirdparty', 'card', $canvas);
} }
// Permissions
$permissiontoread = $user->rights->societe->lire; $permissiontoread = $user->rights->societe->lire;
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $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); $permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0);