diff --git a/dev/initdata/generate-propale.php b/dev/initdata/generate-propale.php index 2efd2af2f08..a887b86b1a8 100755 --- a/dev/initdata/generate-propale.php +++ b/dev/initdata/generate-propale.php @@ -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")) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 50b3306e3f2..35807912c0a 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.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 '
' . $langs->trans('Validate') . '
'; // else print ''.$langs->trans('Validate').''; } // 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 '' . $langs->trans("AddAction") . ''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e8ace86cf73..f68a1f4f708 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 2296e8bd0a0..37fadb34095 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -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 '
' . $langs->trans('Validate') . '
'; } // Edit diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7d8cc3d3de2..8bd00764a57 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 10686920d39..ca2707ea23f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 '' . "\n"; } - + // Replacement print ''; print '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 ''; @@ -3277,7 +3283,7 @@ if ($action == 'create') } } } - + // Amount print '' . $langs->trans('AmountHT') . ''; print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; @@ -3436,7 +3442,7 @@ if ($action == 'create') print ''; } } - + // 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 '
' . $langs->trans('Modify') . '
'; } else { print '
' . $langs->trans('Modify') . '
'; @@ -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 '
' . $langs->trans('Validate') . '
'; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 32d7fa13122..f4424b8c9ad 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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); diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 4a2f0bc20b4..d8cc5647817 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -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; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 20c679556e7..e2c85c60352 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -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; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 5bb85dea7db..38a06576c9e 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -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; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 1f1a8072e1e..656ef87c191 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -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; diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 2a390118b72..de1566578fe 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -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 diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c93ec795dec..7e7b3cf6e3b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -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 ''.$langs->trans("Validate").''; } @@ -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 ''.$langs->trans("ReOpen").''; }*/ diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 00105cf967a..0388878d3a5 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef25be9469f..f07e9be9bba 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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(); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 57696363289..15fdbc70722 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -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 ''; } - + print ''.$langs->trans('NotePublic').''; print ''; $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 ''; print ''; } - + // Delivery date planed print ''; print '
'; @@ -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 ''; @@ -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 ''.$langs->trans('Validate').''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 05e8590628f..180e70bad79 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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 ''; // print ''; print ''; - + 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 ''.$langs->trans('Validate').''; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 179e810d182..de070a2b3b0 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -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 ''.$langs->trans('Valid').''; diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 1a89a377fef..4ab76afe239 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -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); diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index ccde9484b0d..e12781d5228 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -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)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 11eaa8afb45..bc4f6b5d2f5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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) {