fix actionbuttons on editline or presend
This commit is contained in:
parent
d97b882cf8
commit
aeb86a4faf
@ -2013,12 +2013,15 @@ if ($action == 'create') {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
if ($user->socid == 0) {
|
||||
if ($user->socid == 0 && $action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
@ -2130,11 +2133,6 @@ if ($action == 'create') {
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend') {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
|
||||
@ -2433,206 +2433,208 @@ if ($action == 'create') {
|
||||
* Buttons for actions
|
||||
*/
|
||||
|
||||
if ($user->socid == 0 && $action != 'editline' && $action != 'delete') {
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->socid == 0 && $action != 'delete') {
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook)) {
|
||||
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
|
||||
if ($action != 'makeorder' && $action != 'presend' && $action != 'editline') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Validate
|
||||
if ($object->statut == 0 && $num > 0) {
|
||||
if ($usercanvalidate) {
|
||||
$tmpbuttonlabel = $langs->trans('Validate');
|
||||
if ($usercanapprove && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) {
|
||||
$tmpbuttonlabel = $langs->trans("ValidateAndApprove");
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook)) {
|
||||
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
|
||||
|
||||
// Validate
|
||||
if ($object->statut == 0 && $num > 0) {
|
||||
if ($usercanvalidate) {
|
||||
$tmpbuttonlabel = $langs->trans('Validate');
|
||||
if ($usercanapprove && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE)) {
|
||||
$tmpbuttonlabel = $langs->trans("ValidateAndApprove");
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">';
|
||||
print $tmpbuttonlabel;
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">';
|
||||
print $tmpbuttonlabel;
|
||||
print '</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.
|
||||
{
|
||||
print '<div class="inline-block divButAction"><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></div>';
|
||||
}*/
|
||||
// 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.
|
||||
{
|
||||
print '<div class="inline-block divButAction"><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></div>';
|
||||
}*/
|
||||
|
||||
// Modify
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Approve
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprove) {
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && !empty($object->user_approve_id)) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("FirstApprovalAlreadyDone")).'">'.$langs->trans("ApproveOrder").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve">'.$langs->trans("ApproveOrder").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("ApproveOrder").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set)
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
|
||||
// Modify
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprovesecond) {
|
||||
if (!empty($object->user_approve_id2)) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("SecondApprovalAlreadyDone")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
if ($usercanorder) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Approve
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprove) {
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED && !empty($object->user_approve_id)) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("FirstApprovalAlreadyDone")).'">'.$langs->trans("ApproveOrder").'</a>';
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve2">'.$langs->trans("Approve2Order").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=approve">'.$langs->trans("ApproveOrder").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("ApproveOrder").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Refuse
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprove || $usercanapprovesecond) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("RefuseOrder").'</a>';
|
||||
// Second approval (if option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set)
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) && $object->total_ht >= $conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) {
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprovesecond) {
|
||||
if (!empty($object->user_approve_id2)) {
|
||||
print '<a class="butActionRefused classfortooltip" 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="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Approve2Order").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || !empty($conf->global->SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
// Refuse
|
||||
if ($object->statut == CommandeFournisseur::STATUS_VALIDATED) {
|
||||
if ($usercanapprove || $usercanapprovesecond) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=refuse">'.$langs->trans("RefuseOrder").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("RefuseOrder").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || !empty($conf->global->SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen
|
||||
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) {
|
||||
$buttonshown = 0;
|
||||
if (!$buttonshown && $usercanapprove) {
|
||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|
||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||
$buttonshown++;
|
||||
}
|
||||
}
|
||||
if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
|
||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|
||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array($object->statut, array(3, 4, 5, 6, 7, 9))) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen
|
||||
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) {
|
||||
$buttonshown = 0;
|
||||
if (!$buttonshown && $usercanapprove) {
|
||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|
||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||
$buttonshown++;
|
||||
}
|
||||
}
|
||||
if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
|
||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|
||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (in_array($object->statut, array(3, 4, 5, 6, 7, 9))) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Ship
|
||||
$hasreception = 0;
|
||||
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
|
||||
$labelofbutton = $langs->trans('ReceiveProducts');
|
||||
if ($conf->reception->enabled) {
|
||||
$labelofbutton = $langs->trans("CreateReception");
|
||||
if (!empty($object->linkedObjects['reception'])) {
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
if ($element->statut >= 0) {
|
||||
$hasreception = 1;
|
||||
break;
|
||||
// Ship
|
||||
$hasreception = 0;
|
||||
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
|
||||
$labelofbutton = $langs->trans('ReceiveProducts');
|
||||
if ($conf->reception->enabled) {
|
||||
$labelofbutton = $langs->trans("CreateReception");
|
||||
if (!empty($object->linkedObjects['reception'])) {
|
||||
foreach ($object->linkedObjects['reception'] as $element) {
|
||||
if ($element->statut >= 0) {
|
||||
$hasreception = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($object->statut, array(3, 4, 5))) {
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $usercanreceive) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$labelofbutton.'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$labelofbutton.'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) {
|
||||
if ($usercanorder) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=makeorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Classify received (this does not record reception)
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY) {
|
||||
if ($usercanreceive) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=classifyreception#classifyreception">'.$langs->trans("ClassifyReception").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create bill
|
||||
//if (isModEnabled('facture'))
|
||||
//{
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
|
||||
if ($usercancreate && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) { // statut 2 means approved
|
||||
if (!isModEnabled('facture')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
} else {
|
||||
if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
if (in_array($object->statut, array(3, 4, 5))) {
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $usercanreceive) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id.'">'.$labelofbutton.'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$labelofbutton.'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) {
|
||||
if ($usercanorder) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=makeorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NeedAtLeastOneInvoice")).'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Classify received (this does not record reception)
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY) {
|
||||
if ($usercanreceive) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=classifyreception#classifyreception">'.$langs->trans("ClassifyReception").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create bill
|
||||
//if (isModEnabled('facture'))
|
||||
//{
|
||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
|
||||
if ($usercancreate && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) { // statut 2 means approved
|
||||
if (!isModEnabled('facture')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
} else {
|
||||
if (!empty($object->linkedObjectsIds['invoice_supplier'])) {
|
||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NeedAtLeastOneInvoice")).'">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a remote order using WebService only if module is activated
|
||||
if (!empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) { // 2 means accepted
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=webservice&token='.newToken().'&mode=init">'.$langs->trans('CreateRemoteOrder').'</a>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($usercancreate) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if (!empty($usercandelete)) {
|
||||
if ($hasreception) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ReceptionExist").'">'.$langs->trans("Delete").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a remote order using WebService only if module is activated
|
||||
if (!empty($conf->syncsupplierwebservices->enabled) && $object->statut >= 2) { // 2 means accepted
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=webservice&token='.newToken().'&mode=init">'.$langs->trans('CreateRemoteOrder').'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
// Clone
|
||||
if ($usercancreate) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) {
|
||||
if ($usercanorder) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel">'.$langs->trans("CancelOrder").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if (!empty($usercandelete)) {
|
||||
if ($hasreception) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ReceptionExist").'">'.$langs->trans("Delete").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
|
||||
|
||||
if ($usercanorder && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'makeorder') {
|
||||
// Set status to ordered (action=commande)
|
||||
print '<!-- form to record supplier order -->'."\n";
|
||||
@ -2668,7 +2670,12 @@ if ($action == 'create') {
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
if ($action != 'makeorder') {
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'makeorder' && $action != 'presend' ) {
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
// Generated documents
|
||||
@ -2917,11 +2924,6 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail = 'order_supplier_send';
|
||||
$defaulttopic = 'SendOrderRef';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user