Merge branch '11.0_SupplierOrder_ValidateMassAction' of github.com:atm-gregr/dolibarr into NEW/develop_SupplierOrder_ValidateMassAction
This commit is contained in:
commit
b88a16b563
@ -135,7 +135,7 @@ if (!$sortorder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($search_status == '') {
|
if ($search_status == '') {
|
||||||
$search_status = -1;
|
$search_status = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
@ -245,7 +245,7 @@ if (empty($reshook)) {
|
|||||||
$search_multicurrency_montant_tva = '';
|
$search_multicurrency_montant_tva = '';
|
||||||
$search_multicurrency_montant_ttc = '';
|
$search_multicurrency_montant_ttc = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
$search_status = -1;
|
$search_status = '';
|
||||||
$search_date_order_startday = '';
|
$search_date_order_startday = '';
|
||||||
$search_date_order_startmonth = '';
|
$search_date_order_startmonth = '';
|
||||||
$search_date_order_startyear = '';
|
$search_date_order_startyear = '';
|
||||||
@ -277,9 +277,51 @@ if (empty($reshook)) {
|
|||||||
$objectlabel = 'SupplierOrders';
|
$objectlabel = 'SupplierOrders';
|
||||||
$permissiontoread = $user->rights->fournisseur->commande->lire;
|
$permissiontoread = $user->rights->fournisseur->commande->lire;
|
||||||
$permissiontodelete = $user->rights->fournisseur->commande->supprimer;
|
$permissiontodelete = $user->rights->fournisseur->commande->supprimer;
|
||||||
|
$permissiontovalidate = $user->rights->fournisseur->commande->creer;
|
||||||
$uploaddir = $conf->fournisseur->commande->dir_output;
|
$uploaddir = $conf->fournisseur->commande->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
|
if ($action == 'validate' && $permissiontovalidate)
|
||||||
|
{
|
||||||
|
if (GETPOST('confirm') == 'yes')
|
||||||
|
{
|
||||||
|
$objecttmp = new CommandeFournisseur($db);
|
||||||
|
$db->begin();
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
foreach ($toselect as $checked)
|
||||||
|
{
|
||||||
|
if ($objecttmp->fetch($checked))
|
||||||
|
{
|
||||||
|
if ($objecttmp->statut == 0)
|
||||||
|
{
|
||||||
|
$objecttmp->date_commande = dol_now();
|
||||||
|
$result = $objecttmp->valid($user);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
// If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step
|
||||||
|
if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $objecttmp->hasProductsOrServices(1)))
|
||||||
|
{
|
||||||
|
$result = $objecttmp->approve($user);
|
||||||
|
setEventMessages($langs->trans("SupplierOrderValidatedAndApproved"), array($objecttmp->ref));
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans("SupplierOrderValidated"), array($objecttmp->ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) $db->commit();
|
||||||
|
else $db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Mass action to generate vendor bills
|
// Mass action to generate vendor bills
|
||||||
if ($massaction == 'confirm_createsupplierbills') {
|
if ($massaction == 'confirm_createsupplierbills') {
|
||||||
$orders = GETPOST('toselect', 'array');
|
$orders = GETPOST('toselect', 'array');
|
||||||
@ -947,6 +989,18 @@ if ($resql) {
|
|||||||
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($permissiontovalidate) {
|
||||||
|
if ($user->rights->fournisseur->commande->approuver && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE))
|
||||||
|
{
|
||||||
|
$arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
|
||||||
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier");
|
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier");
|
||||||
}
|
}
|
||||||
@ -986,6 +1040,10 @@ if ($resql) {
|
|||||||
$trackid = 'sord'.$object->id;
|
$trackid = 'sord'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||||
|
|
||||||
|
if ($massaction == 'prevalidate') {
|
||||||
|
print $form->formconfirm($_SERVER["PHP_SELF"].$fieldstosearchall, $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($massaction == 'createbills') {
|
if ($massaction == 'createbills') {
|
||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
print '<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
|
print '<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
|
||||||
|
|||||||
@ -124,6 +124,8 @@ SupplierOrderReceivedInDolibarr=Purchase Order %s received %s
|
|||||||
SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted
|
SupplierOrderSubmitedInDolibarr=Purchase Order %s submitted
|
||||||
SupplierOrderClassifiedBilled=Purchase Order %s set billed
|
SupplierOrderClassifiedBilled=Purchase Order %s set billed
|
||||||
OtherOrders=Other orders
|
OtherOrders=Other orders
|
||||||
|
SupplierOrderValidatedAndApproved=Supplier order is validated and approved : %s
|
||||||
|
SupplierOrderValidated=Supplier order is validated : %s
|
||||||
##### Types de contacts #####
|
##### Types de contacts #####
|
||||||
TypeContact_commande_internal_SALESREPFOLL=Representative following-up sales order
|
TypeContact_commande_internal_SALESREPFOLL=Representative following-up sales order
|
||||||
TypeContact_commande_internal_SHIPPING=Representative following-up shipping
|
TypeContact_commande_internal_SHIPPING=Representative following-up shipping
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user