Fix Option for second level approbation was visible when it should
not.
This commit is contained in:
parent
c058437879
commit
fcc6ce8c31
@ -168,19 +168,11 @@ else if ($action == 'addcat')
|
||||
else if ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
{
|
||||
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT'); // No alpha here, we want exact string
|
||||
$doubleapproval = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL');
|
||||
//$doubleapprovalgroup = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') > 0 ? GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP') : '';
|
||||
$doubleapproval = GETPOST('SUPPLIER_ORDER_DOUBLE_APPROVAL','alpha');
|
||||
$doubleapproval = price2num($doubleapproval );
|
||||
|
||||
$res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
$res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL",$doubleapproval,'chaine',0,'',$conf->entity);
|
||||
/*if (isset($_POST["SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP"]))
|
||||
{
|
||||
$res3 = dolibarr_set_const($db, "SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP",$doubleapprovalgroup,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
$res3=1;
|
||||
}*/
|
||||
|
||||
// TODO We add/delete permission here until permission can have a condition on a global var
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
|
||||
@ -486,18 +478,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
print $langs->trans("UseDoubleApproval").'<br>';
|
||||
print $langs->trans("IfSetToYesDontForgetPermission");
|
||||
print '</td><td>';
|
||||
print $form->selectyesno('SUPPLIER_ORDER_DOUBLE_APPROVAL', $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL, 1);
|
||||
print '<input type="text" size="3" name="SUPPLIER_ORDER_DOUBLE_APPROVAL" value="'.$conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL.'">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
$var=!$var;
|
||||
/*print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("GroupOfUserForSecondApproval").'</td><td>';
|
||||
print $form->select_dolgroups($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP,'SUPPLIER_ORDER_DOUBLE_APPROVAL_GROUP', 1);
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
$var=!$var;*/
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
|
||||
@ -703,7 +703,10 @@ class CommandeFournisseur extends CommonOrder
|
||||
{
|
||||
$sql.= " date_approve='".$this->db->idate($now)."',";
|
||||
$sql.= " fk_user_approve = ".$user->id;
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)) $movetoapprovestatus=false;
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
|
||||
{
|
||||
if (empty($this->user_approve_id2)) $movetoapprovestatus=false; // second level approval not done
|
||||
}
|
||||
}
|
||||
else // request a second level approval
|
||||
{
|
||||
|
||||
@ -2629,7 +2629,7 @@ elseif (! empty($object->id))
|
||||
{
|
||||
if ($user->rights->fournisseur->commande->approuver)
|
||||
{
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && ! empty($object->user_approve_id))
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL && ! empty($object->user_approve_id))
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("FirstApprovalAlreadyDone")).'">'.$langs->trans("ApproveOrder").'</a>';
|
||||
}
|
||||
@ -2645,23 +2645,26 @@ elseif (! empty($object->id))
|
||||
}
|
||||
|
||||
// Second approval (if option SUPPLIER_ORDER_DOUBLE_APPROVAL is set)
|
||||
if ($object->statut == 1)
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $object->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
|
||||
{
|
||||
if ($user->rights->fournisseur->commande->approve2)
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && ! empty($object->user_approve_id2))
|
||||
if ($user->rights->fournisseur->commande->approve2)
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("SecondApprovalAlreadyDone")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
if (! empty($object->user_approve_id2))
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("SecondApprovalAlreadyDone")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve2">'.$langs->trans("Approve2Order").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve2">'.$langs->trans("Approve2Order").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Refuse
|
||||
|
||||
@ -43,4 +43,4 @@ ListOfSupplierOrders=List of supplier orders
|
||||
MenuOrdersSupplierToBill=Supplier orders to invoice
|
||||
NbDaysToDelivery=Delivery delay in days
|
||||
DescNbDaysToDelivery=The biggest deliver delay of the products from this order
|
||||
UseDoubleApproval=Use double approval (the second approval can be done by any user with the dedicated permission)
|
||||
UseDoubleApproval=Use double approval when amount (without tax) is higher than (The second approval can be done by any user with the dedicated permission. Set to 0 for no double approval)
|
||||
Loading…
Reference in New Issue
Block a user