Clean code for validate permissions. "validate" is a status to say, "now
it exists, it is no more a draft", so by default we don't need this permissions (it is same than create). We keep "validate" permissions as an "advanced" permission only.
This commit is contained in:
parent
e94d11ecf9
commit
b61c475aa8
@ -103,7 +103,8 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
$user->rights->propale->valider=1;
|
||||
$user->rights->propal->creer=1;
|
||||
$user->rights->propal->propal_advance->validate=1;
|
||||
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
|
||||
|
||||
@ -100,6 +100,7 @@ $hookmanager->initHooks(array('propalcard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -172,7 +173,10 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Validation
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propal->valider)
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
if ($result >= 0)
|
||||
@ -2082,19 +2086,21 @@ if ($action == 'create')
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook)) {
|
||||
if ($action != 'statut' && $action != 'editline') {
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action != 'statut' && $action != 'editline')
|
||||
{
|
||||
// Validate
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && $user->rights->propal->valider) {
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
) {
|
||||
if (count($object->lines) > 0)
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
// else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
// Create event
|
||||
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a
|
||||
// "workflow" action so should appears somewhere
|
||||
// else on
|
||||
// page.
|
||||
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
|
||||
{
|
||||
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
|
||||
}
|
||||
|
||||
@ -1334,7 +1334,8 @@ class Propal extends CommonObject
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
if ($user->rights->propale->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -1443,7 +1444,7 @@ class Propal extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
@ -1472,7 +1473,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_echeance($user, $date_fin_validite)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null');
|
||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||
@ -1498,7 +1499,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_date_livraison($user, $date_livraison)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||
$sql.= " SET date_livraison = ".($date_livraison!=''?"'".$this->db->idate($date_livraison)."'":'null');
|
||||
@ -1527,7 +1528,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_availability($user, $id)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||
$sql.= " SET fk_availability = '".$id."'";
|
||||
@ -1556,7 +1557,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_demand_reason($user, $id)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
|
||||
$sql.= " SET fk_input_reason = '".$id."'";
|
||||
@ -1585,7 +1586,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function set_ref_client($user, $ref_client)
|
||||
{
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
dol_syslog('Propale::set_ref_client this->id='.$this->id.', ref_client='.$ref_client);
|
||||
|
||||
@ -1620,7 +1621,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$remise=trim($remise)?trim($remise):0;
|
||||
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$remise = price2num($remise);
|
||||
|
||||
@ -1653,7 +1654,7 @@ class Propal extends CommonObject
|
||||
{
|
||||
$remise=trim($remise)?trim($remise):0;
|
||||
|
||||
if ($user->rights->propale->creer)
|
||||
if (! empty($user->rights->propal->creer))
|
||||
{
|
||||
$remise = price2num($remise);
|
||||
|
||||
|
||||
@ -883,7 +883,11 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$qualified_for_stock_change=0;
|
||||
@ -987,7 +991,11 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
|
||||
else if ($action == 'confirm_cancel' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$qualified_for_stock_change=0;
|
||||
@ -2121,7 +2129,11 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
// modified by hook
|
||||
if (empty($reshook)) {
|
||||
// Valid
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider) {
|
||||
if ($object->statut == 0 && $object->total_ttc >= 0 && $numlines > 0 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
// Edit
|
||||
|
||||
@ -205,7 +205,8 @@ class Commande extends CommonOrder
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $user->rights->commande->valider)
|
||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
@ -361,7 +362,8 @@ class Commande extends CommonOrder
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $user->rights->commande->valider)
|
||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
@ -494,7 +496,8 @@ class Commande extends CommonOrder
|
||||
|
||||
$error=0;
|
||||
|
||||
if ($user->rights->commande->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -363,7 +363,10 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Classify to validated
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -436,7 +439,10 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Go back to draft status (unvalidate)
|
||||
else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
|
||||
else if ($action == 'confirm_modif' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -2097,7 +2103,7 @@ if ($action == 'create')
|
||||
print $desc;
|
||||
print '</td></tr>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
// Replacement
|
||||
print '<tr height="18"><td valign="middle">';
|
||||
print '<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked="checked"' : '');
|
||||
@ -3233,7 +3239,7 @@ if ($action == 'create')
|
||||
// Situations
|
||||
if (! empty($conf->global->INVOICE_US_SITUATION))
|
||||
{
|
||||
if ($object->type == 5 && ($object->situation_counter > 1))
|
||||
if ($object->type == 5 && ($object->situation_counter > 1))
|
||||
{
|
||||
$prevsits = $object->get_prev_sits();
|
||||
print '<tr><td>';
|
||||
@ -3277,7 +3283,7 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Amount
|
||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right" colspan="3" nowrap>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
|
||||
@ -3436,7 +3442,7 @@ if ($action == 'create')
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Show object lines
|
||||
if (! empty($object->lines))
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
@ -3480,7 +3486,9 @@ if ($action == 'create')
|
||||
|
||||
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
|
||||
if (! $objectidnext && $object->is_last_in_cycle()) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->invoice_advance->unvalidate)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
@ -3510,7 +3518,9 @@ if ($action == 'create')
|
||||
|
||||
// Validate
|
||||
if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
||||
if ($user->rights->facture->valider) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1681,7 +1681,8 @@ class Facture extends CommonInvoice
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $user->rights->facture->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR);
|
||||
|
||||
@ -128,7 +128,8 @@ class modCommande extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider les commandes clients';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'valider';
|
||||
$this->rights[$r][4] = 'order_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 86;
|
||||
|
||||
@ -151,7 +151,8 @@ class modExpedition extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider les expeditions';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'valider';
|
||||
$this->rights[$r][4] = 'shipping_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 105; // id de la permission
|
||||
@ -197,8 +198,8 @@ class modExpedition extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider les bons de livraison';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'livraison';
|
||||
$this->rights[$r][5] = 'valider';
|
||||
$this->rights[$r][4] = 'livraison_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1109;
|
||||
|
||||
@ -137,7 +137,8 @@ class modFacture extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider les factures';
|
||||
$this->rights[$r][2] = 'a';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'valider';
|
||||
$this->rights[$r][4] = 'invoice_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 15;
|
||||
|
||||
@ -150,8 +150,8 @@ class modFournisseur extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider une commande fournisseur';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'commande';
|
||||
$this->rights[$r][5] = 'valider';
|
||||
$this->rights[$r][4] = 'supplier_order_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1185;
|
||||
@ -206,8 +206,8 @@ class modFournisseur extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider une facture fournisseur';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'facture';
|
||||
$this->rights[$r][5] = 'valider';
|
||||
$this->rights[$r][4] = 'supplier_invoice_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1234;
|
||||
|
||||
@ -130,7 +130,8 @@ class modPropale extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Valider les propositions commerciales'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'valider';
|
||||
$this->rights[$r][4] = 'propal_advance';
|
||||
$this->rights[$r][5] = 'validate';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 25; // id de la permission
|
||||
|
||||
@ -256,7 +256,10 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate)))
|
||||
)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@ -304,7 +307,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
||||
else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
|
||||
{
|
||||
$result = $object->setStatut(0);
|
||||
if ($result < 0)
|
||||
@ -1354,7 +1357,8 @@ else if ($id || $ref)
|
||||
|
||||
if ($object->statut == 0 && $num_prod > 0)
|
||||
{
|
||||
if ($user->rights->expedition->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
@ -1365,7 +1369,7 @@ else if ($id || $ref)
|
||||
}
|
||||
|
||||
// TODO add alternative status
|
||||
/* if ($object->statut == 1 && $user->rights->expedition->valider)
|
||||
/* if ($object->statut == 1 && $user->rights->expedition->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}*/
|
||||
|
||||
@ -530,7 +530,8 @@ class Expedition extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $user->rights->expedition->valider)
|
||||
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
|
||||
@ -334,7 +334,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
dol_syslog(get_class($this)."::valid");
|
||||
$result = 0;
|
||||
if ($user->rights->fournisseur->commande->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer)
|
||||
else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
@ -506,7 +506,10 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
|
||||
)
|
||||
{
|
||||
$object->date_commande=dol_now();
|
||||
$result = $object->valid($user);
|
||||
@ -1280,7 +1283,7 @@ if ($action=="create")
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
@ -1566,7 +1569,7 @@ elseif (! empty($object->id))
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Delivery date planed
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -1993,7 +1996,7 @@ elseif (! empty($object->id))
|
||||
$ws_key = $object->thirdparty->webservices_key;
|
||||
$ws_user = GETPOST('ws_user','alpha');
|
||||
$ws_password = GETPOST('ws_password','alpha');
|
||||
|
||||
|
||||
// NS and Authentication parameters
|
||||
$ws_ns = 'http://www.dolibarr.org/ns/';
|
||||
$ws_authentication = array(
|
||||
@ -2012,11 +2015,11 @@ elseif (! empty($object->id))
|
||||
$mode = "init";
|
||||
$error_occurred = true; //Don't allow to set the user/pass if thirdparty fields are not filled
|
||||
} else if ($mode != "init" && (empty($ws_user) || empty($ws_password))) {
|
||||
setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors');
|
||||
setEventMessage($langs->trans("ErrorFieldsRequired"), 'errors');
|
||||
$mode = "init";
|
||||
}
|
||||
|
||||
if ($mode == "init")
|
||||
if ($mode == "init")
|
||||
{
|
||||
//Table/form header
|
||||
print '<table class="border" width="100%">';
|
||||
@ -2124,7 +2127,7 @@ elseif (! empty($object->id))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ensure that price is equal and warn user if it's not
|
||||
$supplier_price = price($result_product["product"]["price_net"]); //Price of client tab in supplier dolibarr
|
||||
$local_price = NULL; //Price of supplier as stated in product suppliers tab on this dolibarr, NULL if not found
|
||||
@ -2212,7 +2215,8 @@ elseif (! empty($object->id))
|
||||
// Validate
|
||||
if ($object->statut == 0 && $num > 0)
|
||||
{
|
||||
if ($user->rights->fournisseur->commande->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_order_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
|
||||
@ -120,7 +120,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
// }
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider)
|
||||
elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
)
|
||||
{
|
||||
$idwarehouse=GETPOST('idwarehouse');
|
||||
|
||||
@ -300,13 +303,13 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
$_GET['socid']=$_POST['socid'];
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error ++;
|
||||
@ -1183,7 +1186,7 @@ if ($action == 'create')
|
||||
{
|
||||
$facturestatic = new FactureFournisseur($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($facturestatic->table_element);
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans('NewBill'));
|
||||
|
||||
dol_htmloutput_events();
|
||||
@ -1424,7 +1427,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
@ -1540,7 +1543,7 @@ else
|
||||
$societe = new Fournisseur($db);
|
||||
$result=$societe->fetch($object->socid);
|
||||
if ($result < 0) dol_print_error($db);
|
||||
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
@ -2255,7 +2258,8 @@ else
|
||||
{
|
||||
if (count($object->lines))
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
|
||||
@ -83,7 +83,10 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider)
|
||||
if ($action == 'confirm_valide' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
@ -312,7 +315,8 @@ if ($result > 0)
|
||||
{
|
||||
if ($user->societe_id == 0 && $object->statut == 0 && $action == '')
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
|
||||
|
||||
@ -119,7 +119,10 @@ if ($action == 'add')
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->livraison->valider)
|
||||
else if ($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->livraison_advance->validate)))
|
||||
)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
|
||||
|
||||
@ -341,7 +341,8 @@ class Livraison extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ($user->rights->expedition->livraison->valider)
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->livraison_advance->validate)))
|
||||
{
|
||||
if (! empty($conf->global->LIVRAISON_ADDON_NUMBER))
|
||||
{
|
||||
|
||||
@ -639,10 +639,8 @@ class User extends CommonObject
|
||||
}
|
||||
|
||||
// For backward compatibility
|
||||
if (isset($this->rights->propale))
|
||||
{
|
||||
$this->rights->propal = $this->rights->propale;
|
||||
}
|
||||
if (isset($this->rights->propale) && ! isset($this->rights->propal)) $this->rights->propal = $this->rights->propale;
|
||||
if (isset($this->rights->propal) && ! isset($this->rights->propale)) $this->rights->propale = $this->rights->propal;
|
||||
|
||||
if (! $moduletag)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user