Uniformize code for mass actions
This commit is contained in:
parent
8222624ff0
commit
7a48ceb635
@ -103,6 +103,7 @@ if (! empty($socid))
|
|||||||
}
|
}
|
||||||
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||||
|
|
||||||
|
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('propallist'));
|
$hookmanager->initHooks(array('propallist'));
|
||||||
|
|||||||
@ -76,6 +76,8 @@ $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'commande', $id,'');
|
$result = restrictedArea($user, 'commande', $id,'');
|
||||||
|
|
||||||
|
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
|
||||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
|||||||
@ -45,10 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
if (! empty($conf->projet->enabled))
|
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
@ -115,8 +112,7 @@ $fieldid = (! empty($ref)?'facnumber':'rowid');
|
|||||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
|
||||||
|
|
||||||
$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp';
|
$diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user
|
|
||||||
|
|
||||||
$object=new Facture($db);
|
$object=new Facture($db);
|
||||||
|
|
||||||
@ -577,7 +573,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create output dir if not exists
|
// Create output dir if not exists
|
||||||
dol_mkdir($diroutputpdf);
|
dol_mkdir($diroutputmassaction);
|
||||||
|
|
||||||
// Save merged file
|
// Save merged file
|
||||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
|
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
|
||||||
@ -591,7 +587,7 @@ if (empty($reshook))
|
|||||||
if ($pagecount)
|
if ($pagecount)
|
||||||
{
|
{
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
$file=$diroutputpdf.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||||
$pdf->Output($file,'F');
|
$pdf->Output($file,'F');
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
@ -611,7 +607,7 @@ if (empty($reshook))
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$upload_dir = $diroutputpdf;
|
$upload_dir = $diroutputmassaction;
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$file = $upload_dir . '/' . GETPOST('file');
|
||||||
$ret=dol_delete_file($file);
|
$ret=dol_delete_file($file);
|
||||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||||
@ -1446,7 +1442,7 @@ if ($resql)
|
|||||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||||
$urlsource.=str_replace('&','&',$param);
|
$urlsource.=str_replace('&','&',$param);
|
||||||
|
|
||||||
$filedir=$diroutputpdf;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->facture->lire;
|
$genallowed=$user->rights->facture->lire;
|
||||||
$delallowed=$user->rights->facture->lire;
|
$delallowed=$user->rights->facture->lire;
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,8 @@ $expeditionid = GETPOST('id','int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'expedition',$expeditionid,'');
|
$result = restrictedArea($user, 'expedition',$expeditionid,'');
|
||||||
|
|
||||||
|
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
|
||||||
$search_ref_exp = GETPOST("search_ref_exp");
|
$search_ref_exp = GETPOST("search_ref_exp");
|
||||||
$search_ref_liv = GETPOST('search_ref_liv');
|
$search_ref_liv = GETPOST('search_ref_liv');
|
||||||
$search_company = GETPOST("search_company");
|
$search_company = GETPOST("search_company");
|
||||||
|
|||||||
@ -45,7 +45,7 @@ FormatedExportDesc2=First step is to choose a predefined dataset, then to choose
|
|||||||
FormatedExportDesc3=When data to export are selected, you can define output file format you want to export your data to.
|
FormatedExportDesc3=When data to export are selected, you can define output file format you want to export your data to.
|
||||||
Sheet=Sheet
|
Sheet=Sheet
|
||||||
NoImportableData=No importable data (no module with definitions to allow data imports)
|
NoImportableData=No importable data (no module with definitions to allow data imports)
|
||||||
FileSuccessfullyBuilt=Export file generated
|
FileSuccessfullyBuilt=File generated
|
||||||
SQLUsedForExport=SQL Request used to build export file
|
SQLUsedForExport=SQL Request used to build export file
|
||||||
LineId=Id of line
|
LineId=Id of line
|
||||||
LineLabel=Label of line
|
LineLabel=Label of line
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user