:mod livraison rename user acces right #14697

This commit is contained in:
Aurélien 2020-10-06 16:10:48 +02:00
parent c8cd55e158
commit f954e8b173
No known key found for this signature in database
GPG Key ID: 296611B615F8FDF3
10 changed files with 25 additions and 25 deletions

View File

@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate)
$numshipping = $object->nb_expedition(); $numshipping = $object->nb_expedition();
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->creer)) { if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
if ($user->rights->expedition->creer) { if ($user->rights->expedition->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id.'">'.$langs->trans('CreateShipment').'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id.'">'.$langs->trans('CreateShipment').'</a>';
} else { } else {

View File

@ -417,7 +417,7 @@ class FormFile
$titletoshow = $langs->trans("Documents"); $titletoshow = $langs->trans("Documents");
if (!empty($title)) $titletoshow = ($title == 'none' ? '' : $title); if (!empty($title)) $titletoshow = ($title == 'none' ? '' : $title);
print($modulepart);
// Show table // Show table
if ($genallowed) if ($genallowed)
{ {

View File

@ -59,7 +59,7 @@ function commande_prepare_head(Commande $object)
} }
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire)) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire))
{ {
$nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0;
$head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id;

View File

@ -43,7 +43,7 @@ function propal_prepare_head($object)
$h++; $h++;
if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire)
|| (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->livraison->lire)))) || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire))))
{ {
$langs->load("sendings"); $langs->load("sendings");
$text = ''; $text = '';

View File

@ -47,7 +47,7 @@ function shipping_prepare_head($object)
$head[$h][2] = 'shipping'; $head[$h][2] = 'shipping';
$h++; $h++;
if ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire) if ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire)
{ {
// delivery link // delivery link
$object->fetchObjectLinked($object->id, $object->element); $object->fetchObjectLinked($object->id, $object->element);

View File

@ -191,7 +191,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][1] = 'Read delivery receipts'; $this->rights[$r][1] = 'Read delivery receipts';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'delivery';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
$r++; $r++;
@ -199,7 +199,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][1] = 'Create/modify delivery receipts'; $this->rights[$r][1] = 'Create/modify delivery receipts';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'delivery';
$this->rights[$r][5] = 'creer'; $this->rights[$r][5] = 'creer';
$r++; $r++;
@ -207,7 +207,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][1] = 'Validate delivery receipts'; $this->rights[$r][1] = 'Validate delivery receipts';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison_advance'; $this->rights[$r][4] = 'delivery_advance';
$this->rights[$r][5] = 'validate'; $this->rights[$r][5] = 'validate';
$r++; $r++;
@ -215,7 +215,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][1] = 'Delete delivery receipts'; $this->rights[$r][1] = 'Delete delivery receipts';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'delivery';
$this->rights[$r][5] = 'supprimer'; $this->rights[$r][5] = 'supprimer';

View File

@ -141,7 +141,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
if ($object->element == 'order_supplier') $permok = $user->rights->fournisseur->commande->creer; if ($object->element == 'order_supplier') $permok = $user->rights->fournisseur->commande->creer;
if ($object->element == 'invoice_supplier') $permok = $user->rights->fournisseur->facture->creer; if ($object->element == 'invoice_supplier') $permok = $user->rights->fournisseur->facture->creer;
if ($object->element == 'shipping') $permok = $user->rights->expedition->creer; if ($object->element == 'shipping') $permok = $user->rights->expedition->creer;
if ($object->element == 'delivery') $permok = $user->rights->expedition->livraison->creer; if ($object->element == 'delivery') $permok = $user->rights->expedition->delivery->creer;
if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'productlot') $permok = $user->rights->stock->creer;
if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer;
if ($object->element == 'mo') $permok = $user->rights->mrp->write; if ($object->element == 'mo') $permok = $user->rights->mrp->write;

View File

@ -126,8 +126,8 @@ if ($action == 'add')
$action = 'create'; $action = 'create';
} }
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && } elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
) )
{ {
$result = $object->valid($user); $result = $object->valid($user);
@ -151,7 +151,7 @@ if ($action == 'add')
} }
} }
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->livraison->supprimer) if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->delivery->supprimer)
{ {
$db->begin(); $db->begin();
$result = $object->delete(); $result = $object->delete();
@ -167,7 +167,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio
} }
} }
if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer) if ($action == 'setdate_livraison' && $user->rights->expedition->delivery->creer)
{ {
$datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$result = $object->set_delivery_date($user, $datedelivery); $result = $object->set_delivery_date($user, $datedelivery);
@ -458,7 +458,7 @@ if ($action == 'create') // Create. Seems to no be used
print '<table width="100%" class="nobordernopadding"><tr><td>'; print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
print '<td><td class="right">'; print '<td><td class="right">';
if ($user->rights->expedition->livraison->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>'; if ($user->rights->expedition->delivery->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'; print '</td>';
@ -647,14 +647,14 @@ if ($action == 'create') // Create. Seems to no be used
if ($object->statut == 0 && $num_prod > 0) if ($object->statut == 0 && $num_prod > 0)
{ {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
} }
} }
if ($user->rights->expedition->livraison->supprimer) if ($user->rights->expedition->delivery->supprimer)
{ {
if ($conf->expedition_bon->enabled) if ($conf->expedition_bon->enabled)
{ {
@ -678,8 +678,8 @@ if ($action == 'create') // Create. Seems to no be used
$filedir = $conf->expedition->dir_output."/receipt/".$objectref; $filedir = $conf->expedition->dir_output."/receipt/".$objectref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->expedition->livraison->lire; $genallowed = $user->rights->expedition->delivery->lire;
$delallowed = $user->rights->expedition->livraison->creer; $delallowed = $user->rights->expedition->delivery->creer;
print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);

View File

@ -373,8 +373,8 @@ class Delivery extends CommonObject
$error = 0; $error = 0;
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
{ {
if (!empty($conf->global->DELIVERY_ADDON_NUMBER)) if (!empty($conf->global->DELIVERY_ADDON_NUMBER))
{ {

View File

@ -102,7 +102,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('expeditioncard', 'globalcard')); $hookmanager->initHooks(array('expeditioncard', 'globalcard'));
$permissiondellink = $user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php $permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php
//var_dump($object->lines[0]->detail_batch); //var_dump($object->lines[0]->detail_batch);
@ -399,7 +399,7 @@ if (empty($reshook))
/* /*
* Build a receiving receipt * Build a receiving receipt
*/ */
elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->livraison->creer) elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)
{ {
$result = $object->create_delivery($user); $result = $object->create_delivery($user);
if ($result > 0) if ($result > 0)
@ -2467,7 +2467,7 @@ if ($action == 'create')
// This is just to generate a delivery receipt // This is just to generate a delivery receipt
//var_dump($object->linkedObjectsIds['delivery']); //var_dump($object->linkedObjectsIds['delivery']);
if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery']))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
} }