Fix: Maxi debug on sending document by email. Works now with odt too.
This commit is contained in:
parent
bc94ec9cd6
commit
245edb8596
@ -695,7 +695,7 @@ else
|
|||||||
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
@ -741,7 +741,7 @@ else
|
|||||||
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -498,11 +498,11 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
// $objectref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->propale->dir_output . '/' . $objectref . '/' . $objectref . '.pdf';
|
// $file = $conf->propale->dir_output . '/' . $objectref . '/' . $objectref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if ($_POST['sendto'])
|
if ($_POST['sendto'])
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -624,13 +624,13 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1484,24 +1484,28 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Statut
|
// Statut
|
||||||
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="3">'.$object->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Notes').'</td></tr>';
|
|
||||||
|
|
||||||
// Public note
|
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
print '<tr><td valign="top">';
|
{
|
||||||
print $form->editfieldkey("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans('Notes').'</td></tr>';
|
||||||
print '</td><td colspan="3">';
|
|
||||||
print $form->editfieldval("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
// Private note
|
// Public note
|
||||||
if (! $user->societe_id)
|
print '<tr><td valign="top">';
|
||||||
{
|
print $form->editfieldkey("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
|
||||||
print '<tr><td valign="top">';
|
print '</td><td colspan="3">';
|
||||||
print $form->editfieldkey("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
|
print $form->editfieldval("NotePublic",'note_public',$object->note_public,$object,$user->rights->propale->creer,'textarea');
|
||||||
print '</td><td colspan="3">';
|
print "</td></tr>";
|
||||||
print $form->editfieldval("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
|
|
||||||
print "</td></tr>";
|
// Private note
|
||||||
}
|
if (! $user->societe_id)
|
||||||
|
{
|
||||||
|
print '<tr><td valign="top">';
|
||||||
|
print $form->editfieldkey("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
|
||||||
|
print '</td><td colspan="3">';
|
||||||
|
print $form->editfieldval("NotePrivate",'note',$object->note_private,$object,$user->rights->propale->creer,'textarea');
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
@ -1617,16 +1621,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Send
|
// Send
|
||||||
if ($object->statut == 1 || $object->statut == 2)
|
if ($object->statut == 1 || $object->statut == 2)
|
||||||
{
|
{
|
||||||
$propref = dol_sanitizeFileName($object->ref);
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propale->propal_advance->send)
|
||||||
$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
{
|
||||||
if (file_exists($file))
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
{
|
}
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propale->propal_advance->send)
|
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an order
|
// Create an order
|
||||||
@ -1722,7 +1721,33 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->propale->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->propale->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=propale_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->propale->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendPropalByMail'));
|
print_titre($langs->trans('SendPropalByMail'));
|
||||||
@ -1756,10 +1781,10 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($object->ref).'.pdf','application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->show_form();
|
$formmail->show_form();
|
||||||
|
|||||||
@ -1034,11 +1034,11 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if ($_POST['sendto'])
|
if ($_POST['sendto'])
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -1153,14 +1153,14 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
$mesg.='</div>';
|
$mesg.='</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||||
$action='presend';
|
$action='presend';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2008,16 +2008,11 @@ else
|
|||||||
// Send
|
// Send
|
||||||
if ($object->statut > 0)
|
if ($object->statut > 0)
|
||||||
{
|
{
|
||||||
$comref = dol_sanitizeFileName($object->ref);
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send))
|
||||||
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
{
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send))
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
}
|
||||||
|
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ship
|
// Ship
|
||||||
@ -2147,7 +2142,33 @@ else
|
|||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=commande_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendOrderByMail'));
|
print_titre($langs->trans('SendOrderByMail'));
|
||||||
@ -2180,10 +2201,10 @@ else
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show form
|
// Show form
|
||||||
|
|||||||
@ -1307,11 +1307,11 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if ($_POST['sendto'])
|
if ($_POST['sendto'])
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -1440,13 +1440,13 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
|||||||
$mesg.='</div>';
|
$mesg.='</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3048,10 +3048,12 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Construit PDF si non existant
|
// Build document if it not exists
|
||||||
if (! is_readable($file))
|
if (! $file || ! is_readable($file))
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -3063,12 +3065,15 @@ else
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result=facture_pdf_create($db, $object, $_REQUEST['model'], $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
|
||||||
|
$result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -3102,10 +3107,10 @@ else
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->show_form();
|
$formmail->show_form();
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
* @param string $types Can be "directories", "files", or "all"
|
* @param string $types Can be "directories", "files", or "all"
|
||||||
* @param int $recursive Determines whether subdirectories are searched
|
* @param int $recursive Determines whether subdirectories are searched
|
||||||
* @param string $filter Regex for include filter
|
* @param string $filter Regex for include filter
|
||||||
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')
|
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
|
||||||
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
|
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
|
||||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||||
@ -1047,4 +1047,18 @@ function dol_compress_file($inputfile, $outputfile, $mode="gz")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return most recent file
|
||||||
|
*
|
||||||
|
* @param string $dir Directory to scan
|
||||||
|
* @param string $regexfilter Regexfilter
|
||||||
|
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
|
||||||
|
* @return strnig Full path to most recent file
|
||||||
|
*/
|
||||||
|
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'))
|
||||||
|
{
|
||||||
|
$tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC);
|
||||||
|
return $tmparray[0];
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -359,11 +359,11 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if (GETPOST('sendto','alpha'))
|
if (GETPOST('sendto','alpha'))
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -488,13 +488,13 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
$action='presend';
|
$action='presend';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1280,16 +1280,11 @@ else
|
|||||||
// Send
|
// Send
|
||||||
if ($object->statut > 0)
|
if ($object->statut > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send)
|
||||||
$file = $conf->expedition->dir_output . '/sending/'.$ref.'/'.$ref.'.pdf';
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send)
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
}
|
||||||
|
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create bill and Classify billed
|
// Create bill and Classify billed
|
||||||
@ -1362,12 +1357,37 @@ else
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Action presend
|
* Action presend
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendShippingByEMail'));
|
print_titre($langs->trans('SendShippingByEMail'));
|
||||||
@ -1400,10 +1420,10 @@ else
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (GETPOST('mode','alpha')=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show form
|
// Show form
|
||||||
|
|||||||
@ -482,11 +482,11 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
|
|||||||
|
|
||||||
if ($object->fetch($id) > 0)
|
if ($object->fetch($id) > 0)
|
||||||
{
|
{
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
// $objectref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->ficheinter->dir_output . '/' . $objectref . '/' . $objectref . '.pdf';
|
// $file = $conf->ficheinter->dir_output . '/' . $objectref . '/' . $objectref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
if (GETPOST('sendto','alpha'))
|
if (GETPOST('sendto','alpha'))
|
||||||
@ -610,13 +610,13 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
|
|||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1099,16 +1099,11 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Send
|
// Send
|
||||||
if ($object->statut > 0)
|
if ($object->statut > 0)
|
||||||
{
|
{
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)
|
||||||
$file = $conf->ficheinter->dir_output . '/'.$objectref.'/'.$objectref.'.pdf';
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
}
|
||||||
|
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoicing
|
// Invoicing
|
||||||
@ -1184,7 +1179,33 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendInterventionByMail'));
|
print_titre($langs->trans('SendInterventionByMail'));
|
||||||
@ -1218,10 +1239,10 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (GETPOST('mode','alpha')=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,$object->ref.'.pdf','application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->show_form();
|
$formmail->show_form();
|
||||||
|
|||||||
@ -658,11 +658,11 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if ($_POST['sendto'])
|
if ($_POST['sendto'])
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -777,14 +777,14 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
$mesg.='</div>';
|
$mesg.='</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||||
$action='presend';
|
$action='presend';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1393,12 +1393,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->commande->commander)
|
if ($user->rights->fournisseur->commande->commander)
|
||||||
{
|
{
|
||||||
$comref = dol_sanitizeFileName($object->ref);
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||||
$file = $conf->fournisseur->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,7 +1545,33 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendOrderByMail'));
|
print_titre($langs->trans('SendOrderByMail'));
|
||||||
@ -1583,10 +1604,10 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show form
|
// Show form
|
||||||
|
|||||||
@ -629,11 +629,11 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
$result=$object->fetch_thirdparty();
|
$result=$object->fetch_thirdparty();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref.'/'.$ref.'.pdf';
|
// $file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref.'/'.$ref.'.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
// if (is_readable($file))
|
||||||
{
|
// {
|
||||||
if ($_POST['sendto'])
|
if ($_POST['sendto'])
|
||||||
{
|
{
|
||||||
// Le destinataire a ete fourni via le champ libre
|
// Le destinataire a ete fourni via le champ libre
|
||||||
@ -758,13 +758,13 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
|
||||||
dol_syslog('Recipient email is empty');
|
dol_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
}
|
/* }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1792,7 +1792,33 @@ else
|
|||||||
if ($action == 'presend')
|
if ($action == 'presend')
|
||||||
{
|
{
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
$file = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref.'/'.$ref.'.pdf';
|
include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||||
|
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref);
|
||||||
|
$file=$fileparams['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendBillByMail'));
|
print_titre($langs->trans('SendBillByMail'));
|
||||||
@ -1825,10 +1851,10 @@ else
|
|||||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
if (GETPOST("mode")=='init')
|
||||||
{
|
{
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
$formmail->add_attached_files($file,dol_sanitizeFilename($ref.'.pdf'),'application/pdf');
|
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show form
|
// Show form
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user