Merge remote-tracking branch 'Dolibarr/develop' into develop_mo_pmp

This commit is contained in:
Francis Appels 2021-02-02 12:18:19 +01:00
commit dae997dd4c
66 changed files with 609 additions and 422 deletions

View File

@ -265,9 +265,9 @@ Following changes may create regressions for some external modules, but were nec
* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used. * Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used.
* Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main" * Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet) * Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
* Databse transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code. * Database transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code.
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0. * Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
***** ChangeLog for 12.0.4 compared to 12.0.3 ***** ***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook FIX: make formConfirm an addreplace-type hook

View File

@ -23,7 +23,7 @@ setup_empty_conf() {
mkdir -p /etc/dolibarr mkdir -p /etc/dolibarr
touch /etc/dolibarr/conf.php touch /etc/dolibarr/conf.php
chown root:www-data /etc/dolibarr/conf.php chown root:www-data /etc/dolibarr/conf.php
chmod 664 /etc/dolibarr/conf.php chmod 660 /etc/dolibarr/conf.php
} }
is_new_upstream_version() { is_new_upstream_version() {

View File

@ -370,7 +370,7 @@ class BookKeeping extends CommonObject
$sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->numero_compte)."'"; $sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_operation) ? ("'".$this->db->escape($this->label_operation)."'") : "NULL"); $sql .= ", ".(!empty($this->label_compte) ? ("'".$this->db->escape($this->label_compte)."'") : "NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'"; $sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit; $sql .= ", ".$this->debit;
$sql .= ", ".$this->credit; $sql .= ", ".$this->credit;

View File

@ -443,7 +443,6 @@ if ($mode == 'template' && $user->admin) {
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>'; print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
print '<td>'; print '<td>';
print '<textarea name="template" wrap="soft" cols="120" rows="12">'; print '<textarea name="template" wrap="soft" cols="120" rows="12">';
print GETPOSTISSET('template') ? GETPOST('template', 'alpha') : $printer->listprinterstemplates[$line]['template'];
print '</textarea>'; print '</textarea>';
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';

View File

@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation // Localisation
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n"; print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("LanguageBrowserParameter", "HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands // Thousands
@ -222,7 +222,22 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print "</tr>\n"; print "</tr>\n";
} }
print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td></tr>'."\n";
// Timezone
// Timezones
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
}
print '</td></tr>'."\n";
}
$txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n"; $txt = $langs->trans("OSTZ").' (variable system TZ): '.(!empty($_ENV["TZ"]) ? $_ENV["TZ"] : $langs->trans("NotDefined")).'<br>'."\n";
$txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt .= $langs->trans("PHPTZ").' (date_default_timezone_get() / php.ini date.timezone): '.(getServerTimeZoneString()." / ".(ini_get("date.timezone") ? ini_get("date.timezone") : $langs->trans("NotDefined")))."<br>\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ); $txt .= $langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ) ? $langs->trans("NotDefined") : $conf->global->MAIN_SERVER_TZ);
@ -238,23 +253,10 @@ $val .= ' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
$val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : ''))); $val .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight === 'unknown' ? 'unknown' : ($a == $c ?yn($daylight) : yn(0).($daylight ? ' &nbsp; &nbsp; ('.$langs->trans('YesInSummer').')' : '')));
print $form->textwithtooltip($val, $txt, 2, 1, img_info('')); print $form->textwithtooltip($val, $txt, 2, 1, img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(), 'dayhour', 'tzserver').'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver').'</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0, "dayhourtext").'</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0, "dayhourtext").'</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970, 1, false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970, 1, false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, false), 'dayhour').')</td>';
print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970, 1, true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')</td>'; print '<tr class="oddeven"><td>&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970, 1, true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970, 1, true), 'dayhour').')</td>';
// Database timezone
if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
{
print '<tr class="oddeven"><td>'.$langs->trans("MySQLTimeZone").' (database)</td><td>'; // Timezone server base
$sql = "SHOW VARIABLES where variable_name = 'system_time_zone'";
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
print $form->textwithtooltip($obj->Value, $langs->trans('TZHasNoEffect'), 2, 1, img_info(''));
}
print '</td></tr>'."\n";
}
// Client // Client
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')'; print '<tr class="oddeven"><td>'.$langs->trans("ClientTZ").'</td><td>'.($tz ? ($tz >= 0 ? '+' : '').$tz : '').' ('.($tz >= 0 ? '+' : '').($tz * 60 * 60).')';
@ -265,7 +267,7 @@ else print yn(0);
if (!empty($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')'; if (!empty($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']), 'dayhour', 'gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']), 'dayhour', 'gmt').')';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(), 'dayhour', 'tzuser').'</td></tr>'."\n"; print '<tr class="oddeven"><td>&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now('gmt'), 'dayhour', 'tzuser').'</td></tr>'."\n";
$filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 $filesystemencoding = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n";

View File

@ -425,7 +425,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error while fetching object: '.$object->error); throw new RestException(500, 'Error while fetching object: '.$object->error);
} }
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product');
} }
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{ {

View File

@ -22,6 +22,11 @@
* \ingroup member * \ingroup member
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets * \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
*/ */
if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must ne renew the token.
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
}
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -237,16 +242,22 @@ if ($action == 'builddoc')
$outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf'; $outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile)); if (!$mesg) {
$outputlangs = $langs;
// This generates and send PDF to output
// TODO Move
$result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
}
} }
if ($result <= 0) if ($result <= 0 || $mesg) {
{ if (empty($mesg)) {
dol_print_error('', $result); $mesg = 'Error '.$result;
} }
if (!$mesg) setEventMessages($mesg, null, 'errors');
{ } else {
$db->close(); $db->close();
exit; exit;
} }
@ -275,10 +286,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>'; //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
//print '<br>'; //print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
print '<input type="hidden" name="mode" value="label">'; print '<input type="hidden" name="mode" value="label">';
print '<input type="hidden" name="action" value="builddoc">'; print '<input type="hidden" name="action" value="builddoc">';
print '<input type="hidden" name="token" value="'.newtoken().'">'; print '<input type="hidden" name="token" value="'.currentToken().'">'; // The page will not renew the token but force download of a file, so we must use here currentToken
print '<div class="tagtable">'; print '<div class="tagtable">';

View File

@ -228,8 +228,8 @@ if (empty($reshook) && $action == 'add')
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters // Clean parameters
$datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
// Check parameters // Check parameters
if (!$datef && $percentage == 100) if (!$datef && $percentage == 100)
@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update')
$object->fetch_userassigned(); $object->fetch_userassigned();
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml"); $object->label = GETPOST("label", "alphanohtml");
@ -953,7 +953,7 @@ if ($action == 'create')
// Full day // Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
$datep = ($datep ? $datep : $object->datep); $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); if (GETPOST('datep', 'int', 1)) $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0);
$datef = ($datef ? $datef : $object->datef); $datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0); if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
@ -1324,8 +1324,8 @@ if ($id > 0)
{ {
$percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status $percentage = in_array(GETPOST('status'), array(-1, 100)) ?GETPOST('status') : (in_array(GETPOST('complete'), array(-1, 100)) ?GETPOST('complete') : GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser');
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml"); $object->label = GETPOST("label", "alphanohtml");
@ -1430,23 +1430,23 @@ if ($id > 0)
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
print dol_print_date($object->datep, 'dayhour', 'gmt');
// Date start - end // Date start - end
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">'; print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
if (GETPOST("afaire") == 1) { if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) { } elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} else { } else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart'); print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser');
} }
print ' - '; print ' - ';
if (GETPOST("afaire") == 1) { if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} elseif (GETPOST("afaire") == 2) { } elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} else { } else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend'); print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser');
} }
print '</td></tr>'; print '</td></tr>';
@ -1884,16 +1884,16 @@ if ($id > 0)
// Date start // Date start
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour'); if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour', 'tzuser');
else print dol_print_date($object->datep, 'day'); else print dol_print_date($object->datep, 'day', 'tzuser');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour'); if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour', 'tzuser');
else print dol_print_date($object->datef, 'day'); else print dol_print_date($object->datef, 'day', 'tzuser');
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late")); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>'; print '</td></tr>';

View File

@ -1222,13 +1222,20 @@ class ActionComm extends CommonObject
} }
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if (!$user->rights->agenda->allactions->read) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".$user->id;
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100"; if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100";
$sql .= " AND a.entity IN (".getEntity('agenda').")"; $sql .= " AND a.entity IN (".getEntity('agenda').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")";
if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid; if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid;
if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")"; if (!$user->rights->agenda->allactions->read) {
$sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id;
$sql .= " OR ar.fk_element = ".$user->id; // Added by PV
$sql .= ")";
}
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -136,9 +136,9 @@ $arrayfields = array(
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0), 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0), 'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0) 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -739,7 +739,7 @@ if ($resql)
// Start date // Start date
if (!empty($arrayfields['a.datep']['checked'])) { if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp), $formatToUse); print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
$late = 0; $late = 0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1; if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1; if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late = 1;
@ -752,7 +752,7 @@ if ($resql)
// End date // End date
if (!empty($arrayfields['a.datep2']['checked'])) { if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp2), $formatToUse); print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser');
print '</td>'; print '</td>';
} }
@ -837,11 +837,11 @@ if ($resql)
// Date creation // Date creation
if (!empty($arrayfields['a.datec']['checked'])) { if (!empty($arrayfields['a.datec']['checked'])) {
// Status/Percent // Status/Percent
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>'; print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour', 'tzuser').'</td>';
} }
// Date update // Date update
if (!empty($arrayfields['a.tms']['checked'])) { if (!empty($arrayfields['a.tms']['checked'])) {
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>'; print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($obj->datem), 'dayhour', 'tzuser').'</td>';
} }
if (!empty($arrayfields['a.percent']['checked'])) { if (!empty($arrayfields['a.percent']['checked'])) {
// Status/Percent // Status/Percent

View File

@ -161,10 +161,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$propalstatic->id = $obj->rowid; $propalstatic->id = $obj->rowid;
$propalstatic->ref = $obj->ref; $propalstatic->ref = $obj->ref;
$propalstatic->ref_client = $obj->ref_client; $propalstatic->ref_client = $obj->ref_client;
@ -196,6 +204,15 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -236,10 +253,18 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$supplierproposalstatic->id = $obj->rowid; $supplierproposalstatic->id = $obj->rowid;
$supplierproposalstatic->ref = $obj->ref; $supplierproposalstatic->ref = $obj->ref;
$supplierproposalstatic->total_ht = $obj->total_ht; $supplierproposalstatic->total_ht = $obj->total_ht;
@ -270,6 +295,15 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -310,10 +344,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$orderstatic->id = $obj->rowid; $orderstatic->id = $obj->rowid;
$orderstatic->ref = $obj->ref; $orderstatic->ref = $obj->ref;
$orderstatic->ref_client = $obj->ref_client; $orderstatic->ref_client = $obj->ref_client;
@ -345,6 +387,15 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");
@ -385,10 +436,18 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
if ($num > 0) { if ($num > 0) {
$i = 0; $i = 0;
$othernb = 0;
while ($i < $nbofloop) { while ($i < $num && $i < $conf->liste_limit) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
continue;
}
$supplierorderstatic->id = $obj->rowid; $supplierorderstatic->id = $obj->rowid;
$supplierorderstatic->ref = $obj->ref; $supplierorderstatic->ref = $obj->ref;
$supplierorderstatic->ref_supplier = $obj->ref_suppliert; $supplierorderstatic->ref_supplier = $obj->ref_suppliert;
@ -420,6 +479,15 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++; $i++;
$total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc);
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="5">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
} }
addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal"); addSummaryTableLine(3, $num, $nbofloop, $total, "NoProposal");

View File

@ -354,8 +354,8 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->socid = GETPOST('socid', 'int'); $object->socid = GETPOST('socid', 'int');
$object->contact_id = GETPOST('contactid', 'int'); $object->contact_id = GETPOST('contactid', 'int');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
@ -812,7 +812,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
if (empty($remise_percent)) $remise_percent = 0; if (empty($remise_percent)) $remise_percent = 0;
// Extrafields // Extrafields
@ -1210,7 +1210,7 @@ if (empty($reshook))
$price_min = $product->multiprices_min [$object->thirdparty->price_level]; $price_min = $product->multiprices_min [$object->thirdparty->price_level];
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1243,7 +1243,7 @@ if (empty($reshook))
$qty = price2num(GETPOST('qty', 'alpha'), 'MS'); $qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
$db->commit(); $db->commit();

View File

@ -291,7 +291,7 @@ $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'
//llxHeader('',$langs->trans('Proposal'),$help_url); //llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " ava.rowid as availability,"; $sql .= " ava.rowid as availability,";

View File

@ -607,9 +607,9 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise_percent')); $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate // Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
@ -640,7 +640,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1032,7 +1032,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -1060,7 +1060,7 @@ if (empty($reshook))
} }
} }
} }
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise); $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise);
if ($result >= 0) { if ($result >= 0) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {

View File

@ -282,7 +282,7 @@ $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_P
// llxHeader('',$title,$help_url); // llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";

View File

@ -451,7 +451,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -801,7 +801,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min))))
{ {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
@ -837,7 +837,7 @@ if (empty($reshook))
$localtax1_rate, $localtax1_rate,
$localtax1_rate, $localtax1_rate,
GETPOST('productid'), GETPOST('productid'),
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
'HT', 'HT',
$info_bits, $info_bits,
0, 0,
@ -923,7 +923,8 @@ if (empty($reshook))
* View * View
*/ */
llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec'); $help_url = '';
llxHeader('', $langs->trans("RepeatableInvoices"), $help_url);
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);

View File

@ -476,19 +476,15 @@ if (empty($reshook))
} }
} }
} // Set incoterm } // Set incoterm
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
{
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} // bank account } // bank account
elseif ($action == 'setbankaccount' && $usercancreate) elseif ($action == 'setbankaccount' && $usercancreate) {
{
$result = $object->setBankAccount(GETPOST('fk_account', 'int')); $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) } elseif ($action == 'setremisepercent' && $usercancreate) {
{
$object->fetch($id); $object->fetch($id);
$result = $object->set_remise($user, $_POST['remise_percent']); $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) } elseif ($action == "setabsolutediscount" && $usercancreate) {
{
// POST[remise_id] or POST[remise_id_for_payment] // POST[remise_id] or POST[remise_id_for_payment]
// We use the credit to reduce amount of invoice // We use the credit to reduce amount of invoice
@ -981,7 +977,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -993,26 +989,25 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
} }
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) { if (!$error) {
// This is a replacement invoice // This is a replacement invoice
$result = $object->fetch($_POST['fac_replacement']); $result = $object->fetch(GETPOST('fac_replacement', 'int'));
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_public = trim(GETPOST('note_public', 'restricthtml'));
// We do not copy the private note // We do not copy the private note
$object->ref_client = $_POST['ref_client']; $object->ref_client = GETPOST('ref_client', 'alphanohtml');
$object->ref_int = $_POST['ref_int']; $object->model_pdf = GETPOST('model', 'alphanohtml');
$object->model_pdf = $_POST['model']; $object->fk_project = GETPOST('projectid', 'int');
$object->fk_project = $_POST['projectid']; $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->cond_reglement_id = $_POST['cond_reglement_id']; $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->mode_reglement_id = $_POST['mode_reglement_id'];
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = $_POST['remise_absolue']; $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = $_POST['remise_percent']; $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1045,7 +1040,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1067,11 +1062,11 @@ if (empty($reshook))
$object->ref_client = GETPOST('ref_client'); $object->ref_client = GETPOST('ref_client');
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = 0; $object->cond_reglement_id = 0; // No payment term for a credit note
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1265,7 +1260,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1289,8 +1284,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1318,7 +1313,7 @@ if (empty($reshook))
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create'; $action = 'create';
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1343,8 +1338,8 @@ if (empty($reshook))
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->amount = price2num(GETPOST('amount')); $object->amount = price2num(GETPOST('amount'));
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
@ -1742,7 +1737,7 @@ if (empty($reshook))
$error++; $error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors'); setEventMessages($mesg, null, 'errors');
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1837,8 +1832,8 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->remise_absolue = GETPOST('remise_absolue', 'int'); $object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU');
$object->remise_percent = GETPOST('remise_percent', 'int'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
// Proprietes particulieres a facture de remplacement // Proprietes particulieres a facture de remplacement
@ -1923,8 +1918,8 @@ if (empty($reshook))
$tva_tx = ''; $tva_tx = '';
} }
$qty = GETPOST('qty'.$predef); $qty = price2num(GETPOST('qty'.$predef), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
// Extrafields // Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -2314,7 +2309,7 @@ if (empty($reshook))
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
// Check price is not lower than minimum (check is done only for standard or replacement invoices) // Check price is not lower than minimum (check is done only for standard or replacement invoices)
if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) {
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
$error++; $error++;
} }
@ -2367,7 +2362,7 @@ if (empty($reshook))
} }
} }
$result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent', 'alpha')), $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')), GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')),
GETPOST('units', 'alpha'), $pu_ht_devise); GETPOST('units', 'alpha'), $pu_ht_devise);

View File

@ -416,7 +416,7 @@ $formcompany = new FormCompany($db);
$thirdpartystatic = new Societe($db); $thirdpartystatic = new Societe($db);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql .= ' f.fk_user_author,'; $sql .= ' f.fk_user_author,';

View File

@ -193,11 +193,19 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$companystatic = new Societe($db); $companystatic = new Societe($db);
$i = 0; $i = 0;
$othernb = 0;
$tot_ttc = 0; $tot_ttc = 0;
while ($i < $num) while ($i < $num && $i < $conf->liste_limit)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$tmpinvoice->id = $obj->rowid; $tmpinvoice->id = $obj->rowid;
$tmpinvoice->ref = $obj->ref; $tmpinvoice->ref = $obj->ref;
$tmpinvoice->date = $db->jdate($obj->date); $tmpinvoice->date = $db->jdate($obj->date);
@ -232,6 +240,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="3">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
print '<td colspan="2" class="right">'.price($tot_ttc).'</td>'; print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -290,11 +306,19 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic = new Societe($db); $companystatic = new Societe($db);
$i = 0; $i = 0;
$othernb = 0;
$tot_ttc = 0; $tot_ttc = 0;
while ($i < $num) while ($i < $num && $i < $conf->liste_limit)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($i >= $max) {
$othernb += 1;
$i++;
$tot_ttc += $obj->total_ttc;
continue;
}
$facturesupplierstatic->ref = $obj->ref; $facturesupplierstatic->ref = $obj->ref;
$facturesupplierstatic->id = $obj->rowid; $facturesupplierstatic->id = $obj->rowid;
$facturesupplierstatic->total_ht = $obj->total_ht; $facturesupplierstatic->total_ht = $obj->total_ht;
@ -328,6 +352,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$i++; $i++;
} }
if ($othernb) {
print '<tr class="oddeven">';
print '<td class="nowrap" colspan="3">';
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td class="left">'.$langs->trans("Total").'</td>';
print '<td colspan="2" class="right">'.price($tot_ttc).'</td>'; print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
print '</tr>'; print '</tr>';

View File

@ -46,9 +46,15 @@ class Cchargesociales
/** /**
* @var string Label * @var string Label
* @deprecated
*/ */
public $libelle; public $libelle;
/**
* @var string Label
*/
public $label;
public $deductible; public $deductible;
public $active; public $active;
public $code; public $code;
@ -107,7 +113,6 @@ class Cchargesociales
// Insert request // Insert request
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
$sql .= 'libelle,'; $sql .= 'libelle,';
$sql .= 'deductible,'; $sql .= 'deductible,';
$sql .= 'active,'; $sql .= 'active,';
@ -115,10 +120,7 @@ class Cchargesociales
$sql .= 'fk_pays,'; $sql .= 'fk_pays,';
$sql .= 'module'; $sql .= 'module';
$sql .= 'accountancy_code'; $sql .= 'accountancy_code';
$sql .= ') VALUES ('; $sql .= ') VALUES (';
$sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").','; $sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).','; $sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).',';
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).','; $sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).',';
@ -126,8 +128,6 @@ class Cchargesociales
$sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).','; $sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).',';
$sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").','; $sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").',';
$sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'"); $sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'");
$sql .= ')'; $sql .= ')';
$this->db->begin(); $this->db->begin();
@ -179,7 +179,7 @@ class Cchargesociales
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " t.id,"; $sql .= " t.id,";
$sql .= " t.libelle,"; $sql .= " t.libelle as label,";
$sql .= " t.deductible,"; $sql .= " t.deductible,";
$sql .= " t.active,"; $sql .= " t.active,";
$sql .= " t.code,"; $sql .= " t.code,";
@ -201,7 +201,8 @@ class Cchargesociales
$this->id = $obj->id; $this->id = $obj->id;
$this->libelle = $obj->libelle; $this->libelle = $obj->label;
$this->label = $obj->label;
$this->deductible = $obj->deductible; $this->deductible = $obj->deductible;
$this->active = $obj->active; $this->active = $obj->active;
$this->code = $obj->code; $this->code = $obj->code;
@ -501,6 +502,7 @@ class Cchargesociales
$this->id = 0; $this->id = 0;
$this->libelle = ''; $this->libelle = '';
$this->label = '';
$this->deductible = ''; $this->deductible = '';
$this->active = ''; $this->active = '';
$this->code = ''; $this->code = '';

View File

@ -108,6 +108,11 @@ class ChargeSociales extends CommonObject
*/ */
public $fk_project; public $fk_project;
/**
* @var int ID
*/
public $fk_user;
const STATUS_UNPAID = 0; const STATUS_UNPAID = 0;
const STATUS_PAID = 1; const STATUS_PAID = 1;
@ -135,7 +140,7 @@ class ChargeSociales extends CommonObject
$sql = "SELECT cs.rowid, cs.date_ech"; $sql = "SELECT cs.rowid, cs.date_ech";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
$sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user"; $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user";
$sql .= ", c.libelle"; $sql .= ", c.libelle as type_label";
$sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
@ -158,7 +163,7 @@ class ChargeSociales extends CommonObject
$this->lib = $obj->label; $this->lib = $obj->label;
$this->label = $obj->label; $this->label = $obj->label;
$this->type = $obj->fk_type; $this->type = $obj->fk_type;
$this->type_label = $obj->libelle; $this->type_label = $obj->type_label;
$this->fk_account = $obj->fk_account; $this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;

View File

@ -46,6 +46,11 @@ class PaymentSocialContribution extends CommonObject
*/ */
public $picto = 'payment'; public $picto = 'payment';
/**
* @var string Label
*/
public $label;
/** /**
* @var int ID * @var int ID
*/ */
@ -679,7 +684,7 @@ class PaymentSocialContribution extends CommonObject
$result = ''; $result = '';
if (empty($this->ref)) $this->ref = $this->lib; if (empty($this->ref)) $this->ref = $this->label;
$label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>'; $label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;

View File

@ -149,7 +149,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("SocialContributions")); llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, "; $sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, ";
$sql .= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,"; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,"; $sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed"; $sql .= " SUM(pc.amount) as alreadypayed";
@ -381,7 +381,7 @@ while ($i < min($num, $limit))
$chargesociale_static->id = $obj->rowid; $chargesociale_static->id = $obj->rowid;
$chargesociale_static->ref = $obj->rowid; $chargesociale_static->ref = $obj->rowid;
$chargesociale_static->label = $obj->libelle; $chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label; $chargesociale_static->type_label = $obj->type_label;
if (!empty($conf->projet->enabled)) { if (!empty($conf->projet->enabled)) {
$projectstatic->id = $obj->project_id; $projectstatic->id = $obj->project_id;
@ -405,7 +405,7 @@ while ($i < min($num, $limit))
// Label // Label
if (!empty($arrayfields['cs.libelle']['checked'])) { if (!empty($arrayfields['cs.libelle']['checked'])) {
print '<td>'.dol_trunc($obj->libelle, 42).'</td>'; print '<td>'.dol_trunc($obj->label, 42).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -44,12 +44,12 @@ $nbofyear = 4;
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int');
if (empty($year)) if (empty($year))
{ {
$year_current = strftime("%Y", dol_now()); $year_current = dol_print_date(dol_now(), "%Y");
$month_current = strftime("%m", dol_now()); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year_current - ($nbofyear - 1); $year_start = $year_current - ($nbofyear - 1);
} else { } else {
$year_current = $year; $year_current = $year;
$month_current = strftime("%m", dol_now()); $month_current = dol_print_date(dol_now(), "%m");
$year_start = $year - ($nbofyear - 1); $year_start = $year - ($nbofyear - 1);
} }
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -58,12 +58,12 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// We define date_start and date_end // We define date_start and date_end
if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{ {
$q = GETPOST("q") ?GETPOST("q") : 0; $q = GETPOST("q") ? GETPOST("q") : 0;
if ($q == 0) if ($q == 0)
{ {
// We define date_start and date_end // We define date_start and date_end
$year_end = $year_start + ($nbofyear - 1); $year_end = $year_start + ($nbofyear - 1);
$month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1);
if (!GETPOST('month')) if (!GETPOST('month'))
{ {
if (!GETPOST("year") && $month_start > $month_current) if (!GETPOST("year") && $month_start > $month_current)
@ -86,8 +86,10 @@ $userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$tmps = dol_getdate($date_start); $tmps = dol_getdate($date_start);
$mothn_start = $tmps['mon'];
$year_start = $tmps['year']; $year_start = $tmps['year'];
$tmpe = dol_getdate($date_end); $tmpe = dol_getdate($date_end);
$month_end = $tmpe['mon'];
$year_end = $tmpe['year']; $year_end = $tmpe['year'];
$nbofyear = ($year_end - $year_start) + 1; $nbofyear = ($year_end - $year_start) + 1;
@ -306,7 +308,7 @@ $now = dol_now();
$casenow = dol_print_date($now, "%Y-%m"); $casenow = dol_print_date($now, "%Y-%m");
// Loop on each month // Loop on each month
$nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0; $nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1));
for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
{ {
$mois_modulo = $mois; // ajout $mois_modulo = $mois; // ajout
@ -338,68 +340,75 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output. if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output.
{ {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Valeur CA du mois w/o VAT // Value turnover of month w/o VAT
print '<td class="right">'; print '<td class="right">';
if ($cum_ht[$case]) if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
{ if ($cum_ht[$case]) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>'; print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
} else { } else {
if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print '&nbsp;'; } if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print '&nbsp;'; }
}
} }
print "</td>"; print "</td>";
} }
// Valeur CA du mois // Value turnover of month
print '<td class="right">'; print '<td class="right">';
if ($cum[$case]) if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
{ if ($cum[$case]) {
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
if ($modecompta != 'BOOKKEEPING') print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'; if ($modecompta != 'BOOKKEEPING') print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
print price($cum[$case], 1); print price($cum[$case], 1);
if ($modecompta != 'BOOKKEEPING') print '</a>'; if ($modecompta != 'BOOKKEEPING') print '</a>';
} else { } else {
if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print '&nbsp;'; } if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print '&nbsp;'; }
}
} }
print "</td>"; print "</td>";
// Pourcentage du mois // Percentage of month
if ($annee_decalage > $minyear && $case <= $casenow) print '<td class="borderrightlight right">';
{ //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
if ($cum[$caseprev] && $cum[$case]) if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
if ($annee_decalage > $minyear && $case <= $casenow)
{ {
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100); if ($cum[$caseprev] && $cum[$case])
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; {
print '<td class="borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>'; $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print ($percent >= 0 ? "+$percent" : "$percent").'%';
}
if ($cum[$caseprev] && !$cum[$case])
{
print '-100%';
}
if (!$cum[$caseprev] && $cum[$case])
{
//print '<td class="right">+Inf%</td>';
print '-';
}
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
{
print '+0%';
}
if (!isset($cum[$caseprev]) && !$cum[$case])
{
print '-';
}
} else {
if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print '&nbsp;'; }
} }
if ($cum[$caseprev] && !$cum[$case])
{
print '<td class="borderrightlight right">-100%</td>';
}
if (!$cum[$caseprev] && $cum[$case])
{
//print '<td class="right">+Inf%</td>';
print '<td class="borderrightlight right">-</td>';
}
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case])
{
print '<td class="borderrightlight right">+0%</td>';
}
if (!isset($cum[$caseprev]) && !$cum[$case])
{
print '<td class="borderrightlight right">-</td>';
}
} else {
print '<td class="borderrightlight right">';
if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print '&nbsp;'; }
print '</td>';
} }
print '</td>';
if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '<td width="15">&nbsp;</td>'; if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print '<td width="15">&nbsp;</td>';
} }
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0); if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
$total[$annee] += $cum[$case]; $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
$total[$annee] += $cum[$case];
}
} }
print '</tr>'; print '</tr>';
@ -470,34 +479,37 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
} }
*/ */
// Affiche total // Show total
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td>';
for ($annee = $year_start; $annee <= $year_end; $annee++) for ($annee = $year_start; $annee <= $year_end; $annee++)
{ {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
// Montant total HT // Montant total HT
if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
{ print '<td class="nowrap right">';
print '<td class="nowrap right">'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."</td>"; print ($total_ht[$annee] ?price($total_ht[$annee]) : "0");
print "</td>";
} else { } else {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
} }
// Montant total // Total amount
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
{ print '<td class="nowrap right">';
print '<td class="nowrap right">'.($total[$annee] ?price($total[$annee]) : "0")."</td>"; print ($total[$annee] ?price($total[$annee]) : "0");
print "</td>";
} else { } else {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
// Pourcentage total // Pourcentage total
if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) {
{
if ($total[$annee - 1] && $total[$annee]) { if ($total[$annee - 1] && $total[$annee]) {
$percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100); $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100);
print '<td class="nowrap borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>'; print '<td class="nowrap borderrightlight right">';
print ($percent >= 0 ? "+$percent" : "$percent").'%';
print '</td>';
} }
if ($total[$annee - 1] && !$total[$annee]) if ($total[$annee - 1] && !$total[$annee])
{ {

View File

@ -213,7 +213,7 @@ if (empty($reshook))
$object->note_private = GETPOST('note_private', 'alpha'); $object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->remise_percent = GETPOST('remise_percent', 'alpha'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->ref = GETPOST('ref', 'alpha'); $object->ref = GETPOST('ref', 'alpha');
$object->ref_customer = GETPOST('ref_customer', 'alpha'); $object->ref_customer = GETPOST('ref_customer', 'alpha');
$object->ref_supplier = GETPOST('ref_supplier', 'alpha'); $object->ref_supplier = GETPOST('ref_supplier', 'alpha');
@ -396,7 +396,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0);
if ($qty == '') if ($qty == '')
{ {
@ -673,10 +673,10 @@ if (empty($reshook))
$objectline->fk_product = GETPOST('idprod', 'int'); $objectline->fk_product = GETPOST('idprod', 'int');
$objectline->description = GETPOST('product_desc', 'restricthtml'); $objectline->description = GETPOST('product_desc', 'restricthtml');
$objectline->price_ht = GETPOST('elprice'); $objectline->price_ht = price2num(GETPOST('elprice'), 'MU');
$objectline->subprice = GETPOST('elprice'); $objectline->subprice = price2num(GETPOST('elprice'), 'MU');
$objectline->qty = GETPOST('elqty'); $objectline->qty = price2num(GETPOST('elqty'), 'MS');
$objectline->remise_percent = GETPOST('elremise_percent'); $objectline->remise_percent = price2num(GETPOST('elremise_percent'), 2);
$objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0 $objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code = $vat_src_code; $objectline->vat_src_code = $vat_src_code;
$objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0; $objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0;

View File

@ -134,7 +134,7 @@ class box_last_ticket extends ModeleBoxes
$thirdparty->name = $objp->company_name; $thirdparty->name = $objp->company_name;
$link = $thirdparty->getNomUrl(1); $link = $thirdparty->getNomUrl(1);
} else { } else {
$link = dol_print_email($objp->origin_email); $link = '<span title="'.$objp->origin_email.'">'.dol_print_email($objp->origin_email).'</span>';
} }
$r = 0; $r = 0;
@ -149,15 +149,15 @@ class box_last_ticket extends ModeleBoxes
// Subject // Subject
$this->info_box_contents[$i][$r] = array( $this->info_box_contents[$i][$r] = array(
'td' => '', 'td' => 'class="tdoverflowmax200"',
'text' => $objp->subject, // Some event have no ref 'text' => '<span title="'.$objp->subject.'">'.$objp->subject.'</span>', // Some event have no ref
'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id, 'url' => DOL_URL_ROOT."/ticket/card.php?track_id=".$objp->track_id,
); );
$r++; $r++;
// Customer // Customer
$this->info_box_contents[$i][$r] = array( $this->info_box_contents[$i][$r] = array(
'td' => '', 'td' => 'class="tdoverflowmax100"',
'text' => $link, 'text' => $link,
'asis' => 1, 'asis' => 1,
); );

View File

@ -5428,6 +5428,7 @@ abstract class CommonObject
$mandatorypb = false; $mandatorypb = false;
if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb = true; if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb = true;
if ($this->array_options[$key] === '') $mandatorypb = true; if ($this->array_options[$key] === '') $mandatorypb = true;
if ($attributeType == 'sellist' && $this->array_options[$key] == '0') $mandatorypb = true;
if ($mandatorypb) if ($mandatorypb)
{ {
dol_syslog("Mandatory extra field ".$key." is empty"); dol_syslog("Mandatory extra field ".$key." is empty");
@ -7042,10 +7043,10 @@ abstract class CommonObject
$labeltoshow = $langs->trans($label); $labeltoshow = $langs->trans($label);
$helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]);
if ($display_type=='card') { if ($display_type == 'card') {
$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >'; $out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
$out .= '<td class="wordbreak'; $out .= '<td class="wordbreak';
} elseif ($display_type=='line') { } elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >'; $out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >';
$out .= '<div style="display: inline-block; padding-right:4px" class="wordbreak'; $out .= '<div style="display: inline-block; padding-right:4px" class="wordbreak';
} }
@ -7065,12 +7066,12 @@ abstract class CommonObject
else $out .= $labeltoshow; else $out .= $labeltoshow;
} }
$out .= ($display_type=='card' ? '</td>' : '</div>'); $out .= ($display_type == 'card' ? '</td>' : '</div>');
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : ''; $html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
if ($display_type=='card') { if ($display_type == 'card') {
$out .= '<td '.($html_id ? 'id="'.$html_id.'" ' : '').' class="'.$this->element.'_extras_'.$key.'" '.($colspan ? ' colspan="'.$colspan.'"' : '').'>'; $out .= '<td '.($html_id ? 'id="'.$html_id.'" ' : '').' class="'.$this->element.'_extras_'.$key.'" '.($colspan ? ' colspan="'.$colspan.'"' : '').'>';
} elseif ($display_type=='line') { } elseif ($display_type == 'line') {
$out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').' style="display: inline-block" class="'.$this->element.'_extras_'.$key.'">'; $out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').' style="display: inline-block" class="'.$this->element.'_extras_'.$key.'">';
} }

View File

@ -1955,9 +1955,9 @@ class ExtraFields
$collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); $collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'')] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true));
$extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:''); $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:'');
$out .= '<!-- Add js script to manage the collpase/uncollapse of extrafields separators '.$key.' -->'; $out .= '<!-- Add js script to manage the collapse/uncollapse of extrafields separators '.$key.' -->'."\n";
$out .= '<script type="text/javascript">'; $out .= '<script type="text/javascript">'."\n";
$out .= 'jQuery(document).ready(function(){'; $out .= 'jQuery(document).ready(function(){'."\n";
if ($collapse_display === false) { if ($collapse_display === false) {
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.'").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n"; $out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
@ -1966,6 +1966,7 @@ class ExtraFields
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n"; $out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
} }
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'").click(function(){'."\n";
$out .= ' console.log("We click on collapse/uncollapse .trextrafields_collapse'.$extrafields_collapse_num.'");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n"; $out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").toggle(300, function(){'."\n";
$out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n"; $out .= ' if (jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").is(":hidden")) {'."\n";
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-plus-square").removeClass("fa-minus-square");'."\n";
@ -1974,10 +1975,10 @@ class ExtraFields
$out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').' '.$tagtype_dyn.' span").addClass("fa-minus-square").removeClass("fa-plus-square");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'').'=1; path='.$_SERVER["PHP_SELF"].'"'."\n"; $out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.(!empty($object->id)?'_'.$object->id:'').'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
$out .= ' }'."\n"; $out .= ' }'."\n";
$out .= ' });'; $out .= ' });'."\n";
$out .= ' });'; $out .= ' });'."\n";
$out .= '});'; $out .= '});'."\n";
$out .= '</script>'; $out .= '</script>'."\n";
} }
} }
} }
@ -2030,9 +2031,12 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{ {
// Check if empty without using GETPOST, value can be alpha, int, array, etc... // Check if functionally empty without using GETPOST (depending on the type of extrafield, a
if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') // technically non-empty value may be treated as empty functionally).
|| (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') // value can be alpha, int, array, etc...
if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0')
|| (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select')
|| (!is_array($_POST["options_".$key]) && isset($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'sellist' && $_POST['options_'.$key] == '0')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
{ {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];

View File

@ -1448,7 +1448,7 @@ class Form
* @param string $htmlid Html id to use instead of htmlname * @param string $htmlid Html id to use instead of htmlname
* @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param integer $disableifempty Set tag 'disabled' on select if there is no choice * @param integer $disableifempty Set tag 'disabled' on select if there is no choice
* @return int <0 if KO, Nb of contact in list if OK * @return int|string <0 if KO, HTML with select string if OK.
*/ */
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0)
{ {
@ -5611,7 +5611,7 @@ class Form
* @param int $stepminutes Specify step for minutes between 1 and 30 * @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter. * @param string $labeladddateof Label to use for the $adddateof parameter.
* @param string $placeholder Placeholder * @param string $placeholder Placeholder
* @param mixed $gm 'auto', 'gmt' or 'tzserver' or 'tzuserrel' * @param mixed $gm 'auto' (for backward compatibility, avoid this), 'gmt' or 'tzserver' or 'tzuserrel'
* @return string Html for selectDate * @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek() * @see form_date(), select_month(), select_year(), select_dayofweek()
*/ */
@ -5619,8 +5619,8 @@ class Form
{ {
global $conf, $langs; global $conf, $langs;
if ($gm == 'auto') { if ($gm === 'auto') {
$gm = $conf->tzuserinputkey; $gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
} }
$retstring = ''; $retstring = '';

View File

@ -202,11 +202,10 @@ class FormActions
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{ {
$url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage); $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog'), 'tzuser').'&amp;origin='.urlencode($typeelement).'&amp;originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&amp;socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage);
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url);
} }
print '<!-- formactions->showactions -->'."\n"; print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter); print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter);

View File

@ -514,9 +514,9 @@ function dol_get_last_day($year, $month = 12, $gm = false)
} }
/** /**
* Return GMT time for last hour of a given GMT date (it removes hours, min and second part) * Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59)
* *
* @param int $date Date * @param int $date Date GMT
* @return int Date for last hour of a given date * @return int Date for last hour of a given date
*/ */
function dol_get_last_hour($date) function dol_get_last_hour($date)

View File

@ -2209,9 +2209,10 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto',
{ {
global $conf; global $conf;
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
//print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'<br>';
if ($gm == 'auto') { if ($gm === 'auto') {
$gm = $conf->tzuserinputkey; $gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
} }
// Clean parameters // Clean parameters
@ -2273,7 +2274,7 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto',
/** /**
* Return date for now. In most cases, we use this function without parameters (that means GMT time). * Return date for now. In most cases, we use this function without parameters (that means GMT time).
* *
* @param string $mode 'auto' * @param string $mode 'auto' => for backward compatibility (avoid this),
* 'gmt' => we return GMT timestamp, * 'gmt' => we return GMT timestamp,
* 'tzserver' => we add the PHP server timezone * 'tzserver' => we add the PHP server timezone
* 'tzref' => we add the company timezone. Not implemented. * 'tzref' => we add the company timezone. Not implemented.
@ -2284,8 +2285,8 @@ function dol_now($mode = 'auto')
{ {
$ret = 0; $ret = 0;
if ($mode == 'auto') { if ($mode === 'auto') {
$mode = 'tzserver'; $mode = 'gmt';
} }
if ($mode == 'gmt') $ret = time(); // Time for now at greenwich. if ($mode == 'gmt') $ret = time(); // Time for now at greenwich.
@ -4830,13 +4831,13 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
* should be roundtext2num(). * should be roundtext2num().
* *
* @param string|float $amount Amount to convert/clean or round * @param string|float $amount Amount to convert/clean or round
* @param string $rounding ''=No rounding * @param string|int $rounding ''=No rounding
* 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT)
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK) * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
* 'CU'=Round to Max unit price of foreign currency accuracy * 'CU'=Round to Max unit price of foreign currency accuracy
* 'CT'=Round to Max for totals with Tax of foreign currency accuracy * 'CT'=Round to Max for totals with Tax of foreign currency accuracy
* Numeric = Nb of digits for rounding * Numeric = Nb of digits for rounding (For example 2 for a percentage)
* @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done) * @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
* Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator). * Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator).
* @return string Amount with universal numeric format (Example: '99.99999'). * @return string Amount with universal numeric format (Example: '99.99999').
@ -4911,7 +4912,7 @@ function price2num($amount, $rounding = '', $option = 0)
elseif ($rounding == 'CT') { elseif ($rounding == 'CT') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency
} }
elseif (is_numeric($rounding)) $nbofdectoround = $rounding; elseif (is_numeric($rounding)) $nbofdectoround = (int) $rounding;
//print "RR".$amount.' - '.$nbofdectoround.'<br>'; //print "RR".$amount.' - '.$nbofdectoround.'<br>';
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
else return 'ErrorBadParameterProvidedToFunction'; else return 'ErrorBadParameterProvidedToFunction';
@ -5652,7 +5653,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '
$arrayforoldpath = array('cheque', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment'); $arrayforoldpath = array('cheque', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment');
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[] = 'product'; if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[] = 'product';
if (!empty($level) && in_array($modulepart, $arrayforoldpath)) { if (!empty($level) && in_array($modulepart, $arrayforoldpath)) {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided. // This part should be removed once all code is using "get_exdir" to forge path, with parameter $object and $modulepart provided.
if (empty($alpha)) $num = preg_replace('/([^0-9])/i', '', $num); if (empty($alpha)) $num = preg_replace('/([^0-9])/i', '', $num);
else $num = preg_replace('/^.*\-/i', '', $num); else $num = preg_replace('/^.*\-/i', '', $num);
$num = substr("000".$num, -$level); $num = substr("000".$num, -$level);

View File

@ -444,7 +444,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object $checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); $checktask = array('projet_task'); // Test for task object
$nocheck = array('barcode', 'stock'); // No test $nocheck = array('barcode', 'stock'); // No test
//$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). //$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...).
@ -582,29 +582,35 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
} elseif (!in_array($feature, $nocheck)) // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield } elseif (!in_array($feature, $nocheck)) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
{
// If external user: Check permission for external users // If external user: Check permission for external users
if ($user->socid > 0) if ($user->socid > 0) {
{
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined'); if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb"; $sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " WHERE dbt.rowid IN (".$objectid.")"; $sql .= " WHERE dbt.rowid IN (".$objectid.")";
$sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid; $sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid;
} // If internal user: Check permission for internal users that are restricted on their objects } elseif (!empty($conf->societe->enabled)) {
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) // If internal user: Check permission for internal users that are restricted on their objects
{ if ($feature != 'ticket' && !$user->rights->societe->client->voir) {
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined'); if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(sc.fk_soc) as nb"; $sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield; $sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield;
$sql .= " AND dbt.".$dbt_keyfield." = s.rowid"; $sql .= " AND sc.fk_user = ".$user->id;
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; }
$sql .= " AND sc.fk_user = ".$user->id; // On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
if ($feature == 'ticket' && !$user->rights->societe->client->voir) {
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = dbt.".$dbt_keyfield." AND sc.fk_user = ".$user->id;
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql .= " AND (sc.fk_user = ".$user->id." OR sc.fk_user IS NULL)";
}
} // If multicompany and internal users with all permissions, check user is in correct entity } // If multicompany and internal users with all permissions, check user is in correct entity
elseif (!empty($conf->multicompany->enabled)) elseif (!empty($conf->multicompany->enabled))
{ {

View File

@ -283,7 +283,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out = ''; $out = '';
$histo = array(); $histo = array();
$numaction = 0; $numaction = 0;
$now = dol_now('tzuser'); $now = dol_now();
// Open DSI -- Fix order by -- Begin // Open DSI -- Fix order by -- Begin
$sortfield_list = explode(',', $sortfield); $sortfield_list = explode(',', $sortfield);
@ -622,7 +622,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= '<!-- timeline time label -->'; $out .= '<!-- timeline time label -->';
$out .= '<li class="time-label">'; $out .= '<li class="time-label">';
$out .= '<span class="timeline-badge-date">'; $out .= '<span class="timeline-badge-date">';
$out .= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzserver', $langs); $out .= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzuserrel', $langs);
$out .= '</span>'; $out .= '</span>';
$out .= '</li>'; $out .= '</li>';
$out .= '<!-- /.timeline-label -->'; $out .= '<!-- /.timeline-label -->';
@ -660,14 +660,14 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= '</span>'; $out .= '</span>';
// Date // Date
$out .= '<span class="time"><i class="fa fa-clock-o"></i> '; $out .= '<span class="time"><i class="fa fa-clock-o"></i> ';
$out .= dol_print_date($histo[$key]['datestart'], 'dayhour'); $out .= dol_print_date($histo[$key]['datestart'], 'dayhour', 'tzuserrel');
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) { if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
$tmpa = dol_getdate($histo[$key]['datestart'], true); $tmpa = dol_getdate($histo[$key]['datestart'], true);
$tmpb = dol_getdate($histo[$key]['dateend'], true); $tmpb = dol_getdate($histo[$key]['dateend'], true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) { if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour'); $out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour', 'tzuserrel');
} else { } else {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour'); $out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour', 'tzuserrel');
} }
} }
$late = 0; $late = 0;

View File

@ -177,6 +177,7 @@ class modTicket extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'manage'; $this->rights[$r][4] = 'manage';
/* Seems not used and in conflict with societe->client->voir (see all thirdparties)
$r++; $r++;
$this->rights[$r][0] = 56005; // id de la permission $this->rights[$r][0] = 56005; // id de la permission
$this->rights[$r][1] = 'See all tickets, even if not assigned to (not effective for external users, always restricted to the thirdpardy they depends on)'; // libelle de la permission $this->rights[$r][1] = 'See all tickets, even if not assigned to (not effective for external users, always restricted to the thirdpardy they depends on)'; // libelle de la permission
@ -184,6 +185,7 @@ class modTicket extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'view'; $this->rights[$r][4] = 'view';
$this->rights[$r][5] = 'all'; $this->rights[$r][5] = 'all';
*/
// Main menu entries // Main menu entries
$this->menus = array(); // List of menus to add $this->menus = array(); // List of menus to add

View File

@ -321,24 +321,6 @@ class pdf_standardlabel extends CommonStickerGenerator
if (!empty($conf->global->MAIN_UMASK)) if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
// Output to http stream
clearstatcache();
$attachment = true;
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
$type = dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);
return 1; return 1;

View File

@ -359,23 +359,6 @@ class pdf_tcpdflabel extends CommonStickerGenerator
if (!empty($conf->global->MAIN_UMASK)) if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
// Output to http stream
clearstatcache();
$attachment = true;
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
$type = dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
$this->result = array('fullpath'=>$file); $this->result = array('fullpath'=>$file);

View File

@ -150,6 +150,27 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp
if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0) if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0)
{ {
$outputlangs->charset_output = $sav_charset_output; $outputlangs->charset_output = $sav_charset_output;
$fullpath = $obj->result['fullpath'];
// Output to http stream
clearstatcache();
$attachment = true;
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
$type = dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($fullpath);
return 1; return 1;
} else { } else {
$outputlangs->charset_output = $sav_charset_output; $outputlangs->charset_output = $sav_charset_output;

View File

@ -112,7 +112,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$lastseparatorkeyfound = $tmpkeyextra; $lastseparatorkeyfound = $tmpkeyextra;
} else { } else {
print '<tr class="trextrafields_collapse'.$extrafields_collapse_num; print '<tr class="trextrafields_collapse'.$extrafields_collapse_num.(!empty($object->id)?'_'.$object->id:'');
/*if ($extrafields_collapse_num && $extrafields_collapse_num_old && $extrafields_collapse_num != $extrafields_collapse_num_old) { /*if ($extrafields_collapse_num && $extrafields_collapse_num_old && $extrafields_collapse_num != $extrafields_collapse_num_old) {
print ' trextrafields_collapse_new'; print ' trextrafields_collapse_new';
}*/ }*/

View File

@ -271,9 +271,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers
} }
} }
//Build array of quantity ordered by product //Build array of quantity ordered to be shipped
if (is_array($order->lines) && count($order->lines) > 0) { if (is_array($order->lines) && count($order->lines) > 0) {
foreach ($order->lines as $orderline) { foreach ($order->lines as $orderline) {
// Exclude lines not qualified for shipment, similar code is found into calcAndSetStatusDispatch() for vendors
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue; if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue;
$qtyordred[$orderline->fk_product] += $orderline->qty; $qtyordred[$orderline->fk_product] += $orderline->qty;
} }

View File

@ -211,8 +211,9 @@ $helpurl = 'EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Ex
llxHeader('', $langs->trans('ListOfSendings'), $helpurl); llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, e.fk_statut, e.billed, e.tracking_number,";
$sql .= " l.date_delivery as date_reception,";
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";
@ -242,11 +243,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid =
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid';
if ($search_user > 0) { // Get link to order to get the order id in eesource.fk_source
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'";
}
// We'll need this table joined to the select in order to filter by sale // We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0) if ($search_user > 0) {
{
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
} }
@ -274,6 +276,11 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_tracking) $sql .= natural_search("e.tracking_number", $search_tracking); if ($search_tracking) $sql .= natural_search("e.tracking_number", $search_tracking);
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
if ($search_user > 0)
{
// The contact on a shipment is also the contact of the order.
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".$db->escape($search_user);
}
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);

View File

@ -3132,13 +3132,12 @@ class CommandeFournisseur extends CommonOrder
} }
$ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter); $ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter);
if ($ret < 0) if ($ret < 0) {
{
$this->error = $supplierorderdispatch->error; $this->errors = $supplierorderdispatch->errors; $this->error = $supplierorderdispatch->error; $this->errors = $supplierorderdispatch->errors;
return $ret; return $ret;
} else { } else {
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines) > 0) if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines) > 0) {
{ require_once DOL_DOCUMENT_ROOT.'/htdocs/product/class/product.class.php';
$date_liv = dol_now(); $date_liv = dol_now();
// Build array with quantity deliverd by product // Build array with quantity deliverd by product
@ -3146,13 +3145,17 @@ class CommandeFournisseur extends CommonOrder
$qtydelivered[$line->fk_product] += $line->qty; $qtydelivered[$line->fk_product] += $line->qty;
} }
foreach ($this->lines as $line) { foreach ($this->lines as $line) {
// Exclude lines not qualified for shipment, similar code is found into interface_20_modWrokflow for customers
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $line->product_type > 0) continue;
$qtywished[$line->fk_product] += $line->qty; $qtywished[$line->fk_product] += $line->qty;
} }
//Compare array //Compare array
$diff_array = array_diff_assoc($qtydelivered, $qtywished); // Warning: $diff_array is done only on common keys. $diff_array = array_diff_assoc($qtydelivered, $qtywished); // Warning: $diff_array is done only on common keys.
$keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys $keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys
$keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys $keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys
/*var_dump(array_keys($qtydelivered)); /*var_dump(array_keys($qtydelivered));
var_dump(array_keys($qtywished)); var_dump(array_keys($qtywished));
var_dump($diff_array); var_dump($diff_array);
var_dump($keysinwishednotindelivered); var_dump($keysinwishednotindelivered);

View File

@ -372,7 +372,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
// Extrafields // Extrafields
@ -721,21 +721,21 @@ if (empty($reshook))
$result = $object->updateline( $result = $object->updateline(
$lineid, $lineid,
$_POST['product_desc'], GETPOST('product_desc', 'restricthtml'),
$ht, $ht,
GETPOST('qty', 'int'), price2num(GETPOST('qty'), 'MS'),
$_POST['remise_percent'], price2num(GETPOST('remise_percent'), 2),
$vat_rate, $vat_rate,
$localtax1_rate, $localtax1_rate,
$localtax2_rate, $localtax2_rate,
$price_base_type, $price_base_type,
0, 0,
isset($_POST["type"]) ? $_POST["type"] : $line->product_type, GETPOSTISSET("type") ? GETPOST("type") : $line->product_type,
false, false,
$date_start, $date_start,
$date_end, $date_end,
$array_options, $array_options,
$_POST['units'], GETPOST('units'),
$pu_ht_devise, $pu_ht_devise,
GETPOST('fourn_ref', 'alpha') GETPOST('fourn_ref', 'alpha')
); );

View File

@ -535,7 +535,7 @@ $help_url = '';
// llxHeader('',$title,$help_url); // llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,'; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";

View File

@ -666,7 +666,7 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
$_GET['socid'] = $_POST['socid']; $_GET['socid'] = $_POST['socid'];
$error++; $error++;
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -733,7 +733,7 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
$_GET['socid'] = $_POST['socid']; $_GET['socid'] = $_POST['socid'];
$error++; $error++;
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -851,7 +851,7 @@ if (empty($reshook))
$action = 'create'; $action = 'create';
$_GET['socid'] = $_POST['socid']; $_GET['socid'] = $_POST['socid'];
$error++; $error++;
} elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create'; $action = 'create';
@ -1137,8 +1137,8 @@ if (empty($reshook))
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
$remise_percent = GETPOST('remise_percent'); $remise_percent = price2num(GETPOST('remise_percent'), 2);
$pu_ht_devise = GETPOST('multicurrency_subprice'); $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU');
// Extrafields Lines // Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1150,7 +1150,7 @@ if (empty($reshook))
} }
} }
$result = $object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha')); $result = $object->updateline(GETPOST('lineid', 'int'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, price2num(GETPOST('qty'), 'MS'), GETPOST('productid', 'int'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, GETPOST('units'), $pu_ht_devise, GETPOST('fourn_ref', 'alpha'));
if ($result >= 0) if ($result >= 0)
{ {
unset($_POST['label']); unset($_POST['label']);
@ -1206,7 +1206,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
// Extrafields // Extrafields

View File

@ -419,8 +419,10 @@ ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255);
DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS'); DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS');
UPDATE llx_projet_task_time SET tms = null WHERE tms = 0;
ALTER TABLE llx_projet_task_time MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; -- VMYSQL4.1 UPDATE llx_projet_task_time SET tms = null WHERE tms = 0;
ALTER TABLE llx_projet_task_time CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime; ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
@ -436,12 +438,19 @@ CREATE TABLE llx_c_product_nature (
active tinyint DEFAULT 1 NOT NULL active tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_c_product_nature ADD UNIQUE INDEX uk_c_product_nature(code, active);
ALTER TABLE llx_product DROP FOREIGN KEY fk_product_finished;
-- VMYSQL4.1 DROP INDEX uk_c_product_nature on llx_c_product_nature;
-- VPGSQL8.2 DROP INDEX uk_c_product_nature;
ALTER TABLE llx_c_product_nature ADD UNIQUE INDEX uk_c_product_nature(code);
INSERT INTO llx_c_product_nature (code, label, active) VALUES (0, 'RowMaterial', 1); INSERT INTO llx_c_product_nature (code, label, active) VALUES (0, 'RowMaterial', 1);
INSERT INTO llx_c_product_nature (code, label, active) VALUES (1, 'Finished', 1); INSERT INTO llx_c_product_nature (code, label, active) VALUES (1, 'Finished', 1);
ALTER TABLE llx_product MODIFY COLUMN finished tinyint DEFAULT NULL; ALTER TABLE llx_product MODIFY COLUMN finished tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished) REFERENCES llx_c_product_nature (code); ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished) REFERENCES llx_c_product_nature (code);
-- MIGRATION TO DO AFTER RENAMING AN OBJECT -- MIGRATION TO DO AFTER RENAMING AN OBJECT
@ -558,4 +567,3 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;

View File

@ -1 +1,19 @@
ALTER TABLE llx_c_product_nature ADD UNIQUE INDEX uk_c_product_nature(code, active); -- ========================================================================
-- Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ========================================================================
ALTER TABLE llx_c_product_nature ADD UNIQUE INDEX uk_c_product_nature(code);

View File

@ -486,6 +486,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
'MAIN_MODULE_SYSLOG'=>'newboxdefonly', 'MAIN_MODULE_SYSLOG'=>'newboxdefonly',
'MAIN_MODULE_SOCIETE'=>'newboxdefonly', 'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
'MAIN_MODULE_SERVICE'=>'newboxdefonly', 'MAIN_MODULE_SERVICE'=>'newboxdefonly',
'MAIN_MODULE_TICKET'=>'newboxdefonly',
'MAIN_MODULE_TAKEPOS'=>'newboxdefonly', 'MAIN_MODULE_TAKEPOS'=>'newboxdefonly',
'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version) 'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version)
'MAIN_MODULE_VARIANTS'=>'newboxdefonly', 'MAIN_MODULE_VARIANTS'=>'newboxdefonly',

View File

@ -59,6 +59,7 @@ ErrorDirNotFound=Directory <b>%s</b> not found (Bad path, wrong permissions or a
ErrorFunctionNotAvailableInPHP=Function <b>%s</b> is required for this feature but is not available in this version/setup of PHP. ErrorFunctionNotAvailableInPHP=Function <b>%s</b> is required for this feature but is not available in this version/setup of PHP.
ErrorDirAlreadyExists=A directory with this name already exists. ErrorDirAlreadyExists=A directory with this name already exists.
ErrorFileAlreadyExists=A file with this name already exists. ErrorFileAlreadyExists=A file with this name already exists.
ErrorDestinationAlreadyExists=Another file with the name <b>%s</b> already exists.
ErrorPartialFile=File not received completely by server. ErrorPartialFile=File not received completely by server.
ErrorNoTmpDir=Temporary directy %s does not exists. ErrorNoTmpDir=Temporary directy %s does not exists.
ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin. ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin.
@ -255,6 +256,7 @@ ErrorPublicInterfaceNotEnabled=Public interface was not enabled
ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page
ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page
ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation
ErrorDateIsInFuture=Error, the date can't be in the future
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@ -386,7 +386,7 @@ if (!defined('NOLOGIN') && !defined('NOIPCHECK') && !empty($dolibarr_main_restri
// Loading of additional presentation includes // Loading of additional presentation includes
if (!defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) if (!defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory if (!defined('NOREQUIREAJAX')) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory
// If install or upgrade process not done or not completely finished, we call the install page. // If install or upgrade process not done or not completely finished, we call the install page.
if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED))
@ -1890,6 +1890,14 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.$menumanager->name; $dropdownBody .= '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.$menumanager->name;
$langFlag = picto_from_langcode($langs->getDefaultLang()); $langFlag = picto_from_langcode($langs->getDefaultLang());
$dropdownBody .= '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); $dropdownBody .= '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang();
$tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
$dropdownBody .= '<br><b>'.$langs->trans("ClientTZ").':</b> '.($tz ? ($tz >= 0 ? '+' : '').$tz : '');
$dropdownBody .= ' ('.$_SESSION['dol_tz_string'].')';
//$dropdownBody .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': ';
//if ($_SESSION['dol_dst'] > 0) $dropdownBody .= yn(1);
//else $dropdownBody .= yn(0);
$dropdownBody .= '<br><b>'.$langs->trans("Browser").':</b> '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; $dropdownBody .= '<br><b>'.$langs->trans("Browser").':</b> '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')';
$dropdownBody .= '<br><b>'.$langs->trans("Layout").':</b> '.$conf->browser->layout; $dropdownBody .= '<br><b>'.$langs->trans("Layout").':</b> '.$conf->browser->layout;
$dropdownBody .= '<br><b>'.$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; $dropdownBody .= '<br><b>'.$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];

View File

@ -1354,7 +1354,7 @@ class Mo extends CommonObject
*/ */
public static function replaceThirdparty($db, $origin_id, $dest_id) public static function replaceThirdparty($db, $origin_id, $dest_id)
{ {
$tables = array('mrp_production'); $tables = array('mrp_mo');
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
} }

View File

@ -743,7 +743,7 @@ if (empty($reshook))
if (GETPOST('propalid') > 0) { if (GETPOST('propalid') > 0) {
// Define cost price for margin calculation // Define cost price for margin calculation
$buyprice = 0; $buyprice = 0;
if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), 2), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
@ -754,12 +754,12 @@ if (empty($reshook))
$result = $propal->addline( $result = $propal->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), price2num(GETPOST('qty'), 'MS'),
$tva_tx, $tva_tx,
$localtax1_tx, // localtax1 $localtax1_tx, // localtax1
$localtax2_tx, // localtax2 $localtax2_tx, // localtax2
$object->id, $object->id,
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
$price_base_type, $price_base_type,
$pu_ttc, $pu_ttc,
0, 0,
@ -784,7 +784,7 @@ if (empty($reshook))
} elseif (GETPOST('commandeid') > 0) { } elseif (GETPOST('commandeid') > 0) {
// Define cost price for margin calculation // Define cost price for margin calculation
$buyprice = 0; $buyprice = 0;
if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
@ -795,12 +795,12 @@ if (empty($reshook))
$result = $commande->addline( $result = $commande->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), price2num(GETPOST('qty'), 'MS'),
$tva_tx, $tva_tx,
$localtax1_tx, // localtax1 $localtax1_tx, // localtax1
$localtax2_tx, // localtax2 $localtax2_tx, // localtax2
$object->id, $object->id,
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
'', '',
'', '',
$price_base_type, $price_base_type,
@ -825,7 +825,7 @@ if (empty($reshook))
} elseif (GETPOST('factureid') > 0) { } elseif (GETPOST('factureid') > 0) {
// Define cost price for margin calculation // Define cost price for margin calculation
$buyprice = 0; $buyprice = 0;
if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0)
{ {
dol_syslog($langs->trans('FailedToGetCostPrice')); dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors');
@ -836,12 +836,12 @@ if (empty($reshook))
$result = $facture->addline( $result = $facture->addline(
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), price2nm(GETPOST('qty'), 'MS'),
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$object->id, $object->id,
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
'', '',
'', '',
'', '',

View File

@ -160,7 +160,7 @@ if (empty($reshook))
if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn; if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn;
$quantity = price2num(GETPOST("qty", 'nohtml'), 'MS'); $quantity = price2num(GETPOST("qty", 'nohtml'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent', 'alpha')); $remise_percent = price2num(GETPOST('remise_percent', 'alpha'));
$npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0; $npr = preg_match('/\*/', GETPOST('tva_tx', 'alpha')) ? 1 : 0;
$tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha')); $tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha'));
$tva_tx = price2num($tva_tx); $tva_tx = price2num($tva_tx);
$price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode
@ -697,14 +697,14 @@ END;
print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
print '<td><input class="flat" name="price" size="8" value="'.(GETPOST('price') ? price(GETPOST('price')) : (isset($object->fourn_price) ? price($object->fourn_price) : '')).'">'; print '<td><input class="flat" name="price" size="8" value="'.(GETPOST('price') ? price(GETPOST('price')) : (isset($object->fourn_price) ? price($object->fourn_price) : '')).'">';
print '&nbsp;'; print '&nbsp;';
print $form->selectPriceBaseType((GETPOST('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices
print '</td></tr>'; print '</td></tr>';
} }
// Discount qty min // Discount qty min
print '<tr><td>'.$langs->trans("DiscountQtyMin").'</td>'; print '<tr><td>'.$langs->trans("DiscountQtyMin").'</td>';
print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOST('remise_percent') ?vatrate(GETPOST('remise_percent')) : (isset($object->fourn_remise_percent) ?vatrate($object->fourn_remise_percent) : '')).'"> %'; print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOSTISSET('remise_percent') ? vatrate(price2num(GETPOST('remise_percent'), 2)) : (isset($object->fourn_remise_percent) ?vatrate($object->fourn_remise_percent) : '')).'"> %';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -419,10 +419,10 @@ if (empty($reshook))
// Récupération des variables // Récupération des variables
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$priceid = GETPOST('priceid', 'int'); $priceid = GETPOST('priceid', 'int');
$newprice = price2num(GETPOST("price", 'alpha'), 'MU'); $newprice = price2num(GETPOST("price"), 'MU');
// $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management // $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management
$quantity = GETPOST('quantity', 'int'); $quantity = price2num(GETPOST('quantity'), 'MS');
$remise_percent = price2num(GETPOST('remise_percent', 'alpha')); $remise_percent = price2num(GETPOST('remise_percent'), 2);
$remise = 0; // TODO : allow discount by amount when available on documents $remise = 0; // TODO : allow discount by amount when available on documents
if (empty($quantity)) { if (empty($quantity)) {

View File

@ -119,24 +119,24 @@ class Entrepot extends CommonObject
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15),
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1),
'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1), 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1, 'searchall'=>1),
'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1),
'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50), 'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1),
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55), 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1),
'fk_departement' =>array('type'=>'sellist:c_departements:label:rowid::active=1', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'fk_departement' =>array('type'=>'sellist:c_departements:label:rowid::active=1', 'label'=>'State', 'enabled'=>1, 'visible'=>0, 'position'=>60),
'fk_pays' =>array('type'=>'sellist:c_country:label:rowid::active=1', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65), 'fk_pays' =>array('type'=>'sellist:c_country:label:rowid::active=1', 'label'=>'Country', 'enabled'=>1, 'visible'=>-2, 'position'=>65),
'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70), 'phone' =>array('type'=>'varchar(20)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-2, 'position'=>70, 'searchall'=>1),
'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75), 'fax' =>array('type'=>'varchar(20)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-2, 'position'=>75, 'searchall'=>1),
//'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>301),
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000),
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>200), 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>500),
); );
/** /**

View File

@ -86,18 +86,6 @@ $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
't.ref'=>"Ref",
't.lieu'=>"LocationSummary",
't.description'=>"Description",
't.address'=>"Address",
't.zip'=>'Zip',
't.town'=>'Town',
't.phone'=>'Phone',
't.fax'=>'Fax',
);
// Initialize array of search criterias // Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha'); $search_all = GETPOST("search_all", 'alpha');
$search = array(); $search = array();
@ -108,37 +96,39 @@ foreach ($object->fields as $key => $val)
if (GETPOST('search_'.$search_key, 'alpha') !== '') $search[$search_key] = GETPOST('search_'.$search_key, 'alpha'); if (GETPOST('search_'.$search_key, 'alpha') !== '') $search[$search_key] = GETPOST('search_'.$search_key, 'alpha');
} }
// Definition of fields for list // List of fields to search into when doing a "search in all"
$arrayfields = array( $fieldstosearchall = array();
'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'position'=>70),
'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71),
'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72),
);
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
// If $val['visible']==0, then we never show the field if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
} }
// Extra fields
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) // Definition of array of fields for columns
{ $arrayfields = array(
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'checked'=>0, 'position'=>170),
{ 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>1, 'checked'=>1, 'position'=>171),
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { 'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'checked'=>1, 'visible'=>2, 'position'=>172),
$arrayfields["ef.".$key] = array( );
'label'=>$extrafields->attributes[$object->table_element]['label'][$key], foreach ($object->fields as $key => $val) {
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), // If $val['visible']==0, then we never show the field
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], if (!empty($val['visible'])) {
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]) $visible = (int) dol_eval($val['visible'], 1);
); $arrayfields['t.'.$key] = array(
} 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1),
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
'position'=>$val['position'],
'help'=>$val['help']
);
} }
} }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
/* /*
* Actions * Actions
*/ */

View File

@ -636,13 +636,13 @@ if ($id > 0 || $ref)
// Real stock // Real stock
$text_stock_options = $langs->trans("RealStockDesc").'<br>'; $text_stock_options = $langs->trans("RealStockDesc").'<br>';
$text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'<br>'; $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'<br>';
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? $langs->trans("DeStockOnShipment").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? $langs->trans("DeStockOnValidateOrder").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? $langs->trans("DeStockOnBill").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? $langs->trans("ReStockOnBill").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? $langs->trans("ReStockOnValidateOrder").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? $langs->trans("ReStockOnDispatchOrder").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'<br>' : '');
$text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? $langs->trans("StockOnReception").'<br>' : ''); $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'<br>' : '');
print '<tr><td>'; print '<tr><td>';
print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1);

View File

@ -538,9 +538,9 @@ print dol_get_fiche_head($head, 'replenish', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
} }
print '<br>'; print '<br><br>';
if ($usevirtualstock == 1) if ($usevirtualstock == 1)
{ {
print $langs->trans("CurentSelectionMode").': '; print $langs->trans("CurentSelectionMode").': ';

View File

@ -1361,7 +1361,6 @@ if ($conf->use_javascript_ajax)
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox('.elementselect'); $comboenhancement = ajax_combobox('.elementselect');
$out .= $comboenhancement;
print $comboenhancement; print $comboenhancement;
} }

View File

@ -263,8 +263,8 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->remise_percent = GETPOST('remise_percent'); $object->remise_percent = price2num(GETPOST('remise_percent'), 2);
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU');
$object->socid = GETPOST('socid'); $object->socid = GETPOST('socid');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = GETPOST('projectid', 'int');
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model');
@ -556,7 +556,7 @@ if (empty($reshook))
} }
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = GETPOST('remise_percent'.$predef); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2);
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU');
// Extrafields // Extrafields
@ -929,10 +929,10 @@ if (empty($reshook))
$fk_unit = GETPOST('units'); $fk_unit = GETPOST('units');
$result = $object->updateline( $result = $object->updateline(
GETPOST('lineid'), GETPOST('lineid', 'int'),
$ht, $ht,
GETPOST('qty'), price2num(GETPOST('qty'), 'MS'),
GETPOST('remise_percent'), price2num(GETPOST('remise_percent'), 2),
$vat_rate, $vat_rate,
$localtax1_rate, $localtax1_rate,
$localtax2_rate, $localtax2_rate,
@ -940,7 +940,7 @@ if (empty($reshook))
$price_base_type, $price_base_type,
$info_bits, $info_bits,
$special_code, $special_code,
GETPOST('fk_parent_line'), GETPOST('fk_parent_line', 'int'),
0, 0,
$fournprice, $fournprice,
$buyingprice, $buyingprice,
@ -1018,9 +1018,9 @@ if (empty($reshook))
elseif ($action == 'setconditions' && $usercancreate) { elseif ($action == 'setconditions' && $usercancreate) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise_percent($user, GETPOST('remise_percent', 'alpha')); $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue', 'alpha')); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} }
// Payment mode // Payment mode

View File

@ -249,7 +249,7 @@ $help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
//llxHeader('',$langs->trans('CommRequest'),$help_url); //llxHeader('',$langs->trans('CommRequest'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";

View File

@ -3066,6 +3066,9 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
.smallpaddingimp { .smallpaddingimp {
padding: 4px !important; padding: 4px !important;
} }
input.button.smallpaddingimp {
font-size: 0.8em;
}
.nopaddingleft { .nopaddingleft {
padding-<?php print $left; ?>: 0px; padding-<?php print $left; ?>: 0px;
} }
@ -5662,6 +5665,8 @@ a span.select2-chosen
} }
span#select2-boxbookmark-container, span#select2-boxcombo-container { span#select2-boxbookmark-container, span#select2-boxcombo-container {
text-align: <?php echo $left; ?>; text-align: <?php echo $left; ?>;
}
span#select2-boxbookmark-container {
opacity: 0.4; opacity: 0.4;
} }
.select2-container .select2-selection--single .select2-selection__rendered { .select2-container .select2-selection--single .select2-selection__rendered {

View File

@ -938,14 +938,14 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
// Creation date // Creation date
print '<tr><td>'.$langs->trans("DateCreation").'</td><td>'; print '<tr><td>'.$langs->trans("DateCreation").'</td><td>';
print dol_print_date($object->datec, 'dayhour'); print dol_print_date($object->datec, 'dayhour', 'tzuser');
print '<span class="opacitymedium"> - '.$langs->trans("TimeElapsedSince").': <i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).'</i></span>'; print '<span class="opacitymedium"> - '.$langs->trans("TimeElapsedSince").': <i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).'</i></span>';
print '</td></tr>'; print '</td></tr>';
// Read date // Read date
print '<tr><td>'.$langs->trans("TicketReadOn").'</td><td>'; print '<tr><td>'.$langs->trans("TicketReadOn").'</td><td>';
if (!empty($object->date_read)) { if (!empty($object->date_read)) {
print dol_print_date($object->date_read, 'dayhour'); print dol_print_date($object->date_read, 'dayhour', 'tzuser');
print '<span class="opacitymedium"> - '.$langs->trans("TicketTimeToRead").': <i>'.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).'</i>'; print '<span class="opacitymedium"> - '.$langs->trans("TicketTimeToRead").': <i>'.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).'</i>';
print ' - '.$langs->trans("TimeElapsedSince").': <i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).'</i></span>'; print ' - '.$langs->trans("TimeElapsedSince").': <i>'.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).'</i></span>';
} }
@ -954,7 +954,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
// Close date // Close date
print '<tr><td>'.$langs->trans("TicketCloseOn").'</td><td>'; print '<tr><td>'.$langs->trans("TicketCloseOn").'</td><td>';
if (!empty($object->date_close)) { if (!empty($object->date_close)) {
print dol_print_date($object->date_close, 'dayhour'); print dol_print_date($object->date_close, 'dayhour', 'tzuser');
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -223,9 +223,10 @@ class Ticket extends CommonObject
/** /**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key. * 'label' the translation key.
* 'picto' is code of a picto to show before value in forms
* 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM)
* 'position' is the sort order of field. * 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
@ -236,8 +237,8 @@ class Ticket extends CommonObject
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
* 'css' and 'cssview' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. For example: 'maxwidth200', 'wordbreak' * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
* 'help' is a string visible as a tooltip on field * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
@ -255,16 +256,16 @@ class Ticket extends CommonObject
'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"),
'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'),
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1),
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth150 tdoverflowmax50'), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'),
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"),
'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1),
'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'), 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),

View File

@ -428,7 +428,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page // Output page
// -------------------------------------------------------------------- // --------------------------------------------------------------------
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
@ -811,6 +811,12 @@ while ($i < min($num, $limit))
if ($cssforfield || $val['css']) print '"'; if ($cssforfield || $val['css']) print '"';
print '>'; print '>';
if ($key == 'fk_statut') print $object->getLibStatut(5); if ($key == 'fk_statut') print $object->getLibStatut(5);
elseif ($key == 'subject') {
$s = $obj->subject;
print '<span title="'.$s.'">';
print $s;
print '</span>';
}
elseif ($key == 'type_code') { elseif ($key == 'type_code') {
$s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); $s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
print '<span title="'.$s.'">'; print '<span title="'.$s.'">';