diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index adc56f49324..b41024bbc26 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1053,7 +1053,7 @@ if (empty($reshook)) { } // Force mandatory order method - if ($action == 'commande') { + if ($action == 'commande') { // Not a real action so no permission test $methodecommande = GETPOSTINT('methodecommande'); if ($cancel) { @@ -1189,11 +1189,10 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->fournisseur->commande->dir_output; - $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - if ($action == 'update_extras') { + if ($action == 'update_extras' && $permissiontoadd) { $object->oldcopy = dol_clone($object, 2); // Fill array 'array_options' with data from add form @@ -1221,7 +1220,7 @@ if (empty($reshook)) { /* * Create an order */ - if ($action == 'add' && $usercancreate) { + if ($action == 'add' && $permissiontoadd) { $error = 0; $selectedLines = GETPOST('toselect', 'array'); if ($socid < 1) { @@ -1430,7 +1429,7 @@ if (empty($reshook)) { } } - if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && !GETPOST('cancel', 'alpha')) { + if ($action == 'webservice' && $permissiontoadd && GETPOST('mode', 'alpha') == "send" && !GETPOST('cancel', 'alpha')) { $ws_url = $object->thirdparty->webservices_url; $ws_key = $object->thirdparty->webservices_key; $ws_user = GETPOST('ws_user', 'alpha'); @@ -1448,8 +1447,8 @@ if (empty($reshook)) { 'entity' => $ws_entity ); - //Is sync supplier web services module activated? and everything filled? - if (empty($conf->syncsupplierwebservices->enabled)) { + // Is sync supplier web services module activated? and everything filled? + if (isModEnabled('syncsupplierwebservices')) { setEventMessages($langs->trans("WarningModuleNotActive", $langs->transnoentities("Module2650Name")), null, 'mesgs'); } elseif (empty($ws_url) || empty($ws_key)) { setEventMessages($langs->trans("ErrorWebServicesFieldsRequired"), null, 'errors'); @@ -1513,7 +1512,7 @@ if (empty($reshook)) { } } - if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) { + if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $permissiontoadd) { if ($action == 'addcontact') { if ($object->id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); @@ -2165,7 +2164,7 @@ if ($action == 'create') { print ''; } print '
'; print $langs->trans('PaymentConditions'); print ''; - if ($action != 'editconditions') { + if ($action != 'editconditions' && $permissiontoadd) { print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; @@ -2184,7 +2183,7 @@ if ($action == 'create') { print ''; - if ($action != 'editmode') { + if ($action != 'editmode' && $permissiontoadd) { print ''; } print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; @@ -2204,7 +2203,7 @@ if ($action == 'create') { print ''; - if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { + if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $permissiontoadd) { print ''; } print '
'; print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; @@ -2252,7 +2251,7 @@ if ($action == 'create') { print ''; } print '
'; print $langs->trans('BankAccount'); print ''; - if ($action != 'editbankaccount' && $usercancreate) { + if ($action != 'editbankaccount' && $permissiontoadd) { print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
';