From e4c4ced5a3de072601390e28db984eb4ab10e766 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2016 01:55:53 +0100 Subject: [PATCH] Complete work on usin dol_banner --- htdocs/comm/mailing/card.php | 40 +++++++++++++++------ htdocs/comm/mailing/cibles.php | 21 +++++++---- htdocs/comm/mailing/class/mailing.class.php | 3 +- htdocs/comm/mailing/info.php | 31 ++++++++++------ htdocs/langs/en_US/mails.lang | 1 - 5 files changed, 65 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 8f41c6f336a..d2c1ecd5938 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -790,15 +790,22 @@ else $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '
'; + print ''; - print ''; +/* print ''; print ''; - +*/ // Description - print ''; @@ -813,10 +820,12 @@ else print ''; // Status + /* print ''; - + */ + // Nb of distinct emails print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; + print '
'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print'
'; print $langs->trans("TotalNbOfDistinctRecipients"); @@ -988,7 +997,7 @@ else } - $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($object->substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; @@ -996,7 +1005,7 @@ else $htmltext.='
'; // Print mail content - print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); dol_fiche_head(''); @@ -1054,17 +1063,26 @@ else $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '
'; + print ''; + /* print ''; print ''; - + */ + // Topic - print ''; + print ''; // From - print ''; + print ''; // To print ''; @@ -1108,7 +1126,7 @@ else print ''; print ''; - $htmltext = ''.$langs->trans("CommonSubstitutions").':
'; + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($object->substitutionarray as $key => $val) { $htmltext.=$key.' = '.$langs->trans($val).'
'; @@ -1116,7 +1134,7 @@ else $htmltext.='
'; // Print mail content - print load_fiche_titre($form->textwithpicto($langs->trans("EMail"), $htmltext), '','title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); dol_fiche_head(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index abf903cd6ea..b12121293d7 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -178,17 +178,24 @@ if ($object->fetch($id) >= 0) dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email'); - - print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1).'
'; - $linkback = ''.$langs->trans("BackToList").''; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + + print '
'; + + print '
'; +/* print ''; print ''; - - print ''; +*/ + print ''; print ''; @@ -197,10 +204,10 @@ if ($object->fetch($id) >= 0) print ''; // Status - print ''; - +*/ // Nb of distinct emails print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id', $linkback); print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("Status").''.$object->getLibStatut(4); +/* print '
'.$langs->trans("Status").''.$object->getLibStatut(4); if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 6a7ae2cefbe..79201115ea1 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -33,7 +33,8 @@ class Mailing extends CommonObject { public $element='mailing'; public $table_element='mailing'; - + public $picto='email'; + var $titre; var $sujet; var $body; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 77245f74766..5280fcfad59 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -43,24 +43,33 @@ llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M $form = new Form($db); -$mil = new Mailing($db); +$object = new Mailing($db); -if ($mil->fetch($_REQUEST["id"]) >= 0) +if ($object->fetch($_REQUEST["id"]) >= 0) { - $head = emailing_prepare_head($mil); + $head = emailing_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email'); + $linkback = ''.$langs->trans("BackToList").''; - print '
'; - $mil->user_creation=$mil->user_creat; - $mil->date_creation=$mil->date_creat; - $mil->user_validation=$mil->user_valid; - $mil->date_validation=$mil->date_valid; - dol_print_object_info($mil); - print '
'; + $morehtmlright=''; + if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + + print '

'; + + //print '
'; + $object->user_creation=$object->user_creat; + $object->date_creation=$object->date_creat; + $object->user_validation=$object->user_valid; + $object->date_validation=$object->date_valid; + dol_print_object_info($object, 0); + //print '
'; + - print ''; + dol_fiche_end(); } llxFooter(); diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 45e8246261a..1c1a3bf3245 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -50,7 +50,6 @@ NbOfEMails=Nb of EMails TotalNbOfDistinctRecipients=Number of distinct recipients NoTargetYet=No recipients defined yet (Go on tab 'Recipients') RemoveRecipient=Remove recipient -CommonSubstitutions=Common substitutions YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README. EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values MailingAddFile=Attach this file