diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index eaaffcc9582..38d1e8c0a8f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -488,8 +488,8 @@ if ($_POST['action'] == 'send' || $_POST['action'] == 'relance') $facref = sanitize_string($fac->ref); $file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf'; - if (is_readable($file)) - { + if (! is_readable($file)) + { $soc = new Societe($db, $fac->socidp); if ($_POST['sendto']) { @@ -587,23 +587,29 @@ if ($_POST['action'] == 'send' || $_POST['action'] == 'relance') } else { + $langs->load("other"); $msg='
'.$langs->trans('ErrorFailedToSendMail',$from,$sendto).' !
'; } } else { + $langs->load("other"); $msg='
'.$langs->trans('ErrorMailRecipientIsEmpty').'
'; - dolibarr_syslog('Le mail du destinataire est vide'); + dolibarr_syslog('Recipient email is empty'); } } else { - dolibarr_syslog('Impossible de lire :'.$file); + $langs->load("other"); + $msg='
'.$langs->trans('ErrorCantReadFile',$file).'
'; + dolibarr_syslog('Failed to read file: '.$file); } } else { + $langs->load("other"); + $msg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; dolibarr_syslog('Impossible de lire les données de la facture. Le fichier facture n\'a peut-être pas été généré.'); } } @@ -618,6 +624,7 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post $result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs); if ($result <= 0) { + dolibarr_print_error($db,$result); exit; } } @@ -2137,6 +2144,22 @@ else */ if ($_GET['action'] == 'presend') { + $facref = sanitize_string($fac->ref); + $file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf'; + + // Construit PDF si non existant + if (! is_readable($file)) + { + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs); + if ($result <= 0) + { + dolibarr_print_error($db,$result); + exit; + } + } + print '
'; print_titre($langs->trans('SendBillByMail')); @@ -2172,6 +2195,22 @@ else if ($_GET['action'] == 'prerelance') { + $facref = sanitize_string($fac->ref); + $file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf'; + + // Construit PDF si non existant + if (! is_readable($file)) + { + $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs); + if ($result <= 0) + { + dolibarr_print_error($db,$result); + exit; + } + } + print '
'; print_titre($langs->trans('SendReminderBillByMail')); diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 9cbb50b7947..fd26edc05cb 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -1,11 +1,14 @@ # Dolibarr language file - en_US - other -Calendar=Calendar ErrorPasswordDiffers=Passwords differs, please type them again. ErrorForbidden=Access forbidden.
You try to access to a page, area or feature without being in an authenticated session or that is not allowed to your user. ErrorForbidden2=Permission for this login can be defined by your Dolibarr administrator from menu %s->%s. ErrorForbidden3=It seems that Dolibarr is not used through an authenticated session. Take a look at Dolibarr setup documentation to know how to manage authentications (htaccess, mod_auth or other...). ErrorNoImagickReadimage=Function imagick_readimage is not found in this PHP. No preview can be available. ErrorRecordAlreadyExists=Record already exists +ErrorCantReadFile=Failed to read file '%s' +ErrorCantReadDir=Failed to read directory '%s' +ErrorFailedToFindEntity=Failed to read entity '%s' +Calendar=Calendar AddTrip=Add trip Tools=Tools Birthday=Birthday diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index c38dbf2b076..b6761bd459a 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -1,11 +1,14 @@ # Dolibarr language file - fr_FR - other -Calendar=Calendrier ErrorPasswordDiffers=Les mots de passe ne sont pas identiques, veuillez les saisir à nouveau ErrorForbidden=Accès non autorisé.
Vous essayez d'accéder à une page, zone ou fonction sans être au sein d'une session authentifiée ou qui n'est pas autorisée pour votre compte utilisateur. ErrorForbidden2=Les permissions pour ce login peuvent être attribuées par l'administrateur Dolibarr via le menu %s -> %s. ErrorForbidden3=Dolibarr ne semble pas fonctionner au sein d'une session authentifiée. Consultez la documentation d'installation de Dolibarr pour savoir comment gérer les authentifications (htaccess, mod_auth ou autre...). ErrorNoImagickReadimage=La fonction imagick_readimage n'est pas présente sur cette installation de PHP. L'aperçu n'est donc pas disponible. ErrorRecordAlreadyExists=Enregistrement déjà existant +ErrorCantReadFile=Echec de lecture du fichier '%s' +ErrorCantReadDir=Echec de lecture du répertoire '%s' +ErrorFailedToFindEntity=Echec de lecture de l'entité '%s' +Calendar=Calendrier AddTrip=Créer déplacement Tools=Outils Birthday=Anniversaire