Merge remote-tracking branch 'upstream/develop' into actioncomm_category

This commit is contained in:
Frédéric FRANCE 2019-12-01 16:10:37 +01:00
commit 25ed2b930f
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
229 changed files with 4034 additions and 117118 deletions

View File

@ -207,6 +207,29 @@ Following changes may create regressions for some external modules, but were nec
* The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core. * The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core.
***** ChangeLog for 10.0.4 compared to 10.0.3 *****
FIX: The pdf templates were using the large logo making PDF too large (and edition of proposal, order, invoice VERY slow)
FIX: #12258
FIX: #12319 Restore feature ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC.
FIX: #12356
FIX: #12372
FIX: #12385
FIX: Advisory ID: usd20190053
FIX: Advisory ID: usd20190067
FIX: Avoid fatal error when creating thumb from PDF
FIX: compatibility with Multicompany
FIX: display job of contact list
FIX: Extrafields missing in export of expense report
FIX: Hook getAccessForbiddenMessage was missing parameters
FIX: limit 20 prevent to see all products/services
FIX: Search on leave request ref
FIX: security check. A user can see holiday with link without permissions
FIX: Set unpaid of expense report
FIX: shipping extrafields line
FIX: the SELECT examine more than MAX_JOIN_SIZE rows #12305
FIX: triggers: directories read with opendir() never closed
FIX: we need to be able to recalculate tva only if invoice not in accountancy
FIX: wrong invoice id for fetchObjetctLinked
***** ChangeLog for 10.0.3 compared to 10.0.2 ***** ***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.

View File

@ -52,6 +52,21 @@ Replace call to serialize_val with no bugged value
TCPDF: TCPDF:
------ ------
* Replace in tcpdf.php:
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
unlink($file);
}
}
with
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
// unlink($file);
}
}
* To avoid to have QRcode changed because generated with a random mask, replace * To avoid to have QRcode changed because generated with a random mask, replace
define('QR_FIND_FROM_RANDOM', 2); define('QR_FIND_FROM_RANDOM', 2);
with with

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -412,7 +412,7 @@ if ($user->rights->adherent->creer)
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';

View File

@ -398,7 +398,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader); $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
if ($result < 0) if ($result < 0)
{ {
$errmsg = $object->error; $errmsg = $object->error;

View File

@ -431,7 +431,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connection = imap_open($connectstringsource, $object->login, $object->password); $connection = imap_open($connectstringsource, $object->login, $object->password);
} }
catch(Exception $e) catch (Exception $e)
{ {
print $e->getMessage(); print $e->getMessage();
} }

View File

@ -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'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
// Load translation files required by the page // 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(); if (!$user->admin) accessforbidden();
@ -96,18 +96,18 @@ if ($action == 'save')
{ {
$object->setValues($_POST); $object->setValues($_POST);
if($apply_to=='U'){ if ($apply_to == 'U') {
$object->fk_user = (int) $fk_user; $object->fk_user = (int) $fk_user;
$object->fk_usergroup=0; $object->fk_usergroup = 0;
$object->is_for_all=0; $object->is_for_all = 0;
}elseif($apply_to=='G'){ }elseif ($apply_to == 'G') {
$object->fk_usergroup = (int) $fk_usergroup; $object->fk_usergroup = (int) $fk_usergroup;
$object->fk_user=0; $object->fk_user = 0;
$object->is_for_all=0; $object->is_for_all = 0;
}elseif($apply_to=='A'){ }elseif ($apply_to == 'A') {
$object->is_for_all=1; $object->is_for_all = 1;
$object->fk_user=0; $object->fk_user = 0;
$object->fk_usergroup=0; $object->fk_usergroup = 0;
} }
$object->dates = $dates; $object->dates = $dates;
@ -145,12 +145,12 @@ $tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->tr
llxHeader('', $langs->trans("ExpenseReportsSetup")); llxHeader('', $langs->trans("ExpenseReportsSetup"));
$form=new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"), $linkback, 'title_setup'); 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'); dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
echo $langs->trans('ExpenseReportRulesDesc'); echo $langs->trans('ExpenseReportRulesDesc');

View File

@ -39,7 +39,7 @@ $action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha'); $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha');
$type='contract'; $type = 'contract';
if (empty($conf->global->HOLIDAY_ADDON)) if (empty($conf->global->HOLIDAY_ADDON))
{ {
@ -56,12 +56,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst = GETPOST('maskconstholiday', 'alpha'); $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 ($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'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -73,20 +73,20 @@ if ($action == 'updateMask')
elseif ($action == 'specimen') // For contract elseif ($action == 'specimen') // For contract
{ {
$modele= GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$holiday = new Holiday($db); $holiday = new Holiday($db);
$holiday->initAsSpecimen(); $holiday->initAsSpecimen();
// Search template files // Search template files
$file=''; $classname=''; $filefound=0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir) 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)) if (file_exists($file))
{ {
$filefound=1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
@ -159,15 +159,15 @@ elseif ($action == 'setmod')
elseif ($action == 'set_other') 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); $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); $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'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -182,16 +182,16 @@ elseif ($action == 'set_other')
* View * View
*/ */
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader(); llxHeader();
$form=new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("HolidaySetup"), $linkback, 'title_setup'); 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'); dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
@ -222,18 +222,18 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) 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'; require_once $dir.$file.'.php';
$module = new $file($db); $module = new $file($db);
// Show modules according to features level // 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->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
@ -244,9 +244,9 @@ foreach ($dirmodels as $reldir)
// Show example of numbering model // Show example of numbering model
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp=$module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; }
elseif ($tmp=='NotConfigured') print $langs->trans($tmp); elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@ -263,21 +263,21 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
$holiday=new Holiday($db); $holiday = new Holiday($db);
$holiday->initAsSpecimen(); $holiday->initAsSpecimen();
// Info // Info
$htmltooltip=''; $htmltooltip = '';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc, $holiday); $nextval = $module->getNextValue($mysoc, $holiday);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
@ -317,14 +317,14 @@ print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
// Defined model definition table // Defined model definition table
$def = array(); $def = array();
$sql = "SELECT nom"; $sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'"; $sql .= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num_rows=$db->num_rows($resql); $num_rows = $db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
@ -353,42 +353,42 @@ clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
foreach (array('','/doc') as $valdir) foreach (array('', '/doc') as $valdir)
{ {
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir); $dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle)) !== false)
{ {
$filelist[]=$file; $filelist[] = $file;
} }
closedir($handle); closedir($handle);
arsort($filelist); arsort($filelist);
foreach($filelist as $file) foreach ($filelist as $file)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db); $module = new $classname($db);
$modulequalified=1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; 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 ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified) if ($modulequalified)
{ {
print '<tr class="oddeven"><td width="100">'; print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description; else print $module->description;
@ -423,18 +423,18 @@ foreach ($dirmodels as $reldir)
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
} }
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td align="center">'; print '<td align="center">';
@ -485,16 +485,16 @@ print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>'; print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>'; $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>'; foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
$htmltext.='</i>'; $htmltext .= '</i>';
print '<tr class="oddeven"><td colspan="2">'; print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>'; print '<br>';
$variablename='HOLIDAY_FREE_TEXT'; $variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
@ -502,7 +502,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
else else
{ {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 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 $doleditor->Create();
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -67,9 +67,12 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
} }
} }
print '<span class="opacitymedium">';
print $langs->trans("SetupDescription1"); print $langs->trans("SetupDescription1");
print $langs->trans("AreaForAdminOnly").' '; print $langs->trans("AreaForAdminOnly").' ';
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>"; print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
print '</span>';
print "<br><br>";
print '<br>'; print '<br>';

View File

@ -30,23 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors")); $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. // 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') 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, '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__' => 'RecipientIdRecord', '__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'', '__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''), // Done into actions_sendmails '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__LOGIN__' => 'RecipientLogin', '__LOGIN__' => 'RecipientLogin',
'__LASTNAME__' => 'RecipientLastname', '__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname', '__FIRSTNAME__' => 'RecipientFirstname',
@ -93,16 +93,16 @@ if ($action == 'update' && empty($_POST["cancel"]))
// Actions to send emails // Actions to send emails
$id=0; $id = 0;
$actiontypecode=''; // Not an event for agenda $actiontypecode = ''; // Not an event for agenda
$trigger_name=''; // Disable triggers $trigger_name = ''; // Disable triggers
$paramname='id'; $paramname = 'id';
$mode='emailfortest'; $mode = 'emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test"); $trackid = (($action == 'testhtml') ? "testhtml" : "test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test'; if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action = 'test';
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml'; if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action = 'testhtml';
@ -113,18 +113,18 @@ if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $
$form = new Form($db); $form = new Form($db);
$linuxlike=1; $linuxlike = 1;
if (preg_match('/^win/i', PHP_OS)) $linuxlike=0; if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0;
if (preg_match('/^mac/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'; 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'); $port = !empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ini_get('smtp_port');
if (! $port) $port=25; if (!$port) $port = 25;
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:ini_get('SMTP'); $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 (!$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); llxHeader('', $langs->trans("Setup"), $wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup'); 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(); $head = email_admin_prepare_head();
// List of sending methods // List of sending methods
$listofmethods=array(); $listofmethods = array();
$listofmethods['mail']='PHP mail function'; $listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class'; //$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps']='SMTP/SMTPS socket library'; $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
$listofmethods['swiftmailer']='Swift Mailer socket library'; $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
if ($action == 'edit') if ($action == 'edit')
@ -267,7 +267,7 @@ if ($action == 'edit')
// Force e-mail recipient // Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>';
print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO)?$conf->global->MAIN_MAIL_FORCE_SENDTO:'') . '" />'; print '<input class="flat" name="MAIN_MAIL_FORCE_SENDTO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_FORCE_SENDTO) ? $conf->global->MAIN_MAIL_FORCE_SENDTO : '').'" />';
print '</td></tr>'; print '</td></tr>';
@ -299,7 +299,7 @@ if ($action == 'edit')
// Host server // Host server
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
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 $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
@ -307,21 +307,21 @@ if ($action == 'edit')
} }
else else
{ {
$mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:''); $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
$smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined"); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver); else print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
print '</td><td>'; print '</td><td>';
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '" autocomplete="off">'; print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="'.$mainserver.'" autocomplete="off">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="'.$mainserver.'">';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} }
else else
{ {
$text = ! empty($mainserver) ? $mainserver : $smtpserver; $text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" value="'.$mainserver.'">';
@ -331,7 +331,7 @@ if ($action == 'edit')
// Port // Port
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
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 $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
@ -339,21 +339,21 @@ if ($action == 'edit')
} }
else else
{ {
$mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); $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"); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport); else print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
print '</td><td>'; print '</td><td>';
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $mainport . '">'; print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $mainport . '">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="'.$mainport.'">';
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} }
else else
{ {
$text = (! empty($mainport) ? $mainport : $smtpport); $text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" value="'.$mainport.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" value="'.$mainport.'">';
@ -362,14 +362,14 @@ if ($action == 'edit')
print '</td></tr>'; print '</td></tr>';
// ID // 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 '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'; print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="' . $mainstmpid . '">'; print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="'.$mainstmpid.'">';
} }
else else
{ {
@ -381,16 +381,16 @@ if ($action == 'edit')
} }
// PW // 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 '<tr class="drag drop oddeven"><td>'; print '<tr class="drag drop oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword")); print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
print '</td><td>'; print '</td><td>';
// SuperAdministrator access only // SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . $mainsmtppw . '" autocomplete="off">'; print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.$mainsmtppw.'" autocomplete="off">';
} }
else else
{ {
@ -403,11 +403,11 @@ if ($action == 'edit')
// TLS // TLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
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')) 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").')'; else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
} }
@ -416,11 +416,11 @@ if ($action == 'edit')
// STARTTLS // STARTTLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
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')) 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").')'; else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
} }
@ -429,11 +429,11 @@ if ($action == 'edit')
// DKIM // DKIM
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
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')) 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").')'; else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
} }
@ -442,31 +442,31 @@ if ($action == 'edit')
// DKIM Domain // DKIM Domain
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN)?$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN:''); print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : '');
print '"></td></tr>'; print '"></td></tr>';
// DKIM Selector // DKIM Selector
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR)?$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR:''); print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : '');
print '"></td></tr>'; print '"></td></tr>';
// DKIM PRIVATE KEY // DKIM PRIVATE KEY
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">' . (! empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY)?$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY:'').'</textarea>'; print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>';
print '</td></tr>'; print '</td></tr>';
// Separator // Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>'; print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_FROM)?$conf->global->MAIN_MAIL_EMAIL_FROM:''); print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
print '"></td></tr>'; print '"></td></tr>';
// Default from type // Default from type
$liste = array(); $liste = array();
$liste['user'] = $langs->trans('UserEmail'); $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'; $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$resql = $db->query($sql); $resql = $db->query($sql);
@ -495,12 +495,12 @@ if ($action == 'edit')
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_ERRORS_TO)?$conf->global->MAIN_MAIL_ERRORS_TO:''); print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? $conf->global->MAIN_MAIL_ERRORS_TO : '');
print '"></td></tr>'; print '"></td></tr>';
// Autocopy to // Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)?$conf->global->MAIN_MAIL_AUTOCOPY_TO:''); print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="'.(!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) ? $conf->global->MAIN_MAIL_AUTOCOPY_TO : '');
print '"></td></tr>'; print '"></td></tr>';
print '</table>'; print '</table>';
@ -527,14 +527,14 @@ else
// Disable // Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS); print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.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 '</td></tr>'; print '</td></tr>';
// Force e-mail recipient // Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$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")); else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
} }
print '</td></tr>'; print '</td></tr>';
@ -547,8 +547,8 @@ else
// Method // Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
if (empty($text)) $text=$langs->trans("Undefined").img_warning(); if (empty($text)) $text = $langs->trans("Undefined").img_warning();
print $text; print $text;
print '</td></tr>'; print '</td></tr>';
@ -559,7 +559,7 @@ else
} }
else else
{ {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
} }
// Port // Port
@ -569,7 +569,7 @@ else
} }
else else
{ {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
} }
// SMTPS ID // SMTPS ID
@ -628,17 +628,17 @@ else
// Domain // Domain
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
print '</td></tr>'; print '</td></tr>';
// Selector // Selector
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
print '</td></tr>'; print '</td></tr>';
// PRIVATE KEY // PRIVATE KEY
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
print '<td>' . $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
print '</td></tr>'; print '</td></tr>';
} }
@ -646,22 +646,22 @@ else
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>'; print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM; print '<td>'.$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 '</td></tr>'; print '</td></tr>';
// Default from type // Default from type
$liste = array(); $liste = array();
$liste['user'] = $langs->trans('UserEmail'); $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'; $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE active = 1';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i=0; $i = 0;
while($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) if ($obj)
@ -705,16 +705,16 @@ else
// Errors To // Errors To
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO; print '<td>'.$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 '</td></tr>'; print '</td></tr>';
// Autocopy to // Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>'; print '<td>';
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))
{ {
print $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 else
{ {
@ -732,7 +732,7 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || ! $linuxlike) if ($conf->global->MAIN_MAIL_SENDMODE != 'mail' || !$linuxlike)
{ {
if (function_exists('fsockopen') && $port && $server) if (function_exists('fsockopen') && $port && $server)
{ {
@ -746,7 +746,7 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
if (! empty($conf->fckeditor->enabled)) if (!empty($conf->fckeditor->enabled))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>';
} }
@ -770,17 +770,17 @@ else
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA")); print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
} }
if (! in_array($action, array('testconnect', 'test', 'testhtml'))) if (!in_array($action, array('testconnect', 'test', 'testhtml')))
{ {
$text = ''; $text = '';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') 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'; //$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?'<br>':'').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS); $text .= ($text ? '<br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
} }
if ($text) print info_admin($text); if ($text) print info_admin($text);
} }
@ -792,7 +792,7 @@ else
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile('', '', '', ''); $mail = new CMailFile('', '', '', '');
$result=$mail->check_server_port($server, $port); $result = $mail->check_server_port($server, $port);
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>'; if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
else else
{ {
@ -811,45 +811,45 @@ else
if ($action == 'test' || $action == 'testhtml') if ($action == 'test' || $action == 'testhtml')
{ {
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
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(''); dol_fiche_head('');
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test"); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM); $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->frommail = (isset($_POST['frommail']) ? $_POST['frommail'] : $conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->fromid=$user->id; $formmail->fromid = $user->id;
$formmail->fromalsorobot=1; $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->fromtype = (GETPOSTISSET('fromtype') ?GETPOST('fromtype', 'aZ09') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
$formmail->withfromreadonly=1; $formmail->withfromreadonly = 1;
$formmail->withsubstit=1; $formmail->withsubstit = 1;
$formmail->withfrom=1; $formmail->withfrom = 1;
$formmail->witherrorsto=1; $formmail->witherrorsto = 1;
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email: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->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->withtoccc = (!empty($_POST['sendtoccc']) ? $_POST['sendtoccc'] : 1); // ! empty to keep field if empty
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test")); $formmail->withtopic = (isset($_POST['subject']) ? $_POST['subject'] : $langs->trans("Test"));
$formmail->withtopicreadonly=0; $formmail->withtopicreadonly = 0;
$formmail->withfile=2; $formmail->withfile = 2;
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->transnoentities("PredefinedMailTestHtml"):$langs->transnoentities("PredefinedMailTest"))); $formmail->withbody = (isset($_POST['message']) ? $_POST['message'] : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
$formmail->withbodyreadonly=0; $formmail->withbodyreadonly = 0;
$formmail->withcancel=1; $formmail->withcancel = 1;
$formmail->withdeliveryreceipt=1; $formmail->withdeliveryreceipt = 1;
$formmail->withfckeditor=($action == 'testhtml'?1:0); $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
$formmail->ckeditortoolbar='dolibarr_mailings'; $formmail->ckeditortoolbar = 'dolibarr_mailings';
// Tableau des substitutions // Tableau des substitutions
$formmail->substit=$substitutionarrayfortest; $formmail->substit = $substitutionarrayfortest;
// Tableau des parametres complementaires du post // Tableau des parametres complementaires du post
$formmail->param["action"]="send"; $formmail->param["action"] = "send";
$formmail->param["models"]="body"; $formmail->param["models"] = "body";
$formmail->param["mailid"]=0; $formmail->param["mailid"] = 0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"]; $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files // Init list of files
if (GETPOST("mode", "aZ09")=='init') if (GETPOST("mode", "aZ09") == 'init')
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }

View File

@ -1327,6 +1327,20 @@ class Setup extends DolibarrApi
return $list; 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. * Do a test of integrity for files and setup.

View File

@ -32,32 +32,32 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("mrp","other")); $langs->loadLangs(array("mrp", "other"));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array'))
{ {
$actioncode=GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (! count($actioncode)) $actioncode='0'; if (!count($actioncode)) $actioncode = '0';
} }
else 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 // Security check - Protection if external user
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id); //$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'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int'); $page = GETPOST("page", 'int');

View File

@ -146,6 +146,11 @@ if (empty($reshook))
$error++; $error++;
} }
if ($object->fk_product == $idprod) {
setEventMessages($langs->trans('TheProductXIsAlreadyTheProductToProduce'), null, 'errors');
$error++;
}
if (!$error) if (!$error)
{ {
$bomline = new BOMLine($db); $bomline = new BOMLine($db);
@ -625,28 +630,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Close / Cancel // Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close">' . $langs->trans("Disable") . '</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>';
} }
// Re-open // Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans("ReOpen") . '</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
} }
// Create MO // Create MO
if ($conf->mrp->enabled) 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 '<a class="butAction" href="' . DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">' . $langs->trans("CreateMO") . '</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
} }
} }
// Clone // Clone
if ($permissiontoadd) if ($permissiontoadd)
{ {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&object=bom">' . $langs->trans("ToClone") . '</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>';
} }
/* /*
@ -693,7 +698,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));

View File

@ -992,7 +992,7 @@ class BOM extends CommonObject
/** /**
* Class for BOMLine * Class for BOMLine
*/ */
class BOMLine extends CommonObject class BOMLine extends CommonObjectLine
{ {
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object

View File

@ -6,7 +6,7 @@
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -52,7 +52,7 @@ print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) { if ($nolinesbefore) {
print '<tr class="liste_titre'.($nolinesbefore?'':' liste_titre_add_').' nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="linecolnum center"></td>'; print '<td class="linecolnum center"></td>';
} }

View File

@ -1154,11 +1154,13 @@ class Categorie extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel. * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
* It is called by get_full_arbo()
* This function is a memory scan only from $this->cats and $this->motherof, no database access must be done here. * This function is a memory scan only from $this->cats and $this->motherof, no database access must be done here.
* *
* @param int $id_categ id_categ entry to update * @param int $id_categ id_categ entry to update
* @param int $protection Deep counter to avoid infinite loop * @param int $protection Deep counter to avoid infinite loop
* @return void * @return void
* @see get_full_arbo()
*/ */
public function build_path_from_id_categ($id_categ, $protection = 1000) public function build_path_from_id_categ($id_categ, $protection = 1000)
{ {

View File

@ -372,7 +372,7 @@ if ($type == Categorie::TYPE_PRODUCT)
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'; print '<tr class="liste_titre"><td>';
print $langs->trans("AddProductServiceIntoCategory").' &nbsp;'; print $langs->trans("AddProductServiceIntoCategory").' &nbsp;';
print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1);
print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>'; print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';

View File

@ -79,7 +79,7 @@ class AgendaEvents extends DolibarrApi
throw new RestException(404, 'Agenda Events not found'); throw new RestException(404, 'Agenda Events not found');
} }
if (! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->ownerid != DolibarrApiAccess::$user->id) { if (! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) {
throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
} }

View File

@ -1588,7 +1588,7 @@ if ($action == 'create')
}); });
</script>'; </script>';
} }
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>'; print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>'; print '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";
@ -1675,7 +1675,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>'; print '<td>'.$langs->trans("Project").'</td><td>';
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -745,7 +745,7 @@ if ($socid > 0)
$sql .= " , ".MAIN_DB_PREFIX."facturedet as fc"; $sql .= " , ".MAIN_DB_PREFIX."facturedet as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $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 .= " 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 rc.fk_facture_line = fc.rowid";
$sql .= " AND fc.fk_facture = f.rowid"; $sql .= " AND fc.fk_facture = f.rowid";
$sql .= " AND rc.fk_user = u.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."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $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 .= " 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_facture = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid"; $sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 0"; // Eliminate supplier discounts $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."facture_fourn_det as fc";
$sql .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $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 .= " 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 rc.fk_invoice_supplier_line = fc.rowid";
$sql .= " AND fc.fk_facture_fourn = f.rowid"; $sql .= " AND fc.fk_facture_fourn = f.rowid";
$sql .= " AND rc.fk_user = u.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."user as u";
$sql2 .= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $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 .= " 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_invoice_supplier = f.rowid";
$sql2 .= " AND rc.fk_user = u.rowid"; $sql2 .= " AND rc.fk_user = u.rowid";
$sql2 .= " AND rc.discount_type = 1"; // Eliminate customer discounts $sql2 .= " AND rc.discount_type = 1"; // Eliminate customer discounts

View File

@ -31,22 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('banks', 'categories')); $langs->loadLangs(array('banks', 'categories'));
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width', 768); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width', 768);
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height', 200); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height', 200);
// Security check // Security check
if (isset($_GET["account"]) || isset($_GET["ref"])) 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'; $fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid';
if ($user->socid) $socid=$user->socid; if ($user->socid) $socid = $user->socid;
$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
$account=GETPOST("account"); $account = GETPOST("account");
$mode='standard'; $mode = 'standard';
if (GETPOST("mode") == 'showalltime') $mode='showalltime'; if (GETPOST("mode") == 'showalltime') $mode = 'showalltime';
$error=0; $error = 0;
/* /*
@ -63,22 +63,22 @@ $datetime = dol_now();
$year = dol_print_date($datetime, "%Y"); $year = dol_print_date($datetime, "%Y");
$month = dol_print_date($datetime, "%m"); $month = dol_print_date($datetime, "%m");
$day = dol_print_date($datetime, "%d"); $day = dol_print_date($datetime, "%d");
if (GETPOST("year")) $year=sprintf("%04d", GETPOST("year")); if (GETPOST("year")) $year = sprintf("%04d", GETPOST("year"));
if (GETPOST("month")) $month=sprintf("%02d", GETPOST("month")); if (GETPOST("month")) $month = sprintf("%02d", GETPOST("month"));
$object = new Account($db); $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"]) if ($_GET["ref"])
{ {
$result=$object->fetch(0, GETPOST("ref")); $result = $object->fetch(0, GETPOST("ref"));
$account=$object->id; $account = $object->id;
} }
$result=dol_mkdir($conf->bank->dir_temp); $result = dol_mkdir($conf->bank->dir_temp);
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
@ -89,11 +89,11 @@ else
{ {
// Calcul $min and $max // Calcul $min and $max
$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -109,7 +109,7 @@ else
} }
if (empty($min)) $min = dol_now() - 3600 * 24; 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); dol_syslog($log);
@ -120,24 +120,24 @@ else
// Loading table $amounts // Loading table $amounts
$amounts = array(); $amounts = array();
$monthnext = $month+1; $monthnext = $month + 1;
$yearnext = $year; $yearnext = $year;
if ($monthnext > 12) if ($monthnext > 12)
{ {
$monthnext=1; $monthnext = 1;
$yearnext++; $yearnext++;
} }
$sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql = "SELECT date_format(b.datev,'%Y%m%d')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-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.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql.= " GROUP BY date_format(b.datev,'%Y%m%d')"; $sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -161,12 +161,12 @@ else
$solde = 0; $solde = 0;
$sql = "SELECT SUM(b.amount)"; $sql = "SELECT SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'"; $sql .= " AND b.datev < '".$year."-".sprintf("%02s", $month)."-01'";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -225,36 +225,36 @@ else
//exit; //exit;
// Fabrication tableau 1 // Fabrication tableau 1
$file= $conf->bank->dir_temp."/balance".$account."-".$year.$month.".png"; $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"; $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; $title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
$graph_datas=array(); $graph_datas = array();
foreach($datas as $i => $val) 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_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
} }
$px1 = new DolGraph(); $px1 = new DolGraph();
$px1->SetData($graph_datas); $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_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px1->SetLegend($arraylegends); $px1->SetLegend($arraylegends);
$px1->SetLegendWidthMin(180); $px1->SetLegendWidthMin(180);
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue()); $px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
$px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue()); $px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
$px1->SetTitle($title); $px1->SetTitle($title);
$px1->SetWidth($WIDTH); $px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT); $px1->SetHeight($HEIGHT);
$px1->SetType(array('lines','lines','lines')); $px1->SetType(array('lines', 'lines', 'lines'));
$px1->setBgColor('onglet'); $px1->setBgColor('onglet');
$px1->setBgColorGrid(array(255,255,255)); $px1->setBgColorGrid(array(255, 255, 255));
$px1->SetHorizTickIncrement(1); $px1->SetHorizTickIncrement(1);
$px1->draw($file, $fileurl); $px1->draw($file, $fileurl);
$show1=$px1->show(); $show1 = $px1->show();
unset($graph_datas); unset($graph_datas);
unset($px1); unset($px1);
unset($datas); unset($datas);
@ -271,14 +271,14 @@ else
// Loading table $amounts // Loading table $amounts
$amounts = array(); $amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql = "SELECT date_format(b.datev,'%Y%m%d')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'"; $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%Y%m%d')"; $sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -303,12 +303,12 @@ else
$solde = 0; $solde = 0;
$sql = "SELECT SUM(b.amount)"; $sql = "SELECT SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev < '".$year."-01-01'"; $sql .= " AND b.datev < '".$year."-01-01'";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -361,36 +361,36 @@ else
} }
// Fabrication tableau 2 // Fabrication tableau 2
$file= $conf->bank->dir_temp."/balance".$account."-".$year.".png"; $file = $conf->bank->dir_temp."/balance".$account."-".$year.".png";
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/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; $title = $langs->transnoentities("Balance").' - '.$langs->transnoentities("Year").': '.$year;
$graph_datas=array(); $graph_datas = array();
foreach($datas as $i => $val) 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_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
} }
$px2 = new DolGraph(); $px2 = new DolGraph();
$px2->SetData($graph_datas); $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_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px2->SetLegend($arraylegends); $px2->SetLegend($arraylegends);
$px2->SetLegendWidthMin(180); $px2->SetLegendWidthMin(180);
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue()); $px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
$px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue()); $px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
$px2->SetTitle($title); $px2->SetTitle($title);
$px2->SetWidth($WIDTH); $px2->SetWidth($WIDTH);
$px2->SetHeight($HEIGHT); $px2->SetHeight($HEIGHT);
$px2->SetType(array('linesnopoint','linesnopoint','linesnopoint')); $px2->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
$px2->setBgColor('onglet'); $px2->setBgColor('onglet');
$px2->setBgColorGrid(array(255,255,255)); $px2->setBgColorGrid(array(255, 255, 255));
$px2->SetHideXGrid(true); $px2->SetHideXGrid(true);
//$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne //$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
$px2->draw($file, $fileurl); $px2->draw($file, $fileurl);
$show2=$px2->show(); $show2 = $px2->show();
unset($px2); unset($px2);
unset($graph_datas); unset($graph_datas);
@ -409,13 +409,13 @@ else
$amounts = array(); $amounts = array();
$sql = "SELECT date_format(b.datev,'%Y%m%d')"; $sql = "SELECT date_format(b.datev,'%Y%m%d')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql.= " GROUP BY date_format(b.datev,'%Y%m%d')"; $sql .= " GROUP BY date_format(b.datev,'%Y%m%d')";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -447,20 +447,20 @@ else
$subtotal = 0; $subtotal = 0;
$day = $min; $day = $min;
$textdate=strftime("%Y%m%d", $day); $textdate = strftime("%Y%m%d", $day);
//print "x".$textdate; //print "x".$textdate;
$i = 0; $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); $subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>"; //print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
if ($day > ($max+86400)) if ($day > ($max + 86400))
{ {
$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
} }
else else
{ {
$datas[$i] = '' + $solde + $subtotal; $datas[$i] = '' +$solde + $subtotal;
} }
$datamin[$i] = $object->min_desired; $datamin[$i] = $object->min_desired;
$dataall[$i] = $object->min_allowed; $dataall[$i] = $object->min_allowed;
@ -470,40 +470,40 @@ else
} }
$day += 86400; $day += 86400;
$textdate=strftime("%Y%m%d", $day); $textdate = strftime("%Y%m%d", $day);
$i++; $i++;
} }
// Fabrication tableau 3 // Fabrication tableau 3
$file= $conf->bank->dir_temp."/balance".$account.".png"; $file = $conf->bank->dir_temp."/balance".$account.".png";
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png"; $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/balance".$account.".png";
$title=$langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime"); $title = $langs->transnoentities("Balance")." - ".$langs->transnoentities("AllTime");
$graph_datas=array(); $graph_datas = array();
foreach($datas as $i => $val) 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_desired) array_push($graph_datas[$i], $datamin[$i]);
if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]); if ($object->min_allowed) array_push($graph_datas[$i], $dataall[$i]);
} }
$px3 = new DolGraph(); $px3 = new DolGraph();
$px3->SetData($graph_datas); $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_desired) array_push($arraylegends, $langs->transnoentities("BalanceMinimalDesired"));
if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed")); if ($object->min_allowed) array_push($arraylegends, $langs->transnoentities("BalanceMinimalAllowed"));
$px3->SetLegend($arraylegends); $px3->SetLegend($arraylegends);
$px3->SetLegendWidthMin(180); $px3->SetLegendWidthMin(180);
$px3->SetMaxValue($px3->GetCeilMaxValue()<0?0:$px3->GetCeilMaxValue()); $px3->SetMaxValue($px3->GetCeilMaxValue() < 0 ? 0 : $px3->GetCeilMaxValue());
$px3->SetMinValue($px3->GetFloorMinValue()>0?0:$px3->GetFloorMinValue()); $px3->SetMinValue($px3->GetFloorMinValue() > 0 ? 0 : $px3->GetFloorMinValue());
$px3->SetTitle($title); $px3->SetTitle($title);
$px3->SetWidth($WIDTH); $px3->SetWidth($WIDTH);
$px3->SetHeight($HEIGHT); $px3->SetHeight($HEIGHT);
$px3->SetType(array('linesnopoint','linesnopoint','linesnopoint')); $px3->SetType(array('linesnopoint', 'linesnopoint', 'linesnopoint'));
$px3->setBgColor('onglet'); $px3->setBgColor('onglet');
$px3->setBgColorGrid(array(255,255,255)); $px3->setBgColorGrid(array(255, 255, 255));
$px3->draw($file, $fileurl); $px3->draw($file, $fileurl);
$show3=$px3->show(); $show3 = $px3->show();
unset($px3); unset($px3);
unset($graph_datas); unset($graph_datas);
@ -522,25 +522,25 @@ else
$credits = array(); $credits = array();
$debits = array(); $debits = array();
$monthnext = $month+1; $monthnext = $month + 1;
$yearnext = $year; $yearnext = $year;
if ($monthnext > 12) if ($monthnext > 12)
{ {
$monthnext=1; $monthnext = 1;
$yearnext++; $yearnext++;
} }
$sql = "SELECT date_format(b.datev,'%d')"; $sql = "SELECT date_format(b.datev,'%d')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'"; $sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
$sql.= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql.= " GROUP BY date_format(b.datev,'%d')"; $sql .= " GROUP BY date_format(b.datev,'%d')";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -560,24 +560,24 @@ else
dol_print_error($db); dol_print_error($db);
} }
$monthnext = $month+1; $monthnext = $month + 1;
$yearnext = $year; $yearnext = $year;
if ($monthnext > 12) if ($monthnext > 12)
{ {
$monthnext=1; $monthnext = 1;
$yearnext++; $yearnext++;
} }
$sql = "SELECT date_format(b.datev,'%d')"; $sql = "SELECT date_format(b.datev,'%d')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-".$month."-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-".$month."-01 00:00:00'";
$sql.= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'"; $sql .= " AND b.datev < '".$yearnext."-".$monthnext."-01 00:00:00'";
$sql.= " AND b.amount < 0"; $sql .= " AND b.amount < 0";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%d')"; $sql .= " GROUP BY date_format(b.datev,'%d')";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -599,40 +599,40 @@ else
$labels = array(); $labels = array();
$data_credit = array(); $data_credit = array();
$data_debit = 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_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; $data_debit[$i] = isset($debits[substr("0".($i + 1), -2)]) ? $debits[substr("0".($i + 1), -2)] : 0;
$labels[$i] = sprintf("%02d", $i+1); $labels[$i] = sprintf("%02d", $i + 1);
$datamin[$i] = $object->min_desired; $datamin[$i] = $object->min_desired;
} }
// Fabrication tableau 4a // Fabrication tableau 4a
$file= $conf->bank->dir_temp."/movement".$account."-".$year.$month.".png"; $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"; $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; $title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year;
$graph_datas=array(); $graph_datas = array();
foreach($data_credit as $i => $val) 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 = new DolGraph();
$px4->SetData($graph_datas); $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->SetLegendWidthMin(180);
$px4->SetMaxValue($px4->GetCeilMaxValue()<0?0:$px4->GetCeilMaxValue()); $px4->SetMaxValue($px4->GetCeilMaxValue() < 0 ? 0 : $px4->GetCeilMaxValue());
$px4->SetMinValue($px4->GetFloorMinValue()>0?0:$px4->GetFloorMinValue()); $px4->SetMinValue($px4->GetFloorMinValue() > 0 ? 0 : $px4->GetFloorMinValue());
$px4->SetTitle($title); $px4->SetTitle($title);
$px4->SetWidth($WIDTH); $px4->SetWidth($WIDTH);
$px4->SetHeight($HEIGHT); $px4->SetHeight($HEIGHT);
$px4->SetType(array('bars','bars')); $px4->SetType(array('bars', 'bars'));
$px4->SetShading(3); $px4->SetShading(3);
$px4->setBgColor('onglet'); $px4->setBgColor('onglet');
$px4->setBgColorGrid(array(255,255,255)); $px4->setBgColorGrid(array(255, 255, 255));
$px4->SetHorizTickIncrement(1); $px4->SetHorizTickIncrement(1);
$px4->draw($file, $fileurl); $px4->draw($file, $fileurl);
$show4=$px4->show(); $show4 = $px4->show();
unset($graph_datas); unset($graph_datas);
unset($px4); unset($px4);
@ -648,15 +648,15 @@ else
$credits = array(); $credits = array();
$debits = array(); $debits = array();
$sql = "SELECT date_format(b.datev,'%m')"; $sql = "SELECT date_format(b.datev,'%m')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'"; $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
$sql.= " AND b.amount > 0"; $sql .= " AND b.amount > 0";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%m');"; $sql .= " GROUP BY date_format(b.datev,'%m');";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -677,15 +677,15 @@ else
dol_print_error($db); dol_print_error($db);
} }
$sql = "SELECT date_format(b.datev,'%m')"; $sql = "SELECT date_format(b.datev,'%m')";
$sql.= ", SUM(b.amount)"; $sql .= ", SUM(b.amount)";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid"; $sql .= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.datev >= '".$year."-01-01 00:00:00'"; $sql .= " AND b.datev >= '".$year."-01-01 00:00:00'";
$sql.= " AND b.datev <= '".$year."-12-31 23:59:59'"; $sql .= " AND b.datev <= '".$year."-12-31 23:59:59'";
$sql.= " AND b.amount < 0"; $sql .= " AND b.amount < 0";
if ($account && $_GET["option"]!='all') $sql.= " AND b.fk_account IN (".$account.")"; if ($account && $_GET["option"] != 'all') $sql .= " AND b.fk_account IN (".$account.")";
$sql .= " GROUP BY date_format(b.datev,'%m')"; $sql .= " GROUP BY date_format(b.datev,'%m')";
$resql = $db->query($sql); $resql = $db->query($sql);
@ -707,40 +707,40 @@ else
$labels = array(); $labels = array();
$data_credit = array(); $data_credit = array();
$data_debit = 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_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; $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"); $labels[$i] = dol_print_date(dol_mktime(12, 0, 0, $i + 1, 1, 2000), "%b");
$datamin[$i] = $object->min_desired; $datamin[$i] = $object->min_desired;
} }
// Fabrication tableau 4b // Fabrication tableau 4b
$file= $conf->bank->dir_temp."/movement".$account."-".$year.".png"; $file = $conf->bank->dir_temp."/movement".$account."-".$year.".png";
$fileurl=DOL_URL_ROOT.'/viewimage.php?modulepart=banque_temp&file='."/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; $title = $langs->transnoentities("BankMovements").' - '.$langs->transnoentities("Year").': '.$year;
$graph_datas=array(); $graph_datas = array();
foreach($data_credit as $i => $val) 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 = new DolGraph();
$px5->SetData($graph_datas); $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->SetLegendWidthMin(180);
$px5->SetMaxValue($px5->GetCeilMaxValue()<0?0:$px5->GetCeilMaxValue()); $px5->SetMaxValue($px5->GetCeilMaxValue() < 0 ? 0 : $px5->GetCeilMaxValue());
$px5->SetMinValue($px5->GetFloorMinValue()>0?0:$px5->GetFloorMinValue()); $px5->SetMinValue($px5->GetFloorMinValue() > 0 ? 0 : $px5->GetFloorMinValue());
$px5->SetTitle($title); $px5->SetTitle($title);
$px5->SetWidth($WIDTH); $px5->SetWidth($WIDTH);
$px5->SetHeight($HEIGHT); $px5->SetHeight($HEIGHT);
$px5->SetType(array('bars','bars')); $px5->SetType(array('bars', 'bars'));
$px5->SetShading(3); $px5->SetShading(3);
$px5->setBgColor('onglet'); $px5->setBgColor('onglet');
$px5->setBgColorGrid(array(255,255,255)); $px5->setBgColorGrid(array(255, 255, 255));
$px5->SetHorizTickIncrement(1); $px5->SetHorizTickIncrement(1);
$px5->draw($file, $fileurl); $px5->draw($file, $fileurl);
$show5=$px5->show(); $show5 = $px5->show();
unset($graph_datas); unset($graph_datas);
unset($px5); unset($px5);
@ -751,7 +751,7 @@ else
// Onglets // Onglets
$head=bank_prepare_head($object); $head = bank_prepare_head($object);
dol_fiche_head($head, 'graph', $langs->trans("FinancialAccount"), 0, 'account'); dol_fiche_head($head, 'graph', $langs->trans("FinancialAccount"), 0, 'account');
@ -759,32 +759,32 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_v
if ($account) if ($account)
{ {
if (! preg_match('/,/', $account)) if (!preg_match('/,/', $account))
{ {
$moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':''); $moreparam = '&month='.$month.'&year='.$year.($mode == 'showalltime' ? '&mode=showalltime' : '');
if ($_GET["option"]!='all') if ($_GET["option"] != 'all')
{ {
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>'; $morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1);
} }
else else
{ {
$morehtml='<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>'; $morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
print $langs->trans("AllAccounts"); print $langs->trans("AllAccounts");
//print $morehtml; //print $morehtml;
} }
} }
else else
{ {
$bankaccount=new Account($db); $bankaccount = new Account($db);
$listid=explode(',', $account); $listid = explode(',', $account);
foreach($listid as $key => $id) foreach ($listid as $key => $id)
{ {
$bankaccount->fetch($id); $bankaccount->fetch($id);
$bankaccount->label=$bankaccount->ref; $bankaccount->label = $bankaccount->ref;
print $bankaccount->getNomUrl(1); print $bankaccount->getNomUrl(1);
if ($key < (count($listid)-1)) print ', '; if ($key < (count($listid) - 1)) print ', ';
} }
} }
} }
@ -818,13 +818,13 @@ print '<br><br></td></tr>';
// Graphs // Graphs
if ($mode == 'standard') if ($mode == 'standard')
{ {
$prevyear=$year; $nextyear=$year; $prevyear = $year; $nextyear = $year;
$prevmonth=$month-1;$nextmonth=$month+1; $prevmonth = $month - 1; $nextmonth = $month + 1;
if ($prevmonth < 1) { $prevmonth=12; $prevyear--; } if ($prevmonth < 1) { $prevmonth = 12; $prevyear--; }
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; } if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
// For month // For month
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>"; $link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
print '<tr><td class="right">'.$link.'</td></tr>'; print '<tr><td class="right">'.$link.'</td></tr>';
print '<tr><td class="center">'; print '<tr><td class="center">';
@ -837,8 +837,8 @@ if ($mode == 'standard')
print '</td></tr>'; print '</td></tr>';
// For year // For year
$prevyear=$year-1;$nextyear=$year+1; $prevyear = $year - 1; $nextyear = $year + 1;
$link="<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"]!='all'?'':'&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>"; $link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
print '<tr><td class="right">'.$link.'</td></tr>'; print '<tr><td class="right">'.$link.'</td></tr>';
print '<tr><td class="center">'; print '<tr><td class="center">';

View File

@ -99,7 +99,7 @@ if ($object->id)
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>'; $morehtmlref.='</form>';

View File

@ -154,12 +154,10 @@ if ($result)
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss); if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
$newcardbutton=''; $newcardbutton = '';
if ($user->rights->banque->modifier) if ($user->rights->banque->modifier)
{ {
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewVariousPayment').'</span>'; $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create');
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -306,7 +304,7 @@ if ($result)
} }
// Debit // Debit
print "<td class=\"right\">"; print '<td class="nowrap right">';
if ($obj->sens == 0) if ($obj->sens == 0)
{ {
print price($obj->amount); print price($obj->amount);
@ -317,7 +315,7 @@ if ($result)
print "</td>"; print "</td>";
// Credit // Credit
print "<td class=\"right\">"; print '<td class="nowrap right">';
if ($obj->sens == 1) if ($obj->sens == 1)
{ {
print price($obj->amount); print price($obj->amount);
@ -325,17 +323,16 @@ if ($result)
} }
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
print "</td>"; print '</td>' ;
print '<td></td>';
print "<td></td>"; if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++; $i++;
} }
$colspan = 4;
if (!empty($conf->banque->enabled)) $colspan++;
if (!empty($conf->accounting->enabled)) $colspan++;
// Show total line // Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';

View File

@ -92,7 +92,7 @@ if ($sortorder) $param .= '&sortorder='.$sortorder;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';

View File

@ -1387,7 +1387,7 @@ if (empty($reshook))
if (empty($amount)) continue; if (empty($amount)) continue;
$arraylist = array('amount' => 'FixAmount', 'variable' => 'VarAmount'); $arraylist = array('amount' => 'FixAmount', 'variable' => 'VarAmount');
$descline = $langs->trans('Deposit'); $descline = '(DEPOSIT)';
//$descline.= ' - '.$langs->trans($arraylist[$typeamount]); //$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
if ($typeamount == 'amount') { if ($typeamount == 'amount') {
$descline .= ' ('.price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')'; $descline .= ' ('.price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')';

View File

@ -317,7 +317,7 @@ if ($resql)
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
@ -374,14 +374,14 @@ if ($resql)
{ {
// Payment term // Payment term
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print $form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100'); $form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print "</td>"; print "</td>";
} }
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
// Payment mode // Payment mode
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100'); $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100');
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['recurring']['checked'])) if (! empty($arrayfields['recurring']['checked']))
@ -487,7 +487,7 @@ if ($resql)
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ')."\n"; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
if ($num > 0) if ($num > 0)
@ -550,7 +550,7 @@ if ($resql)
if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
{ {
print '<td class="right">'; print '<td class="right">';
print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none'); $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
print '</td>'."\n"; print '</td>'."\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
@ -558,7 +558,7 @@ if ($resql)
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
print '<td class="right">'; print '<td class="right">';
print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none'); $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
print '</td>'."\n"; print '</td>'."\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -637,7 +637,7 @@ if ($resql)
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';

View File

@ -1803,8 +1803,8 @@ class BonPrelevement extends CommonObject
* Write sender of request (me). * Write sender of request (me).
* Note: The tag PmtInf is opened here but closed into caller * Note: The tag PmtInf is opened here but closed into caller
* *
* @param string $configuration conf * @param Conf $configuration conf
* @param int $ladate Date * @param int $ladate Date
* @param int $nombre 0 or 1 * @param int $nombre 0 or 1
* @param float $total Total * @param float $total Total
* @param string $CrLf End of line character * @param string $CrLf End of line character
@ -1827,15 +1827,15 @@ class BonPrelevement extends CommonObject
if ($account->fetch($id) > 0) if ($account->fetch($id) > 0)
{ {
$this->emetteur_code_banque = $account->code_banque; $this->emetteur_code_banque = $account->code_banque;
$this->emetteur_code_guichet = $account->code_guichet; $this->emetteur_code_guichet = $account->code_guichet;
$this->emetteur_numero_compte = $account->number; $this->emetteur_numero_compte = $account->number;
$this->emetteur_number_key = $account->cle_rib; $this->emetteur_number_key = $account->cle_rib;
$this->emetteur_iban = $account->iban; $this->emetteur_iban = $account->iban;
$this->emetteur_bic = $account->bic; $this->emetteur_bic = $account->bic;
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; $this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
$this->raison_sociale = $account->proprio; $this->raison_sociale = $account->proprio;
} }
// Récupération info demandeur // Récupération info demandeur

View File

@ -171,9 +171,7 @@ if ($resql)
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->tax->charges->creer) if ($user->rights->tax->charges->creer)
{ {
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('MenuNewSocialContribution').'</span>'; $newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewSocialContribution'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/sociales/card.php?action=create');
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton .= '</a>';
} }
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -267,15 +265,16 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
print '<td width="60">'; print "<td>".$chargesociale_static->getNomUrl(1, '20')."</td>\n";
print $chargesociale_static->getNomUrl(1, '20'); if (! $i) $totalarray['nbfield']++;
print '</td>';
// Label // Label
print '<td>'.dol_trunc($obj->label, 42).'</td>'; print "<td>".dol_trunc($obj->label, 42)."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Type // Type
print '<td>'.$obj->type_label.'</td>'; print "<td>".$obj->type_label."</td>\n";
if (! $i) $totalarray['nbfield']++;
// Date end period // Date end period
print '<td align="center">'; print '<td align="center">';
@ -287,21 +286,26 @@ if ($resql)
{ {
print '&nbsp;'; print '&nbsp;';
} }
print '</td>'; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
// Amount // Amount
print '<td class="right" width="100">'.price($obj->amount).'</td>'; print '<td class="nowrap right">'.price($obj->amount).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield'; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalttcfield';
$totalarray['val']['totalttcfield'] += $obj->amount; $totalarray['val']['totalttcfield'] += $obj->amount;
// Due date // Due date
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>'; print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
if (! $i) $totalarray['nbfield']++;
print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>'; print '<td class="nowrap right">'.$chargesociale_static->LibStatut($obj->paye, 5, $obj->alreadypayed).'</td>';
if (! $i) $totalarray['nbfield']++;
print '<td></td>'; print '<td></td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -40,6 +40,7 @@ $year = GETPOST("year", "int");
if (empty($year)) if (empty($year))
{ {
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());
if ($conf->global->SOCIETE_FISCAL_MONTH_START > date('m')) $year_current--;
$year_start = $year_current; $year_start = $year_current;
} else { } else {
$year_current = $year; $year_current = $year;

View File

@ -1617,7 +1617,7 @@ class Contact extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid; $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid." AND fk_socpeople=".$this->id;;
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -1054,7 +1054,7 @@ class Contrat extends CommonObject
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
{ {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
$exp = new Expedition($db); $exp = new Expedition($this->db);
$exp->fetch($this->origin_id); $exp->fetch($this->origin_id);
$exp->fetchObjectLinked(); $exp->fetchObjectLinked();
if (count($exp->linkedObjectsIds['commande']) > 0) if (count($exp->linkedObjectsIds['commande']) > 0)

View File

@ -239,7 +239,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
</script>'; </script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $stringtoshow.='<input type="hidden" name="token" value="'.newToken().'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="page_y" value="">'; $stringtoshow.='<input type="hidden" name="page_y" value="">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">'; $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';

View File

@ -237,7 +237,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
</script>'; </script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $stringtoshow.='<input type="hidden" name="token" value="'.newToken().'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="page_y" value="">'; $stringtoshow.='<input type="hidden" name="page_y" value="">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">'; $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';

View File

@ -236,7 +236,7 @@ class box_graph_orders_permonth extends ModeleBoxes
</script>'; </script>';
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden $stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; $stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $stringtoshow.='<input type="hidden" name="token" value="'.newToken().'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="page_y" value="">'; $stringtoshow.='<input type="hidden" name="page_y" value="">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">'; $stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';

Some files were not shown because too many files have changed in this diff Show More