diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index 6bd27da529b..804c2a37a6f 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -431,7 +431,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connection = imap_open($connectstringsource, $object->login, $object->password);
}
- catch(Exception $e)
+ catch (Exception $e)
{
print $e->getMessage();
}
diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php
index 6a719c25b5f..becf50fa7a2 100644
--- a/htdocs/admin/expensereport_rules.php
+++ b/htdocs/admin/expensereport_rules.php
@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","other","trips","errors","dict"));
+$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
if (!$user->admin) accessforbidden();
@@ -96,18 +96,18 @@ if ($action == 'save')
{
$object->setValues($_POST);
- if($apply_to=='U'){
+ if ($apply_to == 'U') {
$object->fk_user = (int) $fk_user;
- $object->fk_usergroup=0;
- $object->is_for_all=0;
- }elseif($apply_to=='G'){
+ $object->fk_usergroup = 0;
+ $object->is_for_all = 0;
+ }elseif ($apply_to == 'G') {
$object->fk_usergroup = (int) $fk_usergroup;
- $object->fk_user=0;
- $object->is_for_all=0;
- }elseif($apply_to=='A'){
- $object->is_for_all=1;
- $object->fk_user=0;
- $object->fk_usergroup=0;
+ $object->fk_user = 0;
+ $object->is_for_all = 0;
+ }elseif ($apply_to == 'A') {
+ $object->is_for_all = 1;
+ $object->fk_user = 0;
+ $object->fk_usergroup = 0;
}
$object->dates = $dates;
@@ -145,12 +145,12 @@ $tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->tr
llxHeader('', $langs->trans("ExpenseReportsSetup"));
-$form=new Form($db);
+$form = new Form($db);
-$linkback=''.$langs->trans("BackToModuleList").'';
+$linkback = ''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"), $linkback, 'title_setup');
-$head=expensereport_admin_prepare_head();
+$head = expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
echo $langs->trans('ExpenseReportRulesDesc');
diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php
index 5f6d52e1169..5eb36b111c8 100644
--- a/htdocs/admin/holiday.php
+++ b/htdocs/admin/holiday.php
@@ -39,7 +39,7 @@ $action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
-$type='contract';
+$type = 'contract';
if (empty($conf->global->HOLIDAY_ADDON))
{
@@ -56,12 +56,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconst = GETPOST('maskconstholiday', 'alpha');
- $maskvalue = GETPOST('maskholiday', 'alpha');
+ $maskvalue = GETPOST('maskholiday', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
- if (! $res > 0) $error++;
+ if (!$res > 0) $error++;
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@@ -73,20 +73,20 @@ if ($action == 'updateMask')
elseif ($action == 'specimen') // For contract
{
- $modele= GETPOST('module', 'alpha');
+ $modele = GETPOST('module', 'alpha');
$holiday = new Holiday($db);
$holiday->initAsSpecimen();
// Search template files
- $file=''; $classname=''; $filefound=0;
- $dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
- foreach($dirmodels as $reldir)
+ $file = ''; $classname = ''; $filefound = 0;
+ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+ foreach ($dirmodels as $reldir)
{
- $file=dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
+ $file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
- $filefound=1;
+ $filefound = 1;
$classname = "pdf_".$modele;
break;
}
@@ -159,15 +159,15 @@ elseif ($action == 'setmod')
elseif ($action == 'set_other')
{
- $freetext= GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string
+ $freetext = GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
- $draft= GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
+ $draft = GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
- if (! $res1 > 0 || ! $res2 > 0) $error++;
+ if (!$res1 > 0 || !$res2 > 0) $error++;
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@@ -182,16 +182,16 @@ elseif ($action == 'set_other')
* View
*/
-$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
+$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader();
-$form=new Form($db);
+$form = new Form($db);
-$linkback=''.$langs->trans("BackToModuleList").'';
+$linkback = ''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans("HolidaySetup"), $linkback, 'title_setup');
-$head=holiday_admin_prepare_head();
+$head = holiday_admin_prepare_head();
dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
@@ -222,18 +222,18 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
- while (($file = readdir($handle))!==false)
+ while (($file = readdir($handle)) !== false)
{
- if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php')
+ if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
{
- $file = substr($file, 0, dol_strlen($file)-4);
+ $file = substr($file, 0, dol_strlen($file) - 4);
require_once $dir.$file.'.php';
$module = new $file($db);
// Show modules according to features level
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
@@ -244,9 +244,9 @@ foreach ($dirmodels as $reldir)
// Show example of numbering model
print '
';
- $tmp=$module->getExample();
+ $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print ' '.$langs->trans($tmp).' '; }
- elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
+ elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print ' | '."\n";
@@ -263,21 +263,21 @@ foreach ($dirmodels as $reldir)
}
print '';
- $holiday=new Holiday($db);
+ $holiday = new Holiday($db);
$holiday->initAsSpecimen();
// Info
- $htmltooltip='';
- $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
';
- $nextval=$module->getNextValue($mysoc, $holiday);
+ $htmltooltip = '';
+ $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
';
+ $nextval = $module->getNextValue($mysoc, $holiday);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
- $htmltooltip.=''.$langs->trans("NextValue").': ';
+ $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
- if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
+ if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
- $htmltooltip.=$nextval.'
';
+ $htmltooltip .= $nextval.'
';
} else {
- $htmltooltip.=$langs->trans($module->error).'
';
+ $htmltooltip .= $langs->trans($module->error).'
';
}
}
@@ -317,14 +317,14 @@ print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
// Defined model definition table
$def = array();
$sql = "SELECT nom";
-$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
-$sql.= " WHERE type = '".$type."'";
-$sql.= " AND entity = ".$conf->entity;
-$resql=$db->query($sql);
+$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
+$sql .= " WHERE type = '".$type."'";
+$sql .= " AND entity = ".$conf->entity;
+$resql = $db->query($sql);
if ($resql)
{
$i = 0;
- $num_rows=$db->num_rows($resql);
+ $num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
@@ -353,42 +353,42 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
- foreach (array('','/doc') as $valdir)
+ foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
if (is_dir($dir))
{
- $handle=opendir($dir);
+ $handle = opendir($dir);
if (is_resource($handle))
{
- while (($file = readdir($handle))!==false)
+ while (($file = readdir($handle)) !== false)
{
- $filelist[]=$file;
+ $filelist[] = $file;
}
closedir($handle);
arsort($filelist);
- foreach($filelist as $file)
+ foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
- $name = substr($file, 4, dol_strlen($file) -16);
- $classname = substr($file, 0, dol_strlen($file) -12);
+ $name = substr($file, 4, dol_strlen($file) - 16);
+ $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
- $modulequalified=1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
+ $modulequalified = 1;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '| ';
- print (empty($module->name)?$name:$module->name);
+ print (empty($module->name) ? $name : $module->name);
print " | \n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
@@ -423,18 +423,18 @@ foreach ($dirmodels as $reldir)
print ' | ';
// Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
- $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
- $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
- $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
- $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
- $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
- $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+ $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '';
@@ -485,16 +485,16 @@ print ' | '.$langs->trans("Parameter").' | ';
print ''.$langs->trans("Value").' | ';
print "
\n";
-$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
+$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
+$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = ''.$langs->trans("AvailableVariables").':
';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.'
';
-$htmltext.='';
+foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
';
+$htmltext .= '';
print '';
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'
'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print ' ';
-$variablename='HOLIDAY_FREE_TEXT';
+$variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '';
@@ -502,7 +502,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
+ $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print ' |
'."\n";
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 5f59a198fa4..fb76c3c0676 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -30,23 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors"));
-$action=GETPOST('action', 'alpha');
+$action = GETPOST('action', 'alpha');
-if (! $user->admin) accessforbidden();
+if (!$user->admin) accessforbidden();
-$usersignature=$user->signature;
+$usersignature = $user->signature;
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
if ($action == 'test' || $action == 'send')
{
- $usersignature=dol_string_nohtmltag($usersignature);
+ $usersignature = dol_string_nohtmltag($usersignature);
}
-$substitutionarrayfortest=array(
+$substitutionarrayfortest = array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
-'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'
':'',
-'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''), // Done into actions_sendmails
+'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '
' : '',
+'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__LOGIN__' => 'RecipientLogin',
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
@@ -93,16 +93,16 @@ if ($action == 'update' && empty($_POST["cancel"]))
// Actions to send emails
-$id=0;
-$actiontypecode=''; // Not an event for agenda
-$trigger_name=''; // Disable triggers
-$paramname='id';
-$mode='emailfortest';
-$trackid=(($action == 'testhtml')?"testhtml":"test");
+$id = 0;
+$actiontypecode = ''; // Not an event for agenda
+$trigger_name = ''; // Disable triggers
+$paramname = 'id';
+$mode = 'emailfortest';
+$trackid = (($action == 'testhtml') ? "testhtml" : "test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
-if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
-if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml';
+if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action = 'test';
+if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action = 'testhtml';
@@ -113,18 +113,18 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $
$form = new Form($db);
-$linuxlike=1;
-if (preg_match('/^win/i', PHP_OS)) $linuxlike=0;
-if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0;
+$linuxlike = 1;
+if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0;
+if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0;
-if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
-$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
-if (! $port) $port=25;
-$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:ini_get('SMTP');
-if (! $server) $server='127.0.0.1';
+if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE = 'mail';
+$port = !empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port');
+if (!$port) $port = 25;
+$server = !empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : ini_get('SMTP');
+if (!$server) $server = '127.0.0.1';
-$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
+$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
llxHeader('', $langs->trans("Setup"), $wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
@@ -132,11 +132,11 @@ print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
$head = email_admin_prepare_head();
// List of sending methods
-$listofmethods=array();
-$listofmethods['mail']='PHP mail function';
+$listofmethods = array();
+$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
-$listofmethods['smtps']='SMTP/SMTPS socket library';
-$listofmethods['swiftmailer']='Swift Mailer socket library';
+$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
+$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
if ($action == 'edit')
@@ -267,7 +267,7 @@ if ($action == 'edit')
// Force e-mail recipient
print '| '.$langs->trans("MAIN_MAIL_FORCE_SENDTO").' | ';
- print '';
+ print '';
print ' |
';
@@ -299,7 +299,7 @@ if ($action == 'edit')
// Host server
print '| ';
- if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
+ if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print ' | ';
@@ -307,21 +307,21 @@ if ($action == 'edit')
}
else
{
- $mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'');
- $smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined");
+ $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
+ $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
print ' | ';
// SuperAdministrator access only
- if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
+ if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
- print '';
- print '';
+ print '';
+ print '';
print ''.$langs->trans("SeeLocalSendMailSetup").'';
}
else
{
- $text = ! empty($mainserver) ? $mainserver : $smtpserver;
+ $text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '';
@@ -331,7 +331,7 @@ if ($action == 'edit')
// Port
print ' |
| ';
- if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
+ if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print ' | ';
@@ -339,21 +339,21 @@ if ($action == 'edit')
}
else
{
- $mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
- $smtpport = ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined");
+ $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
+ $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
print ' | ';
// SuperAdministrator access only
- if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
+ if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
- print '';
- print '';
+ print '';
+ print '';
print ''.$langs->trans("SeeLocalSendMailSetup").'';
}
else
{
- $text = (! empty($mainport) ? $mainport : $smtpport);
+ $text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '';
@@ -362,14 +362,14 @@ if ($action == 'edit')
print ' |
';
// ID
- if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
- $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
+ $mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID) ? $conf->global->MAIN_MAIL_SMTPS_ID : '');
print '| '.$langs->trans("MAIN_MAIL_SMTPS_ID").' | ';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
- print '';
+ print '';
}
else
{
@@ -381,16 +381,16 @@ if ($action == 'edit')
}
// PW
- if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
- $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
+ $mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW) ? $conf->global->MAIN_MAIL_SMTPS_PW : '');
print ' |
| ';
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
print ' | ';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
- print '';
+ print '';
}
else
{
@@ -403,11 +403,11 @@ if ($action == 'edit')
// TLS
print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_TLS").' | ';
- if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
if (function_exists('openssl_open'))
{
- print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (! empty($conf->global->MAIN_MAIL_EMAIL_TLS)?$conf->global->MAIN_MAIL_EMAIL_TLS:0), 1);
+ print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
@@ -416,11 +416,11 @@ if ($action == 'edit')
// STARTTLS
print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").' | ';
- if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
if (function_exists('openssl_open'))
{
- print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS)?$conf->global->MAIN_MAIL_EMAIL_STARTTLS:0), 1);
+ print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
@@ -429,11 +429,11 @@ if ($action == 'edit')
// DKIM
print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").' | ';
- if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))))
{
if (function_exists('openssl_open'))
{
- print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED)?$conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED:0), 1);
+ print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
@@ -442,31 +442,31 @@ if ($action == 'edit')
// DKIM Domain
print ' |
| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").' | ';
- print ' |
';
// DKIM Selector
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").' | ';
- print ' |
';
// DKIM PRIVATE KEY
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").' | ';
- print '';
+ print ' | ';
print ' |
';
// Separator
print '| |
';
// From
- print '| '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).' | ';
- print ' | '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' | ';
+ print ' |
';
// Default from type
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
- $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
+ $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
/*
$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$resql = $db->query($sql);
@@ -495,12 +495,12 @@ if ($action == 'edit')
// From
print '| '.$langs->trans("MAIN_MAIL_ERRORS_TO").' | ';
- print ' |
';
// Autocopy to
print '| '.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").' | ';
- print ' |
';
print '';
@@ -527,14 +527,14 @@ else
// Disable
print '| '.$langs->trans("MAIN_DISABLE_ALL_MAILS").' | '.yn($conf->global->MAIN_DISABLE_ALL_MAILS);
- if (! empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
+ if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
print ' |
';
// Force e-mail recipient
print '| '.$langs->trans("MAIN_MAIL_FORCE_SENDTO").' | '.$conf->global->MAIN_MAIL_FORCE_SENDTO;
- if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
+ if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
{
- if (! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
+ if (!isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
}
print ' |
';
@@ -547,8 +547,8 @@ else
// Method
print '| '.$langs->trans("MAIN_MAIL_SENDMODE").' | ';
- $text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
- if (empty($text)) $text=$langs->trans("Undefined").img_warning();
+ $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
+ if (empty($text)) $text = $langs->trans("Undefined").img_warning();
print $text;
print ' |
';
@@ -559,7 +559,7 @@ else
}
else
{
- print '| '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).' | '.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').' |
';
+ print '| '.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').' |
';
}
// Port
@@ -569,7 +569,7 @@ else
}
else
{
- print '| '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).' | '.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').' |
';
+ print '| '.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).' | '.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').' |
';
}
// SMTPS ID
@@ -628,17 +628,17 @@ else
// Domain
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").' | ';
- print '' . $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
+ print ' | '.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
print ' |
';
// Selector
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").' | ';
- print '' . $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
+ print ' | '.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
print ' |
';
// PRIVATE KEY
print '| '.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").' | ';
- print '' . $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
+ print ' | '.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
print ' |
';
}
@@ -646,22 +646,22 @@ else
print '| |
';
// From
- print '| '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).' | ';
+ print '
| '.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' | ';
print ''.$conf->global->MAIN_MAIL_EMAIL_FROM;
- if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
+ if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
print ' |
';
// Default from type
$liste = array();
$liste['user'] = $langs->trans('UserEmail');
- $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')';
- $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
+ $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
+ $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
- $i=0;
- while($i < $num)
+ $i = 0;
+ while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($obj)
@@ -705,16 +705,16 @@ else
// Errors To
print '| '.$langs->trans("MAIN_MAIL_ERRORS_TO").' | ';
print ''.$conf->global->MAIN_MAIL_ERRORS_TO;
- if (! empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail"));
+ if (!empty($conf->global->MAIN_MAIL_ERRORS_TO) && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail"));
print ' |
';
// Autocopy to
print '| '.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").' | ';
print '';
- if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))
+ if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))
{
print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
- if (! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
+ if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
}
else
{
@@ -732,7 +732,7 @@ else
print ''.$langs->trans("Modify").'';
- if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || ! $linuxlike)
+ if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike)
{
if (function_exists('fsockopen') && $port && $server)
{
@@ -746,7 +746,7 @@ else
print ''.$langs->trans("DoTestSend").'';
- if (! empty($conf->fckeditor->enabled))
+ if (!empty($conf->fckeditor->enabled))
{
print ''.$langs->trans("DoTestSendHTML").'';
}
@@ -770,17 +770,17 @@ else
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
- if (! in_array($action, array('testconnect', 'test', 'testhtml')))
+ if (!in_array($action, array('testconnect', 'test', 'testhtml')))
{
$text = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
- $text.= $langs->trans("WarningPHPMail");
+ $text .= $langs->trans("WarningPHPMail");
}
//$conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS='1.2.3.4';
- if (! empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
+ if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
{
- $text.= ($text?' ':'').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
+ $text .= ($text ? ' ' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
}
if ($text) print info_admin($text);
}
@@ -792,7 +792,7 @@ else
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile('', '', '', '');
- $result=$mail->check_server_port($server, $port);
+ $result = $mail->check_server_port($server, $port);
if ($result) print ''.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).' ';
else
{
@@ -811,45 +811,45 @@ else
if ($action == 'test' || $action == 'testhtml')
{
print '';
- print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
+ print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
dol_fiche_head('');
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
- $formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
- $formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
- $formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
- $formmail->fromid=$user->id;
- $formmail->fromalsorobot=1;
- $formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
- $formmail->withfromreadonly=1;
- $formmail->withsubstit=1;
- $formmail->withfrom=1;
- $formmail->witherrorsto=1;
- $formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
- $formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
- $formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
- $formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
- $formmail->withtopicreadonly=0;
- $formmail->withfile=2;
- $formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->transnoentities("PredefinedMailTestHtml"):$langs->transnoentities("PredefinedMailTest")));
- $formmail->withbodyreadonly=0;
- $formmail->withcancel=1;
- $formmail->withdeliveryreceipt=1;
- $formmail->withfckeditor=($action == 'testhtml'?1:0);
- $formmail->ckeditortoolbar='dolibarr_mailings';
+ $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
+ $formmail->fromname = (isset($_POST['fromname']) ? $_POST['fromname'] : $conf->global->MAIN_MAIL_EMAIL_FROM);
+ $formmail->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM);
+ $formmail->fromid = $user->id;
+ $formmail->fromalsorobot = 1;
+ $formmail->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
+ $formmail->withfromreadonly = 1;
+ $formmail->withsubstit = 1;
+ $formmail->withfrom = 1;
+ $formmail->witherrorsto = 1;
+ $formmail->withto = (!empty($_POST['sendto']) ? $_POST['sendto'] : ($user->email ? $user->email : 1));
+ $formmail->withtocc = (!empty($_POST['sendtocc']) ? $_POST['sendtocc'] : 1); // ! empty to keep field if empty
+ $formmail->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty
+ $formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test"));
+ $formmail->withtopicreadonly = 0;
+ $formmail->withfile = 2;
+ $formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
+ $formmail->withbodyreadonly = 0;
+ $formmail->withcancel = 1;
+ $formmail->withdeliveryreceipt = 1;
+ $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
+ $formmail->ckeditortoolbar = 'dolibarr_mailings';
// Tableau des substitutions
- $formmail->substit=$substitutionarrayfortest;
+ $formmail->substit = $substitutionarrayfortest;
// Tableau des parametres complementaires du post
- $formmail->param["action"]="send";
- $formmail->param["models"]="body";
- $formmail->param["mailid"]=0;
- $formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
+ $formmail->param["action"] = "send";
+ $formmail->param["models"] = "body";
+ $formmail->param["mailid"] = 0;
+ $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files
- if (GETPOST("mode", "aZ09")=='init')
+ if (GETPOST("mode", "aZ09") == 'init')
{
$formmail->clear_attached_files();
}
diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php
index 72ad45921d5..0dfdc9362ed 100644
--- a/htdocs/api/class/api_setup.class.php
+++ b/htdocs/api/class/api_setup.class.php
@@ -1327,6 +1327,20 @@ class Setup extends DolibarrApi
return $list;
}
+ /**
+ * Get properties of company
+ *
+ * @url GET /company
+ *
+ * @return array|mixed Data without useless information
+ *
+ */
+ public function getCompany()
+ {
+ global $mysoc;
+
+ return $this->_cleanObjectDatas($mysoc);
+ }
/**
* Do a test of integrity for files and setup.
diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index 8e0afc77d0a..af41824fa08 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -32,32 +32,32 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("mrp","other"));
+$langs->loadLangs(array("mrp", "other"));
// Get parameters
-$id = GETPOST('id', 'int');
+$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'alpha');
+$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array'))
{
- $actioncode=GETPOST('actioncode', 'array', 3);
- if (! count($actioncode)) $actioncode='0';
+ $actioncode = GETPOST('actioncode', 'array', 3);
+ if (!count($actioncode)) $actioncode = '0';
}
else
{
- $actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
+ $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
-$search_agenda_label=GETPOST('search_agenda_label');
+$search_agenda_label = GETPOST('search_agenda_label');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 252caa8da10..75f87067a4e 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -625,28 +625,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{
- print '' . $langs->trans("Disable") . '';
+ print ''.$langs->trans("Disable").'';
}
// Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{
- print '' . $langs->trans("ReOpen") . '';
+ print ''.$langs->trans("ReOpen").'';
}
// Create MO
if ($conf->mrp->enabled)
{
- if ($object->status == $object::STATUS_VALIDATED && ! empty($user->rights->mrp->write))
+ if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
{
- print 'id).'">' . $langs->trans("CreateMO") . '';
+ print 'id).'">'.$langs->trans("CreateMO").'';
}
}
// Clone
if ($permissiontoadd)
{
- print '' . $langs->trans("ToClone") . '';
+ print ''.$langs->trans("ToClone").'';
}
/*
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index 47a31f11a72..68be93f7ed1 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -745,7 +745,7 @@ if ($socid > 0)
$sql .= " , ".MAIN_DB_PREFIX."facturedet as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
- $sql .= " WHERE rc.fk_soc =". $object->id;
+ $sql .= " WHERE rc.fk_soc =".$object->id;
$sql .= " AND rc.fk_facture_line = fc.rowid";
$sql .= " AND fc.fk_facture = f.rowid";
$sql .= " AND rc.fk_user = u.rowid";
@@ -763,7 +763,7 @@ if ($socid > 0)
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
- $sql2 .= " WHERE rc.fk_soc =". $object->id;
+ $sql2 .= " WHERE rc.fk_soc =".$object->id;
$sql2 .= " AND rc.fk_facture = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 0"; // Eliminate supplier discounts
@@ -920,7 +920,7 @@ if ($socid > 0)
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn_det as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
- $sql .= " WHERE rc.fk_soc =". $object->id;
+ $sql .= " WHERE rc.fk_soc =".$object->id;
$sql .= " AND rc.fk_invoice_supplier_line = fc.rowid";
$sql .= " AND fc.fk_facture_fourn = f.rowid";
$sql .= " AND rc.fk_user = u.rowid";
@@ -938,7 +938,7 @@ if ($socid > 0)
$sql2 .= " , ".MAIN_DB_PREFIX."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fa ON rc.fk_invoice_supplier_source = fa.rowid";
- $sql2 .= " WHERE rc.fk_soc =". $object->id;
+ $sql2 .= " WHERE rc.fk_soc =".$object->id;
$sql2 .= " AND rc.fk_invoice_supplier = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 1"; // Eliminate customer discounts
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index 0f0c3d11386..fbcd06a51bc 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -31,22 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories'));
-$WIDTH=DolGraph::getDefaultGraphSizeForStats('width', 768);
-$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height', 200);
+$WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
+$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
// Security check
if (isset($_GET["account"]) || isset($_GET["ref"]))
{
- $id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:'');
+ $id = isset($_GET["account"]) ? $_GET["account"] : (isset($_GET["ref"]) ? $_GET["ref"] : '');
}
-$fieldid = isset($_GET["ref"])?'ref':'rowid';
-if ($user->socid) $socid=$user->socid;
-$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
+$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
+if ($user->socid) $socid = $user->socid;
+$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
-$account=GETPOST("account");
-$mode='standard';
-if (GETPOST("mode") == 'showalltime') $mode='showalltime';
-$error=0;
+$account = GETPOST("account");
+$mode = 'standard';
+if (GETPOST("mode") == 'showalltime') $mode = 'showalltime';
+$error = 0;
/*
@@ -63,22 +63,22 @@ $datetime = dol_now();
$year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d");
-if (GETPOST("year")) $year=sprintf("%04d", GETPOST("year"));
-if (GETPOST("month")) $month=sprintf("%02d", GETPOST("month"));
+if (GETPOST("year")) $year = sprintf("%04d", GETPOST("year"));
+if (GETPOST("month")) $month = sprintf("%02d", GETPOST("month"));
$object = new Account($db);
-if ($_GET["account"] && ! preg_match('/,/', $_GET["account"])) // if for a particular account and not a list
+if ($_GET["account"] && !preg_match('/,/', $_GET["account"])) // if for a particular account and not a list
{
- $result=$object->fetch(GETPOST("account", "int"));
+ $result = $object->fetch(GETPOST("account", "int"));
}
if ($_GET["ref"])
{
- $result=$object->fetch(0, GETPOST("ref"));
- $account=$object->id;
+ $result = $object->fetch(0, GETPOST("ref"));
+ $account = $object->id;
}
-$result=dol_mkdir($conf->bank->dir_temp);
+$result = dol_mkdir($conf->bank->dir_temp);
if ($result < 0)
{
$langs->load("errors");
@@ -89,11 +89,11 @@ else
{
// Calcul $min and $max
$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql);
if ($resql)
@@ -109,7 +109,7 @@ else
}
if (empty($min)) $min = dol_now() - 3600 * 24;
- $log="graph.php: min=".$min." max=".$max;
+ $log = "graph.php: min=".$min." max=".$max;
dol_syslog($log);
@@ -120,24 +120,24 @@ else
// Loading table $amounts
$amounts = array();
- $monthnext = $month+1;
+ $monthnext = $month + 1;
$yearnext = $year;
if ($monthnext > 12)
{
- $monthnext=1;
+ $monthnext = 1;
$yearnext++;
}
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
- $sql.= ", SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
- $sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
- $sql.= " GROUP BY date_format(b.datev,'%Y%m%d')";
+ $sql .= ", SUM(b.amount)";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
+ $sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
+ $sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql);
if ($resql)
@@ -161,12 +161,12 @@ else
$solde = 0;
$sql = "SELECT SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql);
if ($resql)
@@ -225,36 +225,36 @@ else
//exit;
// Fabrication tableau 1
- $file= $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png";
- $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png";
- $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
- $graph_datas=array();
- foreach($datas as $i => $val)
+ $file = $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png";
+ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.$month.".png";
+ $title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
+ $graph_datas = array();
+ foreach ($datas as $i => $val)
{
- $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
+ $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
}
$px1 = new DolGraph();
$px1->SetData($graph_datas);
- $arraylegends=array($langs->transnoentities("Balance"));
+ $arraylegends = array($langs->transnoentities("Balance"));
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px1->SetLegend($arraylegends);
$px1->SetLegendWidthMin(180);
- $px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
- $px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue());
+ $px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
+ $px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
$px1->SetTitle($title);
$px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT);
- $px1->SetType(array('lines','lines','lines'));
+ $px1->SetType(array('lines', 'lines', 'lines'));
$px1->setBgColor('onglet');
- $px1->setBgColorGrid(array(255,255,255));
+ $px1->setBgColorGrid(array(255, 255, 255));
$px1->SetHorizTickIncrement(1);
$px1->draw($file, $fileurl);
- $show1=$px1->show();
+ $show1 = $px1->show();
unset($graph_datas);
unset($px1);
unset($datas);
@@ -271,14 +271,14 @@ else
// Loading table $amounts
$amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
- $sql.= ", SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
- $sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= ", SUM(b.amount)";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
+ $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql);
@@ -303,12 +303,12 @@ else
$solde = 0;
$sql = "SELECT SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev < '".$year."-01-01'";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev < '".$year."-01-01'";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql);
if ($resql)
@@ -361,36 +361,36 @@ else
}
// Fabrication tableau 2
- $file= $conf->bank->dir_temp."/balance".$account."-".$year.".png";
- $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png";
- $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
- $graph_datas=array();
- foreach($datas as $i => $val)
+ $file = $conf->bank->dir_temp."/balance".$account."-".$year.".png";
+ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account."-".$year.".png";
+ $title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
+ $graph_datas = array();
+ foreach ($datas as $i => $val)
{
- $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
+ $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
}
$px2 = new DolGraph();
$px2->SetData($graph_datas);
- $arraylegends=array($langs->transnoentities("Balance"));
+ $arraylegends = array($langs->transnoentities("Balance"));
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px2->SetLegend($arraylegends);
$px2->SetLegendWidthMin(180);
- $px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
- $px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue());
+ $px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
+ $px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
$px2->SetTitle($title);
$px2->SetWidth($WIDTH);
$px2->SetHeight($HEIGHT);
- $px2->SetType(array('linesnopoint','linesnopoint','linesnopoint'));
+ $px2->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
$px2->setBgColor('onglet');
- $px2->setBgColorGrid(array(255,255,255));
+ $px2->setBgColorGrid(array(255, 255, 255));
$px2->SetHideXGrid(true);
//$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
$px2->draw($file, $fileurl);
- $show2=$px2->show();
+ $show2 = $px2->show();
unset($px2);
unset($graph_datas);
@@ -409,13 +409,13 @@ else
$amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')";
- $sql.= ", SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
- $sql.= " GROUP BY date_format(b.datev,'%Y%m%d')";
+ $sql .= ", SUM(b.amount)";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
+ $sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql);
if ($resql)
@@ -447,20 +447,20 @@ else
$subtotal = 0;
$day = $min;
- $textdate=strftime("%Y%m%d", $day);
+ $textdate = strftime("%Y%m%d", $day);
//print "x".$textdate;
$i = 0;
- while ($day <= ($max+86400)) // On va au dela du dernier jour
+ while ($day <= ($max + 86400)) // On va au dela du dernier jour
{
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n ";
- if ($day > ($max+86400))
+ if ($day > ($max + 86400))
{
$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
}
else
{
- $datas[$i] = '' + $solde + $subtotal;
+ $datas[$i] = '' +$solde + $subtotal;
}
$datamin[$i] = $object->min_desired;
$dataall[$i] = $object->min_allowed;
@@ -470,40 +470,40 @@ else
}
$day += 86400;
- $textdate=strftime("%Y%m%d", $day);
+ $textdate = strftime("%Y%m%d", $day);
$i++;
}
// Fabrication tableau 3
- $file= $conf->bank->dir_temp."/balance".$account.".png";
- $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
- $title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
- $graph_datas=array();
- foreach($datas as $i => $val)
+ $file = $conf->bank->dir_temp."/balance".$account.".png";
+ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
+ $title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
+ $graph_datas = array();
+ foreach ($datas as $i => $val)
{
- $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
+ $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] : '', $datas[$i]);
if ($object->min_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
}
$px3 = new DolGraph();
$px3->SetData($graph_datas);
- $arraylegends=array($langs->transnoentities("Balance"));
+ $arraylegends = array($langs->transnoentities("Balance"));
if ($object->min_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px3->SetLegend($arraylegends);
$px3->SetLegendWidthMin(180);
- $px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue());
- $px3->SetMinValue($px3->GetFloorMinValue()>0?0:$px3->GetFloorMinValue());
+ $px3->SetMaxValue($px3->GetCeilMaxValue() < 0 ? 0 : $px3->GetCeilMaxValue());
+ $px3->SetMinValue($px3->GetFloorMinValue() > 0 ? 0 : $px3->GetFloorMinValue());
$px3->SetTitle($title);
$px3->SetWidth($WIDTH);
$px3->SetHeight($HEIGHT);
- $px3->SetType(array('linesnopoint','linesnopoint','linesnopoint'));
+ $px3->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
$px3->setBgColor('onglet');
- $px3->setBgColorGrid(array(255,255,255));
+ $px3->setBgColorGrid(array(255, 255, 255));
$px3->draw($file, $fileurl);
- $show3=$px3->show();
+ $show3 = $px3->show();
unset($px3);
unset($graph_datas);
@@ -522,25 +522,25 @@ else
$credits = array();
$debits = array();
- $monthnext = $month+1;
+ $monthnext = $month + 1;
$yearnext = $year;
if ($monthnext > 12)
{
- $monthnext=1;
+ $monthnext = 1;
$yearnext++;
}
$sql = "SELECT date_format(b.datev,'%d')";
- $sql.= ", SUM(b.amount)";
+ $sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
- $sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
- $sql.= " AND b.amount > 0";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
- $sql.= " GROUP BY date_format(b.datev,'%d')";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
+ $sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
+ $sql .= " AND b.amount > 0";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
+ $sql .= " GROUP BY date_format(b.datev,'%d')";
$resql = $db->query($sql);
if ($resql)
@@ -560,24 +560,24 @@ else
dol_print_error($db);
}
- $monthnext = $month+1;
+ $monthnext = $month + 1;
$yearnext = $year;
if ($monthnext > 12)
{
- $monthnext=1;
+ $monthnext = 1;
$yearnext++;
}
$sql = "SELECT date_format(b.datev,'%d')";
- $sql.= ", SUM(b.amount)";
+ $sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
- $sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
- $sql.= " AND b.amount < 0";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
+ $sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
+ $sql .= " AND b.amount < 0";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%d')";
$resql = $db->query($sql);
@@ -599,40 +599,40 @@ else
$labels = array();
$data_credit = array();
$data_debit = array();
- for ($i = 0 ; $i < 31 ; $i++)
+ for ($i = 0; $i < 31; $i++)
{
- $data_credit[$i] = isset($credits[substr("0".($i+1), -2)]) ? $credits[substr("0".($i+1), -2)] : 0;
- $data_debit[$i] = isset($debits[substr("0".($i+1), -2)]) ? $debits[substr("0".($i+1), -2)] : 0;
- $labels[$i] = sprintf("%02d", $i+1);
+ $data_credit[$i] = isset($credits[substr("0".($i + 1), -2)]) ? $credits[substr("0".($i + 1), -2)] : 0;
+ $data_debit[$i] = isset($debits[substr("0".($i + 1), -2)]) ? $debits[substr("0".($i + 1), -2)] : 0;
+ $labels[$i] = sprintf("%02d", $i + 1);
$datamin[$i] = $object->min_desired;
}
// Fabrication tableau 4a
- $file= $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png";
- $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png";
- $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
- $graph_datas=array();
- foreach($data_credit as $i => $val)
+ $file = $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png";
+ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.$month.".png";
+ $title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
+ $graph_datas = array();
+ foreach ($data_credit as $i => $val)
{
- $graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
+ $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
}
$px4 = new DolGraph();
$px4->SetData($graph_datas);
- $px4->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
+ $px4->SetLegend(array($langs->transnoentities("Credit"), $langs->transnoentities("Debit")));
$px4->SetLegendWidthMin(180);
- $px4->SetMaxValue($px4->GetCeilMaxValue()<0?0:$px4->GetCeilMaxValue());
- $px4->SetMinValue($px4->GetFloorMinValue()>0?0:$px4->GetFloorMinValue());
+ $px4->SetMaxValue($px4->GetCeilMaxValue() < 0 ? 0 : $px4->GetCeilMaxValue());
+ $px4->SetMinValue($px4->GetFloorMinValue() > 0 ? 0 : $px4->GetFloorMinValue());
$px4->SetTitle($title);
$px4->SetWidth($WIDTH);
$px4->SetHeight($HEIGHT);
- $px4->SetType(array('bars','bars'));
+ $px4->SetType(array('bars', 'bars'));
$px4->SetShading(3);
$px4->setBgColor('onglet');
- $px4->setBgColorGrid(array(255,255,255));
+ $px4->setBgColorGrid(array(255, 255, 255));
$px4->SetHorizTickIncrement(1);
$px4->draw($file, $fileurl);
- $show4=$px4->show();
+ $show4 = $px4->show();
unset($graph_datas);
unset($px4);
@@ -648,15 +648,15 @@ else
$credits = array();
$debits = array();
$sql = "SELECT date_format(b.datev,'%m')";
- $sql.= ", SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
- $sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
- $sql.= " AND b.amount > 0";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= ", SUM(b.amount)";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
+ $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
+ $sql .= " AND b.amount > 0";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%m');";
$resql = $db->query($sql);
@@ -677,15 +677,15 @@ else
dol_print_error($db);
}
$sql = "SELECT date_format(b.datev,'%m')";
- $sql.= ", SUM(b.amount)";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
- $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.fk_account = ba.rowid";
- $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
- $sql.= " AND b.datev >= '".$year."-01-01 00:00:00'";
- $sql.= " AND b.datev <= '".$year."-12-31 23:59:59'";
- $sql.= " AND b.amount < 0";
- if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")";
+ $sql .= ", SUM(b.amount)";
+ $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+ $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
+ $sql .= " WHERE b.fk_account = ba.rowid";
+ $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
+ $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
+ $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
+ $sql .= " AND b.amount < 0";
+ if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%m')";
$resql = $db->query($sql);
@@ -707,40 +707,40 @@ else
$labels = array();
$data_credit = array();
$data_debit = array();
- for ($i = 0 ; $i < 12 ; $i++)
+ for ($i = 0; $i < 12; $i++)
{
- $data_credit[$i] = isset($credits[substr("0".($i+1), -2)]) ? $credits[substr("0".($i+1), -2)] : 0;
- $data_debit[$i] = isset($debits[substr("0".($i+1), -2)]) ? $debits[substr("0".($i+1), -2)] : 0;
- $labels[$i] = dol_print_date(dol_mktime(12, 0, 0, $i+1, 1, 2000), "%b");
+ $data_credit[$i] = isset($credits[substr("0".($i + 1), -2)]) ? $credits[substr("0".($i + 1), -2)] : 0;
+ $data_debit[$i] = isset($debits[substr("0".($i + 1), -2)]) ? $debits[substr("0".($i + 1), -2)] : 0;
+ $labels[$i] = dol_print_date(dol_mktime(12, 0, 0, $i + 1, 1, 2000), "%b");
$datamin[$i] = $object->min_desired;
}
// Fabrication tableau 4b
- $file= $conf->bank->dir_temp."/movement".$account."-".$year.".png";
- $fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png";
- $title=$langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
- $graph_datas=array();
- foreach($data_credit as $i => $val)
+ $file = $conf->bank->dir_temp."/movement".$account."-".$year.".png";
+ $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/movement".$account."-".$year.".png";
+ $title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
+ $graph_datas = array();
+ foreach ($data_credit as $i => $val)
{
- $graph_datas[$i]=array($labels[$i],$data_credit[$i],$data_debit[$i]);
+ $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
}
$px5 = new DolGraph();
$px5->SetData($graph_datas);
- $px5->SetLegend(array($langs->transnoentities("Credit"),$langs->transnoentities("Debit")));
+ $px5->SetLegend(array($langs->transnoentities("Credit"), $langs->transnoentities("Debit")));
$px5->SetLegendWidthMin(180);
- $px5->SetMaxValue($px5->GetCeilMaxValue()<0?0:$px5->GetCeilMaxValue());
- $px5->SetMinValue($px5->GetFloorMinValue()>0?0:$px5->GetFloorMinValue());
+ $px5->SetMaxValue($px5->GetCeilMaxValue() < 0 ? 0 : $px5->GetCeilMaxValue());
+ $px5->SetMinValue($px5->GetFloorMinValue() > 0 ? 0 : $px5->GetFloorMinValue());
$px5->SetTitle($title);
$px5->SetWidth($WIDTH);
$px5->SetHeight($HEIGHT);
- $px5->SetType(array('bars','bars'));
+ $px5->SetType(array('bars', 'bars'));
$px5->SetShading(3);
$px5->setBgColor('onglet');
- $px5->setBgColorGrid(array(255,255,255));
+ $px5->setBgColorGrid(array(255, 255, 255));
$px5->SetHorizTickIncrement(1);
$px5->draw($file, $fileurl);
- $show5=$px5->show();
+ $show5 = $px5->show();
unset($graph_datas);
unset($px5);
@@ -751,7 +751,7 @@ else
// Onglets
-$head=bank_prepare_head($object);
+$head = bank_prepare_head($object);
dol_fiche_head($head, 'graph', $langs->trans("FinancialAccount"), 0, 'account');
@@ -759,32 +759,32 @@ $linkback = ''.$langs->trans("ShowAllAccounts").'';
+ $morehtml = ''.$langs->trans("ShowAllAccounts").'';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1);
}
else
{
- $morehtml=''.$langs->trans("BackToAccount").'';
+ $morehtml = ''.$langs->trans("BackToAccount").'';
print $langs->trans("AllAccounts");
//print $morehtml;
}
}
else
{
- $bankaccount=new Account($db);
- $listid=explode(',', $account);
- foreach($listid as $key => $id)
+ $bankaccount = new Account($db);
+ $listid = explode(',', $account);
+ foreach ($listid as $key => $id)
{
$bankaccount->fetch($id);
- $bankaccount->label=$bankaccount->ref;
+ $bankaccount->label = $bankaccount->ref;
print $bankaccount->getNomUrl(1);
- if ($key < (count($listid)-1)) print ', ';
+ if ($key < (count($listid) - 1)) print ', ';
}
}
}
@@ -818,13 +818,13 @@ print '
|
';
// Graphs
if ($mode == 'standard')
{
- $prevyear=$year; $nextyear=$year;
- $prevmonth=$month-1;$nextmonth=$month+1;
- if ($prevmonth < 1) { $prevmonth=12; $prevyear--; }
- if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
+ $prevyear = $year; $nextyear = $year;
+ $prevmonth = $month - 1; $nextmonth = $month + 1;
+ if ($prevmonth < 1) { $prevmonth = 12; $prevyear--; }
+ if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
// For month
- $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"')."";
+ $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"')."";
print '| '.$link.' |
';
print '| ';
@@ -837,8 +837,8 @@ if ($mode == 'standard')
print ' |
';
// For year
- $prevyear=$year-1;$nextyear=$year+1;
- $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"')."";
+ $prevyear = $year - 1; $nextyear = $year + 1;
+ $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"')."";
print '| '.$link.' |
';
print '| ';
diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php
index d279041e2af..81c2a10ba13 100644
--- a/htdocs/compta/bank/various_payment/list.php
+++ b/htdocs/compta/bank/various_payment/list.php
@@ -154,12 +154,10 @@ if ($result)
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
- $newcardbutton='';
+ $newcardbutton = '';
if ($user->rights->banque->modifier)
{
- $newcardbutton=''.$langs->trans('MenuNewVariousPayment').'';
- $newcardbutton.= '';
- $newcardbutton.= '';
+ $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create');
}
print ' | ' ;
+ print ' | ';
- print " | ";
+ if (! $i) $totalarray['nbfield']++;
+
+ print "
\n";
$i++;
}
- $colspan = 4;
- if (!empty($conf->banque->enabled)) $colspan++;
- if (!empty($conf->accounting->enabled)) $colspan++;
-
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 1ac766a4e34..b7ee278f02c 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -171,9 +171,7 @@ if ($resql)
$newcardbutton = '';
if ($user->rights->tax->charges->creer)
{
- $newcardbutton = ''.$langs->trans('MenuNewSocialContribution').'';
- $newcardbutton .= '';
- $newcardbutton .= '';
+ $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
}
print '