Skip to content

Commit

Permalink
Uniformize code for mass actions
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Apr 8, 2016
1 parent 8222624 commit 7a48ceb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions htdocs/comm/propal/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
}
$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
$hookmanager->initHooks(array('propallist'));
Expand Down
2 changes: 2 additions & 0 deletions htdocs/commande/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande', $id,'');

$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;

$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
Expand Down
16 changes: 6 additions & 10 deletions htdocs/compta/facture/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.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->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';

$langs->load('bills');
$langs->load('companies');
Expand Down Expand Up @@ -115,8 +112,7 @@
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);

$diroutputpdf=$conf->facture->dir_output . '/unpaid/temp';
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
$diroutputmassaction=$conf->facture->dir_output . '/temp/massgeneration/'.$user->id;

$object=new Facture($db);

Expand Down Expand Up @@ -577,7 +573,7 @@
}

// Create output dir if not exists
dol_mkdir($diroutputpdf);
dol_mkdir($diroutputmassaction);

// Save merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices")));
Expand All @@ -591,7 +587,7 @@
if ($pagecount)
{
$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');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
Expand All @@ -611,7 +607,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

$langs->load("other");
$upload_dir = $diroutputpdf;
$upload_dir = $diroutputmassaction;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
Expand Down Expand Up @@ -1446,7 +1442,7 @@
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&','&',$param);

$filedir=$diroutputpdf;
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire;

Expand Down
2 changes: 2 additions & 0 deletions htdocs/expedition/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expedition',$expeditionid,'');

$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;

$search_ref_exp = GETPOST("search_ref_exp");
$search_ref_liv = GETPOST('search_ref_liv');
$search_company = GETPOST("search_company");
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/exports.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Sheet=Sheet
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
LineId=Id of line
LineLabel=Label of line
Expand Down

0 comments on commit 7a48ceb

Please sign in to comment.