diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d8a1b80e92f..74de137d0ca 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -133,11 +133,11 @@ if ($action == 'delete') { if (!empty($id)) { - $classname = "MailingTargets"; - $obj = new $classname($db); - $obj->update_nb($id); - - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); + $classname = "MailingTargets"; + $obj = new $classname($db); + $obj->update_nb($id); + + Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } else diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 924afb99e00..3b3b8caf5b9 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -121,7 +121,7 @@ class Mailing extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error=$this->db->lasterror(); dol_syslog("Mailing::Create ".$this->error, LOG_ERR); $this->db->rollback(); return -1; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 7a8dc3d0c30..a8064da19f3 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -41,11 +41,11 @@ $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $urlfrom=GETPOST('urlfrom'); -$mesg=''; -if (isset($_SESSION['DolMessage'])) -{ - $mesg=$_SESSION['DolMessage']; - unset($_SESSION['DolMessage']); +$mesg=''; +if (isset($_SESSION['DolMessage'])) +{ + $mesg=$_SESSION['DolMessage']; + unset($_SESSION['DolMessage']); } $object=new Mailing($db); @@ -53,9 +53,9 @@ $result=$object->fetch($id); $extrafields = new ExtraFields($db); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); -$hookmanager=new HookManager($db); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); +$hookmanager=new HookManager($db); $hookmanager->initHooks(array('mailingcard')); // Tableau des substitutions possibles @@ -109,11 +109,11 @@ if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) ); } -/* - * Actions +/* + * Actions */ -$parameters=array(); +$parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks // Action clone object @@ -557,61 +557,61 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel" // Action confirmation validation if ($action == 'confirm_valid' && $confirm == 'yes') -{ - if ($object->id > 0) - { +{ + if ($object->id > 0) + { $object->valid($user); - $_SESSION['DolMessage']='
'.$langs->trans("MailingSuccessfullyValidated").'
'; - - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - dol_print_error($db); + $_SESSION['DolMessage']='
'.$langs->trans("MailingSuccessfullyValidated").'
'; + + Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + dol_print_error($db); } } // Resend if ($action == 'confirm_reset' && $confirm == 'yes') -{ - if ($object->id > 0) - { - $db->begin(); - - $result=$object->valid($user); - if ($result > 0) - { - $result=$object->reset_targets_status($user); - } - - if ($result > 0) - { - $db->commit(); - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - $mesg=$object->error; - $db->rollback(); - } - } - else - { - dol_print_error($db); +{ + if ($object->id > 0) + { + $db->begin(); + + $result=$object->valid($user); + if ($result > 0) + { + $result=$object->reset_targets_status($user); + } + + if ($result > 0) + { + $db->commit(); + Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + $mesg=$object->error; + $db->rollback(); + } + } + else + { + dol_print_error($db); } } // Action confirmation suppression if ($action == 'confirm_delete' && $confirm == 'yes') -{ - if ($object->delete($object->id)) +{ + if ($object->delete($object->id)) { - $url= (! empty($urlfrom) ? $urlfrom : 'liste.php'); - Header("Location: ".$url); - exit; + $url= (! empty($urlfrom) ? $urlfrom : 'liste.php'); + Header("Location: ".$url); + exit; } } @@ -626,7 +626,7 @@ if (! empty($_POST["cancel"])) * View */ -// fetch optionals attributes and labels +// fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label('mailing'); $help_url='EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; @@ -651,18 +651,18 @@ if ($action == 'create') print ''.$langs->trans("MailFrom").''; print ''.$langs->trans("MailErrorsTo").''; - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; - print $extrafields->showInputField($key,$value); - print ''."\n"; - } + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print ''.$label.''; + print $extrafields->showInputField($key,$value); + print ''."\n"; + } } print ''; @@ -809,18 +809,18 @@ else } print ''; - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; - print $extrafields->showInputField($key,$value); - print "\n"; - } + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print ''.$label.''; + print $extrafields->showInputField($key,$value); + print "\n"; + } } print ''; @@ -861,11 +861,11 @@ else //print ''.$langs->trans("PreviewMailing").''; - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send) - { - print ''.$langs->trans("TestMailing").''; - } - else + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send) + { + print ''.$langs->trans("TestMailing").''; + } + else { print ''.$langs->trans("TestMailing").''; } @@ -1043,18 +1043,18 @@ else } print ''; - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''.$label.''; - print $extrafields->showInputField($key,$value); - print "\n"; - } + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print ''.$label.''; + print $extrafields->showInputField($key,$value); + print "\n"; + } } print ''; @@ -1119,9 +1119,9 @@ else // Message print ''.$langs->trans("MailMessage").'
'; print '
'.$langs->trans("CommonSubstitutions").':
'; - foreach($object->substitutionarray as $key => $val) - { - print $key.' = '.$langs->trans($val).'
'; + foreach($object->substitutionarray as $key => $val) + { + print $key.' = '.$langs->trans($val).'
'; } print '
'; print '';