Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into fix_avoid_missing_url_and_token

This commit is contained in:
Regis Houssin 2021-02-23 08:19:18 +01:00
commit 7c32e43c68
225 changed files with 2092 additions and 1421 deletions

116
ChangeLog
View File

@ -3,6 +3,63 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 13.0.1 compared to 13.0.0 *****
FIX: 10.0 before crediting a withdrawal receipt, check whether it has been credited already.
FIX: 11.0 when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: create MO, Column 'tms' cannot be null
FIX: #14290 #15900
FIX: #16076 patch user/list.php for extrafields
FIX: #16077 patch wrong timezone
FIX: #16079 error of service date at duplicated invoice
FIX: #16080 mailing list title
FIX: #16084 DB error at projects
FIX: #16107
FIX: #16118 Timezone problem on some fields
FIX: #16131
FIX: #16135
FIX: #16143
FIX: #16156
FIX: #16160
FIX: #16165 Create customer discount without vat
FIX: #16185
FIX: #16189, fix download/see check deposit PDF
FIX: #16215
FIX: Accountancy - label_operation is used instead of label_compte
FIX: Add critical price patch
FIX: Assignement of actors on tasks
FIX: Bad dates on info tabs
FIX: cash fence for takepos with multientity
FIX: CSRF errors on margin forms
FIX: encoding status in graph of vendor proposals
FIX: Fix detect dispached product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
FIX: Hide/Unhide external ICSS calendars
FIX: link to create event when task is in a project with a thirdparty
FIX: Localtax must be converted with price2num
FIX: manage price min for PRODUIT_CUSTOMER_PRICES
FIX: Missing language ico
FIX: Must not be able to edit vat of all lines if not draft
FIX: Bad "htdocs" found into a path
FIX: removed no more used proc update_modified_column_date_m on pgsql (its presence triggered errors)
FIX: Vulnerability report by Ricardo Matias
FIX: select default mail template
FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql
FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label
FIX: SQL Error in group by with postgres or mysql strict mode
FIX: TakePOS : load date function
FIX: Timeout during import
FIX: Trigger on expense report was not fired
FIX: User creation of expense report not visible
FIX: warning when adding a line if $remise_percent is an empty string
FIX: status late on purchase orders
FIX: ODT generation very slow
FIX: amount in summary of report
FIX: vat value when code contains number
FIX: payment term label on PDF
FIX: date selector when using reduced year (like on smartphone)
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
@ -248,10 +305,67 @@ 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.
* 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)
* 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.
* 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.5 compared to 12.0.4 *****
FIX: before crediting a withdrawal receipt, check whether it has been credited already
FIX: mandatory extrafields of type sellist
FIX: when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
FIX: when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: "openall" filter on ticket list does not include read tickets
FIX: ticket - extrafields of type 'date' are not saved
FIX: ticket - the "openall" filter on the ticket list does not include tickets with status READ
FIX: #14290 #15900
FIX: #15388 #15891
FIX: #15465 External user sees last 5 shipments to other customers in the dashboard
FIX: #15629
FIX: #15751 Miscellaneous payment type change to 0 after updating subledger account
FIX: #15946
FIX: #15966 #15967
FIX: Accountancy - Fix some problems on CEGID export
FIX: Accountancy - label_operation is used instead of label_compte
FIX: Accountancy - Retire entire opening balance feature
FIX: add autofix of count of email target when data is corrupted
FIX: add categories params on llxHeader filter
FIX: Add critical price patch from 12 to 11.
FIX: Bad cleaning of VAT rate when numbers are into code
FIX: Bad dates filtering in the ticket list causes sql error
FIX: balance starting and ending fiscal month #14197
FIX: bom line unit display #13831
FIX: cash fence for takepos with multientity
FIX: Check of customer/vendor code fails in some cases
FIX: create ticket : thirdparty/contact notification #15629
FIX: Creation of thirdparty when setup is empty
FIX: Dates of sales start in TakePOS
FIX: dupliacete customer or supplier code must be error dipslayed with new code proposed
FIX: Export FEC - Force Carriage Return Line Feed
FIX: Facture Situation Out : status condition
FIX: Filter on date of next generation on template invoices
FIX: Fix detect dispatched product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
FIX: Invoice Situation Out : status condition
FIX: issue 15659 : Missing test if supplier conf is enabled
FIX: link to create event when task is in a project with a thirdparty
FIX: Localtax must be converted with price2num
FIX: manage price min for PRODUIT_CUSTOMER_PRICES
FIX: missing GETPOST parameters on card_presend.tpl.php
FIX: missing socid into link to create event from project agenda tab
FIX: Must delete extrafields before main table on product deletion.
FIX: (path) htdocs removed
FIX: php alert sms.php
FIX: right to show VAT rate in product list
FIX: select default mail template
FIX: Timeout during import
FIX: update order by api
FIX: useless tracking number displayed on pdf if empty issue #14501
FIX: Visible date of payment
FIX: warning when adding a line if $remise_percent is an empty string
FIX: When creating a new POS sell, the creation date must be modified.
FIX: wrong name for search status param issue #15516
***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook
FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account

View File

@ -23,7 +23,7 @@ setup_empty_conf() {
mkdir -p /etc/dolibarr
touch /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() {

View File

@ -105,8 +105,8 @@ if (empty($includecustom)) {
}
}
print "Release : ".$release."\n";
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Release : ".$release."\n";
print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) {
@ -153,6 +153,7 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir='';
$needtoclose=0;
foreach ($files as $filetmp) {
@ -160,9 +161,10 @@ foreach ($files as $filetmp) {
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose)
if ($needtoclose) {
fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
}
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir;
$needtoclose=1;
}

View File

@ -579,7 +579,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
@ -624,7 +623,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;

View File

@ -212,6 +212,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries

View File

@ -110,7 +110,7 @@ $form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
{
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values'))
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start'))
{
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";

View File

@ -359,9 +359,9 @@ class AccountancyExport
print length_accountg($line->numero_compte).$separator;
print length_accounta($line->subledger_account).$separator;
print $line->sens.$separator;
print price($line->montant).$separator;
print $line->label_operation.$separator;
print $line->doc_ref;
print price2fec(abs($line->montant)).$separator;
print dol_string_unaccent($line->label_operation).$separator;
print dol_string_unaccent($line->doc_ref);
print $end_line;
}
}

View File

@ -400,7 +400,7 @@ if ($conf->product->enabled)
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducto&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}

View File

@ -215,8 +215,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if ($_POST["optionlocaltax1"] == "localtax1on")
{
if (!isset($_REQUEST['lt1']))
{
if (!GETPOSTISSET('lt1')) {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
} else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
@ -225,8 +224,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
}
if ($_POST["optionlocaltax2"] == "localtax2on")
{
if (!isset($_REQUEST['lt2']))
{
if (!GETPOSTISSET('lt2')) {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
} else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
@ -236,7 +234,9 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
if (GETPOST('save')) { // To avoid to show message when we juste switch the country that resubmit the form.
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();

View File

@ -33,7 +33,9 @@ $langs->load("admin");
if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
if (empty($action)) $action = 'edit';
// Define list of managed delays
$modules = array(
'agenda' => array(
array(
@ -190,6 +192,10 @@ if ($action == 'update')
for ($i = 0; $i < 4; $i++) {
if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$action = 'edit';
}

View File

@ -799,11 +799,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $value;
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} elseif ($value == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($value == 'price' || preg_match('/^amount/i', $value)) {
$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
}
elseif ($value == 'taux' || $value == 'localtax1' || $value == 'localtax2') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8);
}
elseif ($value == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
@ -823,11 +827,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
}
$sql .= ",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordCreatedSuccessfully"), null, 'mesgs');
// Clean $_POST array, we keep only id of dictionary
if ($id == 10 && GETPOST('country', 'int') > 0) {
@ -862,11 +866,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $field;
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} elseif ($field == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($field == 'price' || preg_match('/^amount/i', $field)) {
$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
}
elseif ($field == 'taux' || $field == 'localtax1' || $field == 'localtax2') {
$_POST[$keycode] = price2num(GETPOST($keycode), 8);
}
elseif ($field == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
$sql .= $field."=";

View File

@ -415,7 +415,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
// Note: $object->host has been loaded by the fetch
$usessl = 1;
$connectstringserver = $object->getConnectStringIMAP($usessl);
try {
if ($sourcedir) {

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('errors', 'admin', 'modulebuilder'));
$langs->loadLangs(array('errors', 'admin', 'modulebuilder', 'exports'));
$mode = GETPOST('mode', 'alpha');
$action = GETPOST('action', 'aZ09');

View File

@ -1059,9 +1059,9 @@ if ($mode == 'deploy') {
} else {
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>';
print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite", $fullurl).'<br>';
print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
}

View File

@ -73,7 +73,7 @@ print load_fiche_titre($title, '', 'title_setup');
// Version
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
@ -139,7 +139,7 @@ print '<br>';
// Session
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
@ -180,7 +180,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td class="titlefieldcreate">'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td>'.$langs->trans("NbOfEntries").'</td>';
print '<td class="right">'.$langs->trans("Address").'</td>';
print '</tr>'."\n";
@ -202,7 +202,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S
// Localisation
print '<div class="div-table-responsive-no-min">';
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 class="titlefieldcreate">'.$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("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
@ -222,7 +222,22 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
print "</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("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);
@ -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').')' : '')));
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 '<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_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>';
// 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
$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).')';
@ -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').')';
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
print '<tr class="oddeven"><td>'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n";
@ -340,7 +342,7 @@ $configfileparameters = array(
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td class="titlefield">'.$langs->trans("Parameters").' ';
print '<td class="titlefieldcreate">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -374,14 +374,6 @@ if (!$error && $xml)
}
$out .= '</table>';
$out .= '</div>';
// Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
} else {
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
}
} else {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
$error++;
@ -407,6 +399,8 @@ if (!$error && $xml)
var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/
$resultcomment = '';
$outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
if ($checksumget == $checksumtoget)
{
@ -414,7 +408,7 @@ if (!$error && $xml)
{
$resultcode = 'warning';
$resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
$outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'</span>';
$outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans($resultcomment).'</span>';
} else {
$resultcode = 'ok';
$resultcomment = 'Success';
@ -426,7 +420,18 @@ if (!$error && $xml)
$outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';
}
print load_fiche_titre($langs->trans("GlobalChecksum")).'<br>';
// Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') {
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
} else {
if ($resultcode == 'warning') {
setEventMessages($langs->trans($resultcomment), null, 'warnings');
} else {
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors');
}
}
print load_fiche_titre($langs->trans("GlobalChecksum"));
print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.'<br>';
print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;

View File

@ -69,13 +69,13 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
$ErrorPicturePath = "../../theme/eldy/img/error.png";
$WarningPicturePath = "../../theme/eldy/img/warning.png";
$OkayPicturePath = "../../theme/eldy/img/tick.png";
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
print '<tr><td>'.$langs->trans("Version").'</td><td>';
$arrayphpminversionerror = array(5, 5, 0);
$arrayphpminversionwarning = array(5, 6, 0);
@ -129,11 +129,8 @@ $loadedExtensions = array_map('strtolower', get_loaded_extensions(false));
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="200">'.$langs->trans("Extension").'</td>';
//print '<td align="center">'.$langs->trans("EnabledInSetup").'</td>';
print '<td align="center">'.$langs->trans("Loaded").'</td>';
print '<td align="center">'.$langs->trans("FunctionTest").'</td>';
print '<td>'.$langs->trans("Result").'</td>';
print '<td class="titlefield">'.$langs->trans("Extension").'</td>';
print '<td>'.$langs->trans("Test").'</td>';
print '</tr>';
$functions = ["mb_check_encoding"];
@ -141,9 +138,6 @@ $name = "MBString";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -152,9 +146,6 @@ $name = "JSON";
print "<tr>";
print "<td>".$name."</td>";
//print getTableColumn($name, $activatedExtensions);
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -163,8 +154,6 @@ $name = "GD";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -173,8 +162,6 @@ $name = "Curl";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -185,8 +172,6 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
}
@ -196,8 +181,6 @@ $name = "IMAP";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -206,8 +189,6 @@ $name = "xDebug";
print "<tr>";
print "<td>".$name."</td>";
print getTableColumn($name, $loadedExtensions);
print getTableColumnFunction($functions);
print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions);
print "</tr>";
@ -222,7 +203,7 @@ foreach ($phparray as $key => $value)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td width="220px">'.$key.'</td>';
print '<td class="titlefield">'.$key.'</td>';
print '<td colspan="2">'.$langs->trans("Value").'</td>';
print "</tr>\n";
@ -269,69 +250,6 @@ llxFooter();
$db->close();
/**
* Return a table column with a indicator (okay or warning), based on the given name and list
*
* @param string $name The name to check inside the given list
* @param array $list A list that should contains the given name
*
* @return string
*/
function getTableColumn($name, array $list)
{
global $langs;
$name = strtolower($name);
$html = "<td align='center'>";
if (in_array($name, $list))
{
if ($name == 'xdebug') $html .= '<img src="../../theme/eldy/img/warning.png" title="'.$langs->trans("ModuleActivated", "xdebug").'">';
else $html .= '<img src="../../theme/eldy/img/tick.png" title="Ok">';
} else {
if ($name == 'xdebug') $html .= yn(0);
else $html .= '<img src="../../theme/eldy/img/warning.png" title="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a table column with a indicator (okay or warning), based on the given functions to check
*
* @param array $functions A list with functions to check
*
* @return string
*/
function getTableColumnFunction(array $functions)
{
if (count($functions) < 1)
{
return "<td align='center'>-</td>";
}
$result = true;
$html = "<td align='center'>";
foreach ($functions as $function)
{
$result = $result && function_exists($function);
}
if ($result)
{
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
}
$html .= "</td>";
return $html;
}
/**
* Return a result column with a translated result text
*
@ -339,7 +257,6 @@ function getTableColumnFunction(array $functions)
* @param array $activated A list with all activated PHP extensions. Deprecated.
* @param array $loaded A list with all loaded PHP extensions
* @param array $functions A list with all PHP functions to check
*
* @return string
*/
function getResultColumn($name, array $activated, array $loaded, array $functions)
@ -347,6 +264,7 @@ function getResultColumn($name, array $activated, array $loaded, array $function
global $langs;
$result = true;
//$result = $result && in_array(strtolower($name), $activated);
$result = $result && in_array(strtolower($name), $loaded);
@ -356,7 +274,29 @@ function getResultColumn($name, array $activated, array $loaded, array $function
}
$html = "<td>";
$html .= $result ? $langs->trans("PHPSupport", $name) : $langs->trans("ErrorPHPDoesNotSupport", $name);
if ($result) {
if (strtolower($name) == 'xdebug') $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
else $html .= img_picto($langs->trans("Ok"), 'tick');
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
if (strtolower($name) == 'xdebug') {
$html .= ' '.$langs->trans("ModuleActivated", "xdebug");
} else {
$html .= ' '.$langs->trans("PHPSupport", $name);
}
} else {
if (strtolower($name) == 'xdebug') $html .= yn(0).' - ';
else $html .= img_warning($langs->trans("ModuleActivated", "xdebug"));
if (in_array(strtolower($name), $loaded)) {
$html .= ' '.$langs->trans("Loaded").' - ';
} else {
//$html .= ' '.$langs->trans("NotLoaded").' - ';
}
$html .= ' '.$langs->trans("ErrorPHPDoesNotSupport", $name);
}
$html .= "</td>";
return $html;

View File

@ -43,9 +43,6 @@ if (GETPOST('action', 'aZ09') == 'donothing')
* View
*/
$form = new Form($db);
$nowstring = dol_print_date(dol_now(), 'dayhourlog');
llxHeader();
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
@ -78,7 +75,7 @@ else {
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) {
@ -90,7 +87,12 @@ print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_n
if (!empty($dolibarr_nocsrfcheck)) {
print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
print '<br>';
print '<strong>'.$langs->trans("dolibarr_main_restrict_ip").'</strong>: '.$dolibarr_main_restrict_ip;
/*if (empty($dolibarr_main_restrict_ip)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}*/
print '<br>';
print '<br>';
@ -102,9 +104,17 @@ print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
print 'TODO';
print '<br>';
print '<strong>'.$langs->trans("PermissionsOnFile", 'conf.php').'</strong>: ';
// TODO Check permission on file conf.php (read only for the web user)
print 'TODO';
print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
$perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
if ($perms) {
if (($perms & 0x0004) || ($perms & 0x0002)) {
print img_warning().' '.$langs->trans("ConfFileIsReadableOrWritableByAnyUsers");
} else {
print img_picto('', 'tick');
}
} else {
print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
}
print '<br>';
print '<br>';
@ -137,14 +147,15 @@ print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'<br>';
print '<br>';
// TODO
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
print ' &nbsp; - '.$conf->global->MAIN_ANTIVIRUS_COMMAND;

View File

@ -643,7 +643,7 @@ class Setup extends DolibarrApi
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
$sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking";
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters

View File

@ -125,38 +125,18 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);
$formfile = new FormFile($db);
$title = $langs->trans("Assets").' - '.$langs->trans("Card");
$title = $langs->trans("Asset").' - '.$langs->trans("Card");
$help_url = '';
llxHeader('', $title, $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create
if ($action == 'create')
{
@ -240,14 +220,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1);
}
// Confirmation of action xxxx
if ($action == 'xxx')
{
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAsset'), 'confirm_delete', '', 0, 1);
}
// Call Hook formConfirm
@ -292,28 +265,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
/*
* Buttons
*/
if ($user->socid == 0)
{
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Send
if (empty($user->socid)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
}
if ($user->rights->asset->write)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
@ -328,13 +297,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
}
print '</div>'."\n";
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
print "</div>";
}
if ($action != 'presend')
@ -343,27 +306,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a name="builddoc"></a>'; // ancre
// Documents
/*$objref = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf';
$filedir = $conf->asset->dir_output . '/' . $objref;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->asset->create; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('asset', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/
$delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/asset/asset_info.php', 1).'?id='.$object->id.'">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/info.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@ -372,19 +331,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div></div></div>';
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
/*
$modelmail='asset';
$defaulttopic='InformationMessage';
$diroutput = $conf->asset->dir_output.'/asset';
$trackid = 'asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@ -19,7 +19,7 @@
/**
* \file htdocs/asset/document.php
* \ingroup asset
* \brief Tab for documents linked to Assets
* \brief Page for attached files on assets
*/
require '../main.inc.php';
@ -31,18 +31,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page
$langs->loadLangs(array("assets", "companies"));
$langs->loadLangs(array('assets', 'companies', 'other'));
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm');
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'asset', $id);
// Security check
if ($user->socid)
{
$socid = $user->socid;
}
$result=restrictedArea($user, 'asset', $id, '');
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -56,100 +59,79 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
// Initialize technical objects
$object = new Asset($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->assets->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('assetdocument')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Security check
if (!empty($user->socid)) $socid = $user->socid;
$result = restrictedArea($user, 'asset', $id);
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/packages/".dol_sanitizeFileName($object->ref);
if ($object->fetch($id))
{
$upload_dir = $conf->asset->dir_output."/".dol_sanitizeFileName($object->ref);
}
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
* View
*/
$title = $langs->trans('Assets')." - ".$langs->trans('Documents');
$helpurl = '';
llxHeader('', $title, $helpurl);
$form = new Form($db);
$title = $langs->trans("Assets").' - '.$langs->trans("Files");
$help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
if ($object->id)
if ($id > 0 || !empty($ref))
{
/*
* Show tabs
*/
if (!empty($conf->notification->enabled)) $langs->load("mails");
$head = asset_prepare_head($object);
print dol_get_fiche_head($head, 'document', $langs->trans("Asset"), -1, 'generic');
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
if ($object->fetch($id, $ref) > 0)
{
$totalsize += $file['size'];
$upload_dir = $conf->asset->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = asset_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('Asset'), -1, 'accounting');
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
{
$totalsize += $file['size'];
}
// Asset content
$linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n";
print "</div>\n";
print dol_get_fiche_end();
$modulepart = 'asset';
$permission = $user->rights->asset->write;
$permtoedit = $user->rights->asset->write;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/asset/list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
// Total size
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
print dol_get_fiche_end();
$modulepart = 'asset';
//$permission = $user->rights->asset->create;
$permission = 1;
//$permtoedit = $user->rights->asset->create;
$permtoedit = 1;
$param = '&id='.$object->id;
//$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile = 'asset/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
accessforbidden('', 0, 1);
print $langs->trans("ErrorUnknown");
}
// End of page

View File

@ -157,7 +157,7 @@ if ($action == 'update' && $user->rights->asset->write)
if ($ret >= 0 && !count($object->errors))
{
setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs');
setEventMessages($langs->trans("AssetTypeModified"), null, 'mesgs');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}

View File

@ -22,6 +22,11 @@
* \ingroup member
* \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_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.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';
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)
{
dol_print_error('', $result);
}
if ($result <= 0 || $mesg) {
if (empty($mesg)) {
$mesg = 'Error '.$result;
}
if (!$mesg)
{
setEventMessages($mesg, null, 'errors');
} else {
$db->close();
exit;
}
@ -275,10 +286,10 @@ dol_htmloutput_errors($mesg);
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<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="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">';

View File

@ -318,7 +318,7 @@ switch ($action)
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF')
{
// We set status to payed
// We set status to paid
$result = $invoice->set_paid($user);
//print 'set paid';exit;
}

View File

@ -210,7 +210,7 @@ llxHeader("", $langs->trans("Categories"), $helpurl);
if ($user->rights->categorie->creer)
{
// Create or add
if ($action == 'create' || $_POST["addcat"] == 'addcat')
if ($action == 'create' || GETPOST("addcat") == 'addcat')
{
dol_set_focus('#label');

View File

@ -285,16 +285,19 @@ print dol_get_fiche_end();
*/
print "<div class='tabsAction'>\n";
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans("Delete").'</a>';
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'">'.$langs->trans("Delete").'</a>';
}
}
print "</div>";

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
// 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'));
$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'));
$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'), 'tzuser');
// Check parameters
if (!$datef && $percentage == 100)
@ -479,8 +479,8 @@ if (empty($reshook) && $action == 'update')
$object->fetch_userassigned();
$object->oldcopy = clone $object;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", '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'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml");
@ -730,8 +730,8 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
{
$error = 0;
$shour = dol_print_date($object->datep, "%H");
$smin = dol_print_date($object->datep, "%M");
$shour = dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
$smin = dol_print_date($object->datep, "%M", 'tzuserrel');
$newdate = GETPOST('newdate', 'alpha');
if (empty($newdate) || strpos($newdate, 'dayevent_') != 0)
@ -740,7 +740,9 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
exit;
}
$datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4));
$datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4), 'tzuserrel');
//print dol_print_date($datep, 'dayhour');exit;
if ($datep != $object->datep)
{
if (!empty($object->datef))
@ -953,7 +955,7 @@ if ($action == 'create')
// Full day
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);
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0);
@ -1324,8 +1326,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
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", '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'), 'tzuser');
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
$object->label = GETPOST("label", "alphanohtml");
@ -1430,23 +1432,23 @@ if ($id > 0)
// 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 dol_print_date($object->datep, 'dayhour', 'gmt');
// Date start - end
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
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) {
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 {
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 ' - ';
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) {
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 {
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>';
@ -1884,16 +1886,16 @@ if ($id > 0)
// Date start
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour');
else print dol_print_date($object->datep, 'day');
if (!$object->fulldayevent) print dol_print_date($object->datep, 'dayhour', 'tzuser');
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"));
print '</td>';
print '</tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour');
else print dol_print_date($object->datef, 'day');
if (!$object->fulldayevent) print dol_print_date($object->datef, 'dayhour', 'tzuser');
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"));
print '</td></tr>';

View File

@ -1222,13 +1222,20 @@ class ActionComm extends CommonObject
}
$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->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 .= " WHERE 1 = 1";
if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100";
$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->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);
if ($resql)

View File

@ -280,10 +280,10 @@ if (empty($action) || $action == 'show_month')
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year, 'tzuserrel');
$next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
if ($next_day < 6) $next_day += 7;
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
}
if ($action == 'show_week')
{
@ -304,10 +304,10 @@ if ($action == 'show_week')
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'tzuserrel');
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year, 'gmt'));
$tmpday = $first_day;
}
@ -323,8 +323,8 @@ if ($action == 'show_day')
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'gmt');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year, 'tzuserrel');
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year, 'tzuserrel');
}
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
@ -514,7 +514,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
{
$s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () {
jQuery("table input[name^=\"check_ext\"]").click(function() {
jQuery("div input[name^=\"check_ext\"]").click(function() {
var name = $(this).attr("name");
jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
});
@ -524,7 +524,7 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
foreach ($showextcals as $val)
{
$htmlname = md5($val['name']);
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> '.$val['name'].' &nbsp; </div>';
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" checked> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> &nbsp; </div>';
}
}
@ -607,17 +607,18 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND (a.fk_soc IS
if ($socid > 0) $sql .= ' AND a.fk_soc = '.$socid;
// We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
//var_dump($day.' '.$month.' '.$year);
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -723,9 +724,9 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
//var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt'));
//var_dump($annee.'-'.$mois.'-'.$jour);
@ -1342,14 +1343,14 @@ if (empty($action) || $action == 'show_month') // View by month
for ($iter_day = 0; $iter_day < 7; $iter_day++) {
// Show days of the current week
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
$tmparray = dol_getdate($curtime, true);
$tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon'];
$tmpyear = $tmparray['year'];
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server
$tmpday = dol_print_date($curtime, '%d', 'tzuserrel');
$tmpmonth = dol_print_date($curtime, '%m', 'tzuserrel');
$tmpyear = dol_print_date($curtime, '%Y', 'tzuserrel');
$style = 'cal_current_month';
if ($iter_day == 6) $style .= ' cal_other_month_right';
$today = 0;
$todayarray = dol_getdate($now, 'fast');
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1;
@ -1500,11 +1501,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
// Line with title of day
print '<div id="dayevent_'.$dateint.'" class="cursorpointer dayevent tagtable centpercent nobordernopadding" onclick="window.location=\''.$urltocreate.'\';">'."\n";
print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n";
if ($nonew <= 0)
{
print '<div class="tagtr"><div class="nowrap tagtd"><div class="left inline-block">';
print '<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.'\';"><div class="nowrap tagtd"><div class="left inline-block">';
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d');
@ -1539,9 +1540,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
foreach ($eventarray as $daykey => $notused)
{
$annee = date('Y', $daykey);
$mois = date('m', $daykey);
$jour = date('d', $daykey);
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee)
{
@ -1629,7 +1630,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar);
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour)
{
$cssclass .= " unmovable";
}
@ -1703,20 +1704,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (empty($event->fulldayevent))
{
// Show hours (start ... end)
$tmpyearstart = date('Y', $event->date_start_in_calendar);
$tmpmonthstart = date('m', $event->date_start_in_calendar);
$tmpdaystart = date('d', $event->date_start_in_calendar);
$tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar);
/*var_dump($tmpyearstart.' '.$tmpmonthstart.' '.$tmpdaystart);
var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend);
var_dump($annee.' '.$mois.' '.$jour);*/
$tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
$tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
$tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
$tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
$tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
$tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
@ -1736,7 +1734,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
{
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
}
} else {
if ($showinfo)

View File

@ -67,9 +67,9 @@ $search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'), 'tzuserrel');
$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'), 'tzuserrel');
$dateend = dol_mktime(0, 0, 0, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) $search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && !GETPOSTISSET('action')) $action = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -136,9 +136,9 @@ $arrayfields = array(
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'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.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -563,12 +563,12 @@ if ($resql)
if (!empty($arrayfields['a.note']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0);
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
}
if (!empty($arrayfields['a.datep2']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0);
print $form->selectDate($dateend, 'dateend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');
print '</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {
@ -736,7 +736,7 @@ if ($resql)
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
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;
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;
@ -749,7 +749,7 @@ if ($resql)
// End date
if (!empty($arrayfields['a.datep2']['checked'])) {
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>';
}
@ -834,11 +834,11 @@ if ($resql)
// Date creation
if (!empty($arrayfields['a.datec']['checked'])) {
// 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
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'])) {
// Status/Percent

View File

@ -265,7 +265,7 @@ $next_month = $month;
$next_day = $day;
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'tzuserrel');
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
//print $firstday.'-'.$first_month.'-'.$first_year;
//print dol_print_date($firstdaytoshow,'dayhour');
@ -482,14 +482,14 @@ if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -599,9 +599,9 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
// Loop on each day covered by action to prepare an index to show on calendar
$loop = true; $j = 0;
@ -858,9 +858,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused)
{
$annee = dol_print_date($daykey, '%Y', 'gmt');
$mois = dol_print_date($daykey, '%m', 'gmt');
$jour = dol_print_date($daykey, '%d', 'gmt');
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ?
{
@ -931,9 +931,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0);
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'tzuserrel', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$dateendtouse = $event->date_end_in_calendar;
if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++;
@ -944,13 +944,13 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
{
$busy = $event->transparency;
$cases1[$h][$event->id]['busy'] = $busy;
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases1[$h][$event->id]['string'] .= ' - '.$event->label;
$cases1[$h][$event->id]['typecode'] = $event->type_code;
@ -990,13 +990,13 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
{
$busy = $event->transparency;
$cases2[$h][$event->id]['busy'] = $busy;
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases2[$h][$event->id]['string'] .= ' - '.$event->label;
$cases2[$h][$event->id]['typecode'] = $event->type_code;

View File

@ -404,7 +404,11 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction
{
$tmpforcreatebutton = dol_getdate(dol_now(), true);
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
$newparam .= '&month='.urlencode(str_pad($month, 2, "0", STR_PAD_LEFT)).'&year='.urlencode($tmpforcreatebutton['year']);
if ($begin_h !== '') $newparam .= '&begin_h='.urlencode($begin_h);
if ($end_h !== '') $newparam .= '&end_h='.urlencode($end_h);
if ($begin_d !== '') $newparam .= '&begin_d='.urlencode($begin_d);
if ($end_d !== '') $newparam .= '&end_d='.urlencode($end_d);
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000';
@ -487,14 +491,14 @@ if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
$sql .= ')';
} else {
// To limit array
@ -605,9 +609,10 @@ if ($resql)
// Add an entry in actionarray for each day
$daycursor = $event->date_start_in_calendar;
$annee = dol_print_date($daycursor, '%Y');
$mois = dol_print_date($daycursor, '%m');
$jour = dol_print_date($daycursor, '%d');
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
//print $daycursor.' '.dol_print_date($daycursor, 'dayhour', 'gmt').' '.$event->id.' -> '.$annee.'-'.$mois.'-'.$jour.'<br>';
// Loop on each day covered by action to prepare an index to show on calendar
$loop = true; $j = 0;
@ -920,7 +925,7 @@ jQuery(document).ready(function() {
if (ids == \'none\') /* No event */
{
/* alert(\'no event\'); */
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'"
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day.($begin_h !== '' ? '&begin_h='.$begin_h : '').($end_h !== '' ? '&end_h='.$end_h : '').($begin_d !== '' ? '&begin_d='.$begin_d : '').($end_d !== '' ? '&end_d='.$end_d : '')).'"
window.location.href = url;
}
else if (ids.indexOf(",") > -1) /* There is several events */
@ -979,7 +984,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$cases2 = array(); // Color second half hour
$i = 0; $numother = 0; $numbirthday = 0; $numical = 0; $numicals = array();
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
//$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
$nextindextouse = count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
@ -988,16 +993,16 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused)
{
$annee = dol_print_date($daykey, '%Y', 'gmt');
$mois = dol_print_date($daykey, '%m', 'gmt');
$jour = dol_print_date($daykey, '%d', 'gmt');
$annee = dol_print_date($daykey, '%Y');
$mois = dol_print_date($daykey, '%m');
$jour = dol_print_date($daykey, '%d');
if ($day == $jour && $month == $mois && $year == $annee) // Is it the day we are looking for when calling function ?
{
// Scan all event for this date
foreach ($eventarray[$daykey] as $index => $event)
{
//print $daykey.' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."<br>\n";
//print $daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$year.'-'.$month.'-'.$day.' -> '.$event->id.' '.$index.' '.$annee.'-'.$mois.'-'.$jour."<br>\n";
//var_dump($event);
$keysofuserassigned = array_keys($event->userassigned);
@ -1078,7 +1083,6 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// Define color
$color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
}
//$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
// Define all rects with event (cases1 is first half hour, cases2 is second half hour)
for ($h = $begin_h; $h < $end_h; $h++)
@ -1087,9 +1091,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'auto', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'auto', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'auto', 0);
$a = dol_mktime((int) $h, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$b = dol_mktime((int) $h, 30, 0, $month, $day, $year, 'tzuserrel', 0);
$c = dol_mktime((int) $h + 1, 0, 0, $month, $day, $year, 'tzuserrel', 0);
$dateendtouse = $event->date_end_in_calendar;
if ($dateendtouse == $event->date_start_in_calendar) $dateendtouse++;
@ -1100,13 +1104,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{
$busy = $event->transparency;
$cases1[$h][$event->id]['busy'] = $busy;
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases1[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases1[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases1[$h][$event->id]['string'] .= ' - '.$event->label;
$cases1[$h][$event->id]['typecode'] = $event->type_code;
@ -1146,13 +1150,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
{
$busy = $event->transparency;
$cases2[$h][$event->id]['busy'] = $busy;
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour');
$cases2[$h][$event->id]['string'] = dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
{
$tmpa = dol_getdate($event->date_start_in_calendar, true);
$tmpb = dol_getdate($event->date_end_in_calendar, true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour');
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
else $cases2[$h][$event->id]['string'] .= '-'.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel');
}
if ($event->label) $cases2[$h][$event->id]['string'] .= ' - '.$event->label;
$cases2[$h][$event->id]['typecode'] = $event->type_code;

View File

@ -484,6 +484,7 @@ class Propal extends CommonObject
}
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->db->rollback();
return -2;
}
@ -710,8 +711,8 @@ class Propal extends CommonObject
// Mise a jour informations denormalisees au niveau de la propale meme
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
if ($result > 0)
{
if ($result > 0) {
$this->db->commit();
return $this->line->id;
} else {
@ -721,6 +722,7 @@ class Propal extends CommonObject
}
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -2;
}
@ -913,7 +915,7 @@ class Propal extends CommonObject
return $result;
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -1;
}

View File

@ -111,6 +111,11 @@ $pagenext = $page + 1;
if (!$sortfield) $sortfield = 'p.ref';
if (!$sortorder) $sortorder = 'DESC';
$permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->write;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
// Security check
$module = 'propal';
$dbtable = '';
@ -246,17 +251,83 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if ($object_statut != '') $search_status = $object_statut;
if (empty($reshook))
{
$objectclass = 'Propal';
$objectlabel = 'Proposals';
$permissiontoread = $user->rights->propal->lire;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
$uploaddir = $conf->propal->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
// Mass action validate (after a confirmation question, it is $action that is used).
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
// Mass action sign (after a confirmation question, it is $action that is used).
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
/*
@ -1299,72 +1370,10 @@ if ($resql)
$delallowed = $user->rights->propal->creer;
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
} else {
dol_print_error($db);
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();
// End of page
llxFooter();
$db->close();

View File

@ -243,7 +243,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate)
{
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$selectedLines = GETPOST('toselect', 'array');
if ($datecommande == '') {
@ -276,8 +276,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison; // deprecated
$object->delivery_date = $datelivraison;
$object->date_livraison = $date_delivery; // deprecated
$object->delivery_date = $date_delivery;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address');
@ -615,7 +615,7 @@ if (empty($reshook))
$result = $object->set_remise($user, GETPOST('remise_percent'));
} elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) {
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {
// Define vat_rate
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
$vat_rate = str_replace('*', '', $vat_rate);
@ -646,6 +646,9 @@ if (empty($reshook))
$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS');
$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0);
if (empty($remise_percent)) {
$remise_percent = 0;
}
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@ -1615,7 +1618,7 @@ if ($action == 'create' && $usercancreate)
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">';
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
print "</td>\n";
print '</tr>';

View File

@ -742,11 +742,11 @@ class Commande extends CommonOrder
if ($usercanclose)
{
$this->db->begin();
if ($this->statut == self::STATUS_CLOSED)
{
return 0;
}
$this->db->begin();
$now = dol_now();
@ -1824,6 +1824,8 @@ class Commande extends CommonOrder
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid;
$this->total_ht = $obj->total_ht;
@ -1974,6 +1976,7 @@ class Commande extends CommonOrder
}
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->db->rollback();
return -2;
}
@ -3244,6 +3247,7 @@ class Commande extends CommonOrder
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
$delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date;
// Check parameters
// Put here code to add control on parameters values
@ -3268,6 +3272,8 @@ class Commande extends CommonOrder
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
$sql .= " date_livraison=".(strval($this->delivery_date) != '' ? "'".$this->db->idate($this->delivery_date)."'" : 'null').",";
$sql .= " fk_shipping_method=".(isset($this->shipping_method_id) ? $this->shipping_method_id : "null").",";
$sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").",";
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";

View File

@ -575,7 +575,8 @@ class Account extends CommonObject
return $accline->id;
} else {
$this->error = $this->db->lasterror();
$this->error = $accline->error;
$this->errors = $accline->errors;
$this->db->rollback();
return -2;

View File

@ -576,7 +576,7 @@ foreach ($accounts as $key=>$type)
if (!empty($arrayfields['balance']['checked']))
{
print '<td class="nowraponall right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).'</a>';
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance';

View File

@ -58,6 +58,10 @@ $search_accountancy_account = GETPOST("search_accountancy_account");
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = '';
if (empty($search_datep_start)) $search_datep_start = GETPOST("search_datep_start", 'int');
if (empty($search_datep_end)) $search_datep_end = GETPOST("search_datep_end", 'int');
if (empty($search_datev_start)) $search_datev_start = GETPOST("search_datev_start", 'int');
if (empty($search_datev_end)) $search_datev_end = GETPOST("search_datev_end", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@ -247,7 +251,7 @@ if ($result)
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
if ($search_bank_account > 0) $param .= '&search_amount='.urlencode($search_bank_account);
if ($search_bank_account > 0) $param .= '&search_account='.urlencode($search_bank_account);
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
@ -424,6 +428,10 @@ if ($result)
{
$obj = $db->fetch_object($result);
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
$variousstatic->label = $obj->label;
print '<tr class="oddeven">';
// No
@ -433,15 +441,13 @@ if ($result)
// Ref
if ($arrayfields['ref']['checked']) {
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
print "<td>".$variousstatic->getNomUrl(1)."</td>";
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
if (!$i) $totalarray['nbfield']++;
}
// Label payment
if ($arrayfields['label']['checked']) {
print "<td>".dol_trunc($obj->label, 40)."</td>";
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
if (!$i) $totalarray['nbfield']++;
}
@ -460,7 +466,13 @@ if ($result)
// Type
if ($arrayfields['type']['checked']) {
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
print '<td>';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code);
print ' ';
}
print $obj->num_payment;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@ -110,7 +110,7 @@ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id =
$sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
$sql .= " AND f.paye = 1";
$sql .= " AND p.entity IN (".getEntity('facture').")";
$sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";

View File

@ -289,11 +289,11 @@ if (empty($reshook))
elseif ($action == 'setref' && $user->rights->facture->creer)
{
//var_dump(GETPOST('ref', 'alpha'));exit;
$result = $object->setValueFrom('title', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
$result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0)
{
$object->titre = GETPOST('ref', 'alpha'); // deprecated
$object->title = GETPOST('ref', 'alpha');
$object->titre = $ref; // deprecated
$object->title = $ref;
$object->ref = $object->title;
} else {
$error++;
@ -923,7 +923,8 @@ if (empty($reshook))
* View
*/
llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec');
$help_url = '';
llxHeader('', $langs->trans("RepeatableInvoices"), $help_url);
$form = new Form($db);
$formother = new FormOther($db);

View File

@ -3596,7 +3596,7 @@ if ($action == 'create')
if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1)
{
setEventMessages('WarningBillExist', null, 'warnings');
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
echo ' ('.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
}
echo '</td></tr>';
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
@ -4104,7 +4104,7 @@ if ($action == 'create')
if ($objectidnext > 0) {
$facthatreplace = new Facture($db);
$facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')</span>';
print ' <span class="opacitymediumbycolor paddingleft">('.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).')</span>';
}
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
@ -4112,7 +4112,10 @@ if ($action == 'create')
$result = $discount->fetch(0, $object->id);
if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount'));
$s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}');
$s = str_replace('{s1}', $object->getLibType(1), $s);
$s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s);
print $s;
print '</span><br>';
}
}
@ -4123,7 +4126,9 @@ if ($action == 'create')
$result = $tmptemplate->fetch($object->fk_fac_rec_source);
if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("GeneratedFromTemplate", '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>');
$s = $langs->transnoentities("GeneratedFromTemplate", '{s1}');
$s = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>', $s);
print $s;
print '</span>';
}
}

View File

@ -1051,7 +1051,7 @@ class Invoices extends DolibarrApi
}
if ($this->invoice->paye) {
throw new RestException(500, 'Alreay payed');
throw new RestException(500, 'Alreay paid');
}
$this->invoice->fetch($id);

View File

@ -797,6 +797,7 @@ class Facture extends CommonInvoice
if ($result < 0)
{
$this->error = $newinvoiceline->error;
$this->errors = $newinvoiceline->errors;
$error++;
break;
}
@ -1165,6 +1166,7 @@ class Facture extends CommonInvoice
$object->id = 0;
$object->statut = self::STATUS_DRAFT;
$object->status = self::STATUS_DRAFT;
// Clear fields
$object->date = (empty($this->date) ? dol_now() : $this->date);
@ -1594,6 +1596,8 @@ class Facture extends CommonInvoice
$this->project = null; // Clear if another value was already set by fetch_projet
$this->statut = $obj->fk_statut;
$this->status = $obj->fk_statut;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
@ -3199,6 +3203,7 @@ class Facture extends CommonInvoice
}
} else {
$this->error = $this->line->error;
$this->errors = $this->line->errors;
$this->db->rollback();
return -2;
}

View File

@ -268,7 +268,7 @@ if ($search_status != '' && $search_status >= -1)
if ($search_status == -1) $sql .= ' AND suspended = 1';
}
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= $db->order($sortfield, $sortorder);

View File

@ -1090,7 +1090,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
}
/*
* Unpayed supplier invoices
* Unpaid supplier invoices
*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire)
{

View File

@ -381,7 +381,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* localtax payed
* Total of localtax paid in invoice
*
* @param int $year Year
* @return int ???
@ -419,8 +419,7 @@ class Localtax extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* localtax payed
* Total de la localtax payed
* Total of localtax paid
*
* @param int $year Year
* @return int ???

View File

@ -565,7 +565,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Payed
* Paid
*/
print load_fiche_titre($langs->transcountry($LTPaid, $mysoc->country_code), '', '');

View File

@ -507,19 +507,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>';
print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>';
print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
// Check transmitter
print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</td>';
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
// Bank name
print '<tr><td>'.$langs->trans('Bank');
print ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</td>';
print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
// Comments
print '<tr><td>'.$langs->trans('Comments').'</td>';
@ -577,6 +577,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$i = 0;
//print '<tr><td colspan="3">';
print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@ -785,7 +787,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print "</tr>\n";
}
print "</table>";
//print "</td></tr>\n";
print "</div>\n";
}
$db->free($resql);
} else {

View File

@ -43,12 +43,20 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$object = new Paiement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
// Security check
if ($user->socid) $socid = $user->socid;
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
$object = new Paiement($db);
// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
// It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
accessforbidden();
}
/*
@ -59,7 +67,6 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
{
$db->begin();
$object->fetch($id);
$result = $object->update_note(GETPOST('note', 'restricthtml'));
if ($result > 0)
{
@ -75,7 +82,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
{
$db->begin();
$object->fetch($id);
$result = $object->delete();
if ($result > 0)
{
@ -100,7 +106,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
{
$db->begin();
$object->fetch($id);
if ($object->validate($user) > 0)
{
$db->commit();
@ -134,7 +139,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
{
$object->fetch($id);
$res = $object->update_num($_POST['num_paiement']);
if ($res === 0)
{
@ -146,7 +150,6 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
if ($action == 'setdatep' && !empty($_POST['datepday']))
{
$object->fetch($id);
$datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'));
$res = $object->update_date($datepaye);
if ($res === 0)

View File

@ -749,7 +749,7 @@ if ($action != 'new')
if ($object->statut == 1)
{
$filename = dol_sanitizeFileName($object->ref);
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').dol_sanitizeFileName($object->ref);
$filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits');
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1);

View File

@ -1293,7 +1293,8 @@ class Paiement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the third party of object, from id into this->thirdparty
* Load the third party of object, from id into this->thirdparty.
* For payments, take the thirdparty linked to the first invoice found. This is enough because payments are done on invoices of the same thirdparty.
*
* @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK
@ -1311,7 +1312,7 @@ class Paiement extends CommonObject
$invoice = new Facture($this->db);
if ($invoice->fetch($billsarray[0]) > 0)
{
$force_thirdparty_id = $invoice->fk_soc;
$force_thirdparty_id = $invoice->socid;
}
}
}

View File

@ -36,6 +36,23 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$object = new Paiement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
// Security check
if ($user->socid) $socid = $user->socid;
// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
// It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
accessforbidden();
}
/*
* Actions
*/
@ -49,8 +66,6 @@ $confirm = GETPOST('confirm', 'alpha');
llxHeader('', $langs->trans("Payment"));
$object = new Paiement($db);
$object->fetch($id, $ref);
$object->info($object->id);
$head = payment_prepare_head($object);

View File

@ -148,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha")) {
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
// Add fields from hooks
@ -166,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) {
$sql .= $hookmanager->resPrint;
} else {
// DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
$sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
@ -390,7 +390,7 @@ while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$object->id = $objp->rowid;
$object->ref = $objp->ref;
$object->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$companystatic->id = $objp->socid;
$companystatic->name = $objp->name;
@ -497,6 +497,14 @@ while ($i < min($num, $limit)) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)
{
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>";
print "</div>";
print "</form>";

View File

@ -30,9 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Security check
if (!$user->rights->facture->lire) accessforbidden();
$action = GETPOST('action', 'aZ09');
$socid = 0;
@ -48,6 +45,9 @@ if (!$user->rights->societe->client->voir || $socid) $dir .= '/private/'.$user->
$year = GETPOST('year', 'int');
if (!$year) { $year = date("Y"); }
// Security check
if (empty($user->rights->facture->lire)) accessforbidden();
/*
* Actions

View File

@ -27,10 +27,6 @@ require '../../main.inc.php';
// Load translation files required by the page
$langs->load("bills");
// Security check
if (!$user->rights->facture->lire)
accessforbidden();
$socid = 0;
if ($user->socid > 0)
{
@ -50,6 +46,9 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "p.rowid";
// Security check
if (empty($user->rights->facture->lire)) accessforbidden();
/*
* Actions

View File

@ -162,7 +162,7 @@ print dol_get_fiche_end();
/*
* List of social contributions payed
* List of social contributions paid
*/
$disable_delete = 0;
@ -213,7 +213,7 @@ if ($resql)
print '<td class="right">'.price($objp->sc_amount).'</td>';
// Status
print '<td class="center">'.$socialcontrib->getLibStatut(4, $objp->amount).'</td>';
// Amount payed
// Amount paid
print '<td class="right">'.price($objp->amount).'</td>';
print "</tr>\n";
if ($objp->paye == 1) // If at least one invoice is paid, disable delete

View File

@ -98,7 +98,13 @@ if (empty($reshook))
// Seems to no be used and replaced with $action == 'infocredit'
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
{
$res = $object->set_credite();
if ($object->statut == 2) {
$res = -1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$res = $object->set_credite();
}
if ($res >= 0)
{
header("Location: card.php?id=".$id);
@ -145,10 +151,16 @@ if (empty($reshook))
{
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($object->statut == 2) {
$error = 1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$error = $object->set_infocredit($user, $dt);
}
if ($error)
{
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -370,7 +370,7 @@ class BonPrelevement extends CommonObject
$num = count($facs);
for ($i = 0; $i < $num; $i++)
{
/* Tag invoice as payed */
/* Tag invoice as paid */
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db);
$fac->fetch($facs[$i]);

View File

@ -252,7 +252,7 @@ if ($modecompta == 'BOOKKEEPING')
$sql .= " AND f.entity = ".$conf->entity;
if (!empty($date_start) && !empty($date_end))
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
$sql .= " GROUP BY pcg_type, name, socid";
$sql .= " GROUP BY pcg_type DESC, name, socid";
$sql .= $db->order($sortfield, $sortorder);
$oldpcgtype = '';
@ -284,6 +284,15 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc += (isset($objp->amount) ? $objp->amount : 0);
if ($objp->pcg_type == 'INCOME') {
$total_ht_income += (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_income += (isset($objp->amount) ? $objp->amount : 0);
}
if ($objp->pcg_type == 'EXPENSE') {
$total_ht_outcome -= (isset($objp->amount) ? $objp->amount : 0);
$total_ttc_outcome -= (isset($objp->amount) ? $objp->amount : 0);
}
// Loop on detail of all accounts
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no')
@ -446,6 +455,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $total_ht;
$total_ttc_income += $total_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
@ -525,11 +535,12 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
print '</tr>';
}
/*
@ -609,6 +620,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -686,6 +698,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -764,6 +777,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -841,6 +855,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
@ -926,6 +941,7 @@ if ($modecompta == 'BOOKKEEPING')
$total_ht_outcome += $subtotal_ht;
$total_ttc_outcome += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
@ -963,6 +979,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += -$obj->amount;
$subtotal_ttc += -$obj->amount;
$total_ht_outcome += $obj->amount;
$total_ttc_outcome += $obj->amount;
}
@ -978,6 +995,7 @@ if ($modecompta == 'BOOKKEEPING')
{
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
$total_ht_income += $obj->amount;
$total_ttc_income += $obj->amount;
}
@ -1038,8 +1056,10 @@ if ($modecompta == 'BOOKKEEPING')
}
$total_ht += $subtotal_ht;
$total_ttc += $subtotal_ttc;
$total_ht_income += $subtotal_ht;
$total_ttc_income += $subtotal_ttc;
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
@ -1101,8 +1121,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATToPay")."</td>\n";
print '<td class="right">&nbsp;</td>'."\n";
@ -1151,6 +1173,7 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
@ -1197,8 +1220,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_outcome -= 0;
$total_ttc_outcome -= $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATPaid")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@ -1243,8 +1268,10 @@ if ($modecompta == 'BOOKKEEPING')
} else {
dol_print_error($db);
}
$total_ht_income += 0;
$total_ttc_income += $amount;
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("VATCollected")."</td>\n";
if ($modecompta == 'CREANCES-DETTES')
@ -1279,19 +1306,22 @@ print '<tr>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES')
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
print '</tr>';
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
if ($modecompta == 'CREANCES-DETTES')
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
}
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
print '</tr>';

View File

@ -866,9 +866,9 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
if ($obj->pcg_type == 'INCOME') {
if (!isset($encaiss[$obj->dm])) $encaiss[$obj->dm] = 0; // To avoid warning of var not defined
$encaiss[$obj->dm] += $obj->credit;
$encaiss[$obj->dm] -= $obj->credit;
$encaiss[$obj->dm] -= $obj->debit;
}
if ($obj->pcg_type == 'INCOME') {
if ($obj->pcg_type == 'EXPENSE') {
if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0; // To avoid warning of var not defined
$decaiss[$obj->dm] += $obj->debit;
$decaiss[$obj->dm] -= $obj->credit;

View File

@ -421,7 +421,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Tag social contribution as payed completely
* Tag social contribution as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
@ -439,7 +439,7 @@ class ChargeSociales extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove tag payed on social contribution
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
@ -459,7 +459,7 @@ class ChargeSociales extends CommonObject
* Retourne le libelle du statut d'une charge (impaye, payee)
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function getLibStatut($mode = 0, $alreadypaid = -1)
@ -473,7 +473,7 @@ class ChargeSociales extends CommonObject
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount paid if you have it, 1 otherwise)
* @return string Label
*/
public function LibStatut($status, $mode = 0, $alreadypaid = -1)

View File

@ -110,7 +110,7 @@ class PaymentSocialContribution extends CommonObject
* Use this->amounts to have list of lines for the payment
*
* @param User $user User making payment
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
* @param int $closepaidcontrib 1=Also close paid contributions to paid, 0=Do nothing more
* @return int <0 if KO, id of payment if OK
*/
public function create($user, $closepaidcontrib = 0)
@ -178,7 +178,7 @@ class PaymentSocialContribution extends CommonObject
{
$amount = price2num($amount);
// If we want to closed payed invoices
// If we want to closed paid invoices
if ($closepaidcontrib)
{
$contrib = new ChargeSociales($this->db);

View File

@ -413,7 +413,7 @@ class Tva extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* VAT payed
* Total of VAT paid into invoice
*
* @param int $year Year
* @return double Amount
@ -451,7 +451,7 @@ class Tva extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Total of the VAT payed
* Total of the VAT paid
*
* @param int $year Year
* @return double Amount

View File

@ -543,7 +543,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
/*
* Payed
* Paid
*/
print load_fiche_titre($langs->trans("VATPaid"), '', '');

View File

@ -831,7 +831,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '<tr><td>'.$langs->trans("ContactByDefaultFor").'</td>';
print '<td colspan="3">';
$contactType = $object->listeTypeContacts('external', '', 1);
print $form->multiselectarray('roles', $contactType);
print $form->multiselectarray('roles', $contactType, array(), 0, 0, 'minwidth500');
print '</td></tr>';
}

View File

@ -883,8 +883,8 @@ if (empty($reshook))
$action = 'editref';
} else {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$old_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$old_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$files = dol_dir_list($old_filedir);
if (!empty($files))
@ -929,7 +929,7 @@ if (empty($reshook))
// Actions to build doc
$upload_dir = $conf->contrat->dir_output;
$upload_dir = $conf->contrat->multidir_output[$object->entity];
$permissiontoadd = $user->rights->contrat->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
@ -2131,13 +2131,13 @@ if ($action == 'create')
* Documents generes
*/
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->contrat->lire;
$delallowed = $user->rights->contrat->creer;
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : $conf->global->CONTRACT_ADDON_PDF), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements
@ -2162,7 +2162,7 @@ if ($action == 'create')
// Presend form
$modelmail = 'contract';
$defaulttopic = 'SendContractRef';
$diroutput = $conf->contrat->dir_output;
$diroutput = $conf->contrat->multidir_output[$object->entity];
$trackid = 'con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

View File

@ -1296,7 +1296,7 @@ class Contrat extends CommonObject
$ref = dol_sanitizeFileName($this->ref);
if ($conf->contrat->dir_output)
{
$dir = $conf->contrat->dir_output."/".$ref;
$dir = $conf->contrat->multidir_output[$this->entity]."/".$ref;
if (file_exists($dir))
{
$res = @dol_delete_dir_recursive($dir);

View File

@ -74,7 +74,7 @@ if ($object->id > 0)
$object->fetch_thirdparty();
}
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$modulepart = 'contract';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -201,7 +201,7 @@ $socstatic = new Societe($db);
$contracttmp = new Contrat($db);
$sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
@ -256,7 +256,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,';
$sql .= " typent.code,";
$sql .= " state.code_departement, state.nom";
@ -640,7 +640,7 @@ while ($i < min($num, $limit))
}
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($obj->ref);
$filedir = $conf->contrat->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
@ -658,7 +658,7 @@ while ($i < min($num, $limit))
}
if (!empty($arrayfields['s.nom']['checked']))
{
print '<td>';
print '<td class="tdoverflowmax150">';
if ($obj->socid > 0) {
// TODO Use a cache for this string
print $socstatic->getNomUrl(1, '');

View File

@ -3,7 +3,7 @@
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1082,6 +1082,7 @@ if ($action == 'remove_file')
$action = '';
}
// Validate records
if (!$error && $massaction == 'validate' && $permissiontoadd)
{
@ -1110,18 +1111,47 @@ if (!$error && $massaction == 'validate' && $permissiontoadd)
if ($result > 0)
{
$result = $objecttmp->validate($user);
if ($result == 0)
{
if ($result == 0) {
$langs->load("errors");
setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors');
$error++;
break;
} elseif ($result < 0)
{
} elseif ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else $nbok++;
} else {
// validate() rename pdf but do not regenerate
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $objecttmp->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('products');
}
$model = $objecttmp->model_pdf;
$ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records
// To be sure vars is defined
$hidedetails = !empty($hidedetails) ? $hidedetails : 0;
$hidedesc = !empty($hidedesc) ? $hidedesc : 0;
$hideref = !empty($hideref) ? $hideref : 0;
$moreparams = !empty($moreparams) ? $moreparams : null;
$result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
}
}
$nbok++;
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;

View File

@ -135,7 +135,7 @@ class box_comptes extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code)
);
$line++;

View File

@ -26,7 +26,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show not payed suppliers invoices
* Class to manage the box to show not paid suppliers invoices
*/
class box_factures_fourn_imp extends ModeleBoxes
{

View File

@ -110,7 +110,8 @@ class box_factures_imp extends ModeleBoxes
$sql .= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.logo, s.email, s.entity, s.tva_intra, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6,";
$sql .= " f.ref, f.date_lim_reglement,";
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";

View File

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

View File

@ -221,6 +221,12 @@ abstract class CommonObject
*/
public $statut;
/**
* @var int The object's status
* @see setStatut()
*/
public $status;
/**
* @var string
* @see getFullAddress()
@ -1054,7 +1060,6 @@ abstract class CommonObject
{
$this->error = $this->db->errno();
$this->db->rollback();
echo 'err rollback';
return -2;
} else {
$this->error = $this->db->error();
@ -1394,6 +1399,8 @@ abstract class CommonObject
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num > 0) {
$langs->loadLangs(array("propal", "orders", "bills", "suppliers", "contracts", "supplier_proposal"));
while ($obj = $this->db->fetch_object($resql)) {
$modulename = $obj->element;
if (strpos($obj->element, 'project') !== false) {
@ -1409,11 +1416,15 @@ abstract class CommonObject
}
if ($conf->{$modulename}->enabled) {
$libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code;
$tmpelement = $obj->element;
$transkey = "TypeContact_".$tmpelement."_".$source."_".$obj->code;
$libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle);
if (empty($option))
if (empty($option)) {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
else $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
}
else {
$tab[$obj->rowid] = $libelle_element.' - '.$libelle_type;
}
}
}
}
@ -5298,6 +5309,7 @@ abstract class CommonObject
$mandatorypb = false;
if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb = true;
if ($this->array_options[$key] === '') $mandatorypb = true;
if ($attributeType == 'sellist' && $this->array_options[$key] == '0') $mandatorypb = true;
if ($mandatorypb)
{
dol_syslog("Mandatory extra field ".$key." is empty");

View File

@ -222,6 +222,7 @@ class DiscountAbsolute
if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht = 0;
if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva = 0;
if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc = 0;
if (empty($this->tva_tx)) $this->tva_tx = 0;
// Check parameters
if (empty($this->description))

View File

@ -839,7 +839,7 @@ class ExtraFields
$array_name_label = array();
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,printable,totalizable,fielddefault,fieldcomputed,entity,enabled,help";
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, perms, langs, list, printable, totalizable, fielddefault, fieldcomputed, entity, enabled, help";
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
if ($elementtype) $sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'"; // Filed with object->table_element
@ -1998,9 +1998,12 @@ class ExtraFields
if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{
// Check if empty without using GETPOST, 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')
// Check if functionally empty without using GETPOST (depending on the type of extrafield, a
// technically non-empty value may be treated as empty functionally).
// 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])))
{
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];

View File

@ -253,9 +253,9 @@ class Form
if (empty($notabletag)) $ret .= '<td class="left">';
//else $ret.='<div class="clearboth"></div>';
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n";
$ret .= '<input type="submit" class="button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
if (empty($notabletag)) $ret .= '</td>';
if (empty($notabletag)) $ret .= '</tr></table>'."\n";
@ -1927,7 +1927,7 @@ class Form
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page)
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
@ -1949,7 +1949,7 @@ class Form
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array(), $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0)
{
// phpcs:enable
global $langs, $conf;
@ -1997,10 +1997,13 @@ class Form
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (!empty($conf->variants->enabled)) {
if (!empty($conf->variants->enabled) && is_array($selected_combinations)) {
// Code to automatically insert with javascript the select of attributes under the select of product
// when a parent of variant has been selected.
$out .= '
<!-- script to auto show attributes select tags if a variant was selected -->
<script>
// auto show attributes fields
selected = '.json_encode($selected_combinations).';
combvalues = {};
@ -2019,6 +2022,8 @@ class Form
return;
}
console.log("A change has started. We get variants fields to inject html select");
jQuery.getJSON("'.DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
id: jQuery(this).val()
}, function (data) {
@ -2035,8 +2040,7 @@ class Form
span.append(
jQuery(document.createElement(\'div\')).text(val.label).css({
\'font-weight\': \'bold\',
\'display\': \'table-cell\',
\'text-align\': \'right\'
\'display\': \'table-cell\'
})
);
@ -3040,10 +3044,10 @@ class Form
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'price_ht'=>price2num($objp->unitprice, 'MT'), 'up'=>price2num($objp->unitprice, 'MT'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
// Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
@ -4170,7 +4174,7 @@ class Form
$output .= '<option value="-1">&nbsp;</option>';
foreach ($cate_arbo as $key => $value)
{
if ($cate_arbo[$key]['id'] == $selected || ($selected == 'auto' && count($cate_arbo) == 1))
if ($cate_arbo[$key]['id'] == $selected || ($selected === 'auto' && count($cate_arbo) == 1))
{
$add = 'selected ';
} else {
@ -5507,9 +5511,11 @@ class Form
*/
public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0)
{
$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty);
$ret .= '<br/>';
$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty);
global $langs;
$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
$ret .= '<br>';
$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
return $ret;
}
@ -5536,7 +5542,7 @@ class Form
* @param int $stepminutes Specify step for minutes between 1 and 30
* @param string $labeladddateof Label to use for the $adddateof parameter.
* @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
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
@ -5544,8 +5550,8 @@ class Form
{
global $conf, $langs;
if ($gm == 'auto') {
$gm = $conf->tzuserinputkey;
if ($gm === 'auto') {
$gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
}
$retstring = '';
@ -5608,6 +5614,9 @@ class Form
if ($h == 3) $shour = '';
if ($m == 3) $smin = '';
$nowgmt = dol_now('gmt');
//var_dump(dol_print_date($nowgmt, 'dayhourinputnoreduce', 'tzuserrel'));
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
$usecalendar = 'combo';
if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
@ -5624,19 +5633,19 @@ class Form
if (strval($set_time) != '' && $set_time != -1)
{
//$formated_date=dol_print_date($set_time,$conf->format_date_short);
$formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput")); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
}
// Calendrier popup version eldy
if ($usecalendar == "eldy")
{
// Zone de saisie manuelle de la date
// Input area to enter date manually
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>';
// Icone calendrier
// Icon calendar
if (!$disabled)
{
$retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
@ -5816,8 +5825,7 @@ class Form
{
// Script which will be inserted in the onClick of the "Now" link
$reset_scripts = "";
if ($addnowlink == 2) // local computer time
{
if ($addnowlink == 2) { // local computer time
// pad add leading 0 on numbers
$reset_scripts .= "Number.prototype.pad = function(size) {
var s = String(this);
@ -5828,14 +5836,12 @@ class Form
}
// Generate the date part, depending on the use or not of the javascript calendar
if ($addnowlink == 1) // server time expressed in user time setup
{
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
} elseif ($addnowlink == 2)
{
if ($addnowlink == 1) { // server time expressed in user time setup
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
} elseif ($addnowlink == 2) {
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
* This break application for foreign languages.
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
@ -5843,10 +5849,10 @@ class Form
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
*/
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
}
/*if ($usecalendar == "eldy")
{
@ -5866,7 +5872,7 @@ class Form
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
if ($addnowlink == 1)
{
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
} elseif ($addnowlink == 2)
{
@ -5883,7 +5889,7 @@ class Form
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
if ($addnowlink == 1)
{
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
} elseif ($addnowlink == 2)
{
@ -5908,22 +5914,22 @@ class Form
$reset_scripts = "";
// Generate the date part, depending on the use or not of the javascript calendar
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
// Update the hour part
if ($h)
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
if ($fullday) $reset_scripts .= ' } ';
}
// Update the minute part
if ($m)
{
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
if ($fullday) $reset_scripts .= ' } ';
}
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
@ -5935,12 +5941,12 @@ class Form
}
}
// Add a "Plus one hour" link
// Add a link to set data
if ($conf->use_javascript_ajax && $adddateof)
{
$tmparray = dol_getdate($adddateof);
if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
$retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
$retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="console.log(\'Click on now link\'); jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'dayinputnoreduce').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
}
return $retstring;

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/class/html.formactions.class.php
* \ingroup core
* \brief Fichier de la classe des fonctions predefinie de composants html actions
* \brief File of class with predefined functions and HTML components
*/
@ -202,7 +202,7 @@ class FormActions
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', 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.($object->socid > 0 ? '&amp;socid='.$object->socid : ($socid > 0 ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage));
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', 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.($object->socid > 0 ? '&amp;socid='.$object->socid : ($socid > 0 ? '&amp;socid='.$socid : '')).($projectid > 0 ? '&amp;projectid='.$projectid : '').'&amp;backtopage='.urlencode($urlbacktopage));
}

View File

@ -1022,11 +1022,10 @@ class FormCompany extends Form
public function formThirdpartyType($page, $selected = '', $htmlname = 'socid', $filter = '', $nooutput = 0)
{
// phpcs:enable
global $langs;
global $conf, $langs;
$out = '';
if ($htmlname != "none")
{
if ($htmlname != "none") {
$out .= '<form method="post" action="'.$page.'">';
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -1035,8 +1034,7 @@ class FormCompany extends Form
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$out .= '</form>';
} else {
if ($selected)
{
if ($selected) {
$arr = $this->typent_array(0);
$typent = $arr[$selected];
$out .= $typent;
@ -1045,7 +1043,10 @@ class FormCompany extends Form
}
}
if ($nooutput) return $out;
else print $out;
if ($nooutput) {
return $out;
} else {
print $out;
}
}
}

View File

@ -426,7 +426,7 @@ class FormFile
if ($modulepart == 'company')
{
$showempty = 1;
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
@ -490,6 +490,7 @@ class FormFile
}
} elseif ($modulepart == 'contract')
{
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
@ -553,6 +554,7 @@ class FormFile
}
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
{
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';

View File

@ -455,10 +455,13 @@ class FormMail extends Form
// Zone to select email template
if (count($modelmail_array) > 0)
{
$model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : $arraydefaultmessage->id;
// If list of template is filled
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out .= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> ';
$out .= $this->selectarray('modelmailselected', $modelmail_array, 0, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
$out .= $this->selectarray('modelmailselected', $modelmail_array, $model_mail_selected_id, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
if ($user->admin) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')), 1);
$out .= ' &nbsp; ';
$out .= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';

View File

@ -113,7 +113,12 @@ class Translate
} else $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
} else { // If it's for a codetouse that is a short code xx
// Array to convert short lang code into long code.
$longforshort = array('ar'=>'ar_SA', 'el'=>'el_GR', 'ca'=>'ca_ES', 'en'=>'en_US', 'ja'=>'ja_JP', 'nb'=>'nb_NO', 'no'=>'nb_NO');
$longforshort = array(
'am'=>'am_ET', 'ar'=>'ar_SA', 'bn'=>'bn_DB', 'el'=>'el_GR', 'ca'=>'ca_ES', 'cs'=>'cs_CZ', 'en'=>'en_US', 'fa'=>'fa_IR',
'gl'=>'gl_ES', 'he'=>'he_IL', 'hi'=>'hi_IN', 'ja'=>'ja_JP',
'ka'=>'ka_GE', 'km'=>'km_KH', 'kn'=>'kn_IN', 'ko'=>'ko_KR', 'lo'=>'lo_LA', 'nb'=>'nb_NO', 'no'=>'nb_NO', 'ne'=>'ne_NP',
'sl'=>'sl_SI', 'sq'=>'sq_AL', 'sr'=>'sr_RS', 'sv'=>'sv_SE', 'uk'=>'uk_UA', 'vi'=>'vi_VN', 'zh'=>'zh_CN'
);
if (isset($longforshort[strtolower($langpart[0])])) $srclang = $longforshort[strtolower($langpart[0])];
elseif (!empty($langpart[0])) $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
else $srclang = 'en_US';

View File

@ -183,17 +183,18 @@ function getObjectFromID(id){
}
// Called after selection of a date to save details into detailed fields
function dpChangeDay(dateFieldID,format)
function dpChangeDay(dateFieldID, format)
{
//showDP.datefieldID=dateFieldID;
console.log("Call dpChangeDay, we save date into detailed fields.");
console.log("Call dpChangeDay, we save date into detailed fields from format = "+format);
var thefield=getObjectFromID(dateFieldID);
var thefieldday=getObjectFromID(dateFieldID+"day");
var thefieldmonth=getObjectFromID(dateFieldID+"month");
var thefieldyear=getObjectFromID(dateFieldID+"year");
var date=getDateFromFormat(thefield.value,format);
var date=getDateFromFormat(thefield.value, format);
//console.log(date);
if (date)
{
thefieldday.value=date.getDate();

View File

@ -144,10 +144,10 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
dataType: "json",
minLength: '.$minLength.',
select: function( event, ui ) { // Function ran once new value has been selected into javascript combo
console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'");
console.log("We will trigger change on input '.$htmlname.' because of the select definition of autocomplete code for input#search_'.$htmlname.'");
console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective");
//console.log(ui.item);
console.log("Propagate before some properties retrieved into data-xxx properties");
$("#'.$htmlname.'").attr("data-pbq", ui.item.pbq);
$("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht);
$("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype);
@ -155,6 +155,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount);
$("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value
// Disable an element
if (options.option_disabled) {
console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled)
@ -170,6 +171,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + options.option_disabled).removeAttr("disabled");
}
}
if (options.disabled) {
console.log("Make action disabled on each "+options.option_disabled)
$.each(options.disabled, function(key, value) {
@ -182,11 +184,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#" + value).show().trigger("show");
});
}
// Update an input
if (ui.item.update) {
console.log("Make action update on each ui.item.update")
// loop on each "update" fields
$.each(ui.item.update, function(key, value) {
console.log("Set value "+value+" into #"+key);
$("#" + key).val(value).trigger("change");
});
}
@ -202,7 +206,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
}
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
console.log("ajax_autocompleter new value selected, we trigger change also on original component so on field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}

View File

@ -80,7 +80,7 @@ function asset_prepare_head(Asset $object)
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/asset/card.php';
$head[$h][0] = DOL_URL_ROOT.'/asset/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;

View File

@ -1206,24 +1206,23 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
global $form;
global $param, $massactionbutton;
$start_year = GETPOST('dateevent_startyear');
$start_month = GETPOST('dateevent_startmonth');
$start_day = GETPOST('dateevent_startday');
$end_year = GETPOST('dateevent_endyear');
$end_month = GETPOST('dateevent_endmonth');
$end_day = GETPOST('dateevent_endday');
$start_year = GETPOST('dateevent_startyear', 'int');
$start_month = GETPOST('dateevent_startmonth', 'int');
$start_day = GETPOST('dateevent_startday', 'int');
$end_year = GETPOST('dateevent_endyear', 'int');
$end_month = GETPOST('dateevent_endmonth', 'int');
$end_day = GETPOST('dateevent_endday', 'int');
$tms_start = '';
$tms_end = '';
if (!empty($start_year) && !empty($start_month) && !empty($start_day)) {
$search_start = $start_year.'-'.$start_month.'-'.$start_day;
$tms_start = strtotime($search_start);
$tms_start = dol_mktime(0, 0, 0, $start_month, $start_day, $start_year, 'tzuserrel');
}
if (!empty($end_year) && !empty($end_month) && !empty($end_day)) {
$search_end = $end_year.'-'.$end_month.'-'.$end_day.' 23:59:59';
$tms_end = strtotime($search_end);
$tms_end = dol_mktime(23, 59, 59, $end_month, $end_day, $end_year, 'tzuserrel');
}
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$search_start = '';
$tms_start = '';
$search_end = '';
$tms_end = '';
}
dol_include_once('/comm/action/class/actioncomm.class.php');
@ -1325,14 +1324,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
if (!empty($search_start) && !empty($search_end)) {
$sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))";
if (!empty($tms_start) && !empty($tms_end)) {
$sql .= " AND ((a.datep BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."') OR (a.datep2 BETWEEN '".$db->idate($tms_start)."' AND '".$db->idate($tms_end)."'))";
}
elseif (empty($search_start) && !empty($search_end)) {
$sql .= " AND ((a.datep <= '$search_end') OR (a.datep2 <= '$search_end'))";
elseif (empty($tms_start) && !empty($tms_end)) {
$sql .= " AND ((a.datep <= '".$db->idate($tms_end)."') OR (a.datep2 <= '".$db->idate($tms_end)."'))";
}
elseif (!empty($search_start) && empty($search_end)) {
$sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))";
elseif (!empty($tms_start) && empty($tms_end)) {
$sql .= " AND ((a.datep >= '".$db->idate($tms_start)."') OR (a.datep2 >= '".$db->idate($tms_start)."'))";
}
if (is_array($actioncode) && !empty($actioncode)) {
@ -1488,7 +1487,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, (empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 0 : 1), 1);
$out .= '</td>';
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out .= '<td class="liste_titre center">'.$form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1).'</td>';
$out .= '<td class="liste_titre center">';
$out .= $form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1);
$out .= '</td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';
$out .= '<td class="liste_titre"></td>';

View File

@ -70,7 +70,7 @@ function contract_prepare_head(Contrat $object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$upload_dir = $conf->contrat->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;

View File

@ -1192,6 +1192,16 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
{
if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename);
// If it fails and it is because of the missing write permission on parent dir
if (!$ok && file_exists(dirname($filename)) && !(fileperms(dirname($filename)) & 0200)) {
dol_syslog("Error in deletion, but parent directory exists with no permission to write, we try to change permission on parent directory and retry...", LOG_DEBUG);
@chmod(dirname($filename), fileperms(dirname($filename)) | 0200);
// Now we retry deletion
if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename);
}
if ($ok)
{
dol_syslog("Removed file ".$filename, LOG_DEBUG);
@ -1513,6 +1523,7 @@ function dol_init_file_process($pathtoscan = '', $trackid = '')
* @param int $generatethumbs 1=Generate also thumbs for uploaded image files
* @param Object $object Object used to set 'src_object_*' fields
* @return int <=0 if KO, >0 if OK
* @see dol_remove_file_process()
*/
function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesession = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null)
{
@ -1673,6 +1684,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
* @param int $donotdeletefile 1=Do not delete physically file
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
* @return void
* @see dol_add_file_process()
*/
function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletefile = 1, $trackid = '')
{
@ -2314,10 +2326,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->ficheinter->{$lire}) $accessallowed = 1;
$original_file = $conf->ficheinter->dir_output.'/'.$original_file;
} // Wrapping pour les apercu conat
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->dir_output))
elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire}) $accessallowed = 1;
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
} // Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
@ -2707,13 +2719,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
if (!empty($conf->stock->enabled)) $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file;
} // Wrapping pour les contrats
elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity]))
{
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file))
{
$accessallowed = 1;
}
$original_file = $conf->contrat->dir_output.'/'.$original_file;
$original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")";
} // Wrapping pour les dons
elseif ($modulepart == 'donation' && !empty($conf->don->dir_output))

View File

@ -1969,7 +1969,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false)
* "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S",
* "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat"
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...inputnoreduce", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
@ -2013,13 +2013,17 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
}
if (!is_object($outputlangs)) $outputlangs = $langs;
if (!$format) $format = 'daytextshort';
$reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0;
// Do we have to reduce the length of date (year on 2 chars) to save space.
// Note: dayinputnoreduce is same than day but no reduction of year length will be done
$reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param.
$format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day
$formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
// TODO Add format daysmallyear and dayhoursmallyear
if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short);
elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration);
elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text);
@ -2209,9 +2213,10 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto',
{
global $conf;
//print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -";
//print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'<br>';
if ($gm == 'auto') {
$gm = $conf->tzuserinputkey;
if ($gm === 'auto') {
$gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey);
}
// Clean parameters
@ -2273,7 +2278,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).
*
* @param string $mode 'auto'
* @param string $mode 'auto' => for backward compatibility (avoid this),
* 'gmt' => we return GMT timestamp,
* 'tzserver' => we add the PHP server timezone
* 'tzref' => we add the company timezone. Not implemented.
@ -2284,8 +2289,8 @@ function dol_now($mode = 'auto')
{
$ret = 0;
if ($mode == 'auto') {
$mode = 'tzserver';
if ($mode === 'auto') {
$mode = 'gmt';
}
if ($mode == 'gmt') $ret = time(); // Time for now at greenwich.
@ -4499,7 +4504,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
print "\n";
print "<!-- Begin title '".$titre."' -->\n";
print "<!-- Begin title -->\n";
print '<table class="centpercent notopnoleftnoright table-fiche-title'.($morecss ? ' '.$morecss : '').'"><tr>'; // maring bottom must be same than into load_fiche_tire
// Left
@ -5785,8 +5790,8 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
$temp = preg_replace($pattern, "", $temp); // pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
$temp = preg_replace($pattern, "", $temp); // pass 2 - $temp after pass 2: 0000-021
// removed '<' into non closing html tags like '<a'
$temp = preg_replace('/<(\w+)/', '\1', $temp);
// Remove '<' into remainging, so non closing html tags like '<abc'. Note: '<123abc' is not a html tag (can be kept), but '<abc123' is (must be removed).
$temp = preg_replace('/<([a-z]+)/i', '\1', $temp);
}
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);

View File

@ -315,7 +315,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_validation, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_validation, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -349,7 +349,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -377,7 +377,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_approve2, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_approve2, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -413,7 +413,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_closing, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_closing, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -447,7 +447,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_rappro, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_rappro, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}
@ -460,7 +460,7 @@ function dol_print_object_info($object, $usetable = 0)
if ($usetable) print '</td><td>';
else print ': ';
print dol_print_date($object->date_envoi, 'dayhour', 'tzserver');
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzserver').' &nbsp;'.$langs->trans("ClientHour");
if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").' &nbsp; / &nbsp; '.dol_print_date($object->date_envoi, "dayhour", 'tzuserrel').' &nbsp;'.$langs->trans("ClientHour");
if ($usetable) print '</td></tr>';
else print '<br>';
}

View File

@ -51,6 +51,11 @@ function holiday_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/holiday/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -43,7 +43,11 @@ function import_prepare_head($param, $maxstep = 0)
$i = 1;
while ($i <= $maxstep)
{
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
if ($i < 6) {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
} else {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
}
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;
$h++;

View File

@ -189,7 +189,7 @@ function invoice_rec_prepare_head($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("CardBill");
$head[$h][1] = $langs->trans("RepeatableInvoice");
$head[$h][2] = 'card';
$h++;

View File

@ -165,6 +165,7 @@ function dol_verifyHash($chain, $hash, $type = '0')
/**
* Check permissions of a user to show a page and an object. Check read permission.
* If GETPOST('action','aZ09') defined, we also check write and delete permission.
* This method check permission on module then call checkUserAccessToObject() for permission on object (according to entity and socid of user).
*
* @param User $user User to check
* @param string $features Features to check (it must be module $object->element. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
@ -175,20 +176,22 @@ function dol_verifyHash($chain, $hash, $type = '0')
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param int $isdraft 1=The object with id=$objectid is a draft
* @return int Always 1, die process if not allowed
* @see dol_check_secure_access_document()
* @see dol_check_secure_access_document(), checkUserAccessToObject()
*/
function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0)
{
global $db, $conf;
global $hookmanager;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select");
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
$parentfortableentity = '';
// Fix syntax of $features param
$originalfeatures = $features;
if ($features == 'facturerec') $features = 'facture';
if ($features == 'mo') $features = 'mrp';
if ($features == 'member') $features = 'adherent';
@ -198,7 +201,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if ($features == 'product') $features = 'produit';
// Get more permissions checks from hooks
$parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
if (isset($hookmanager->resArray['result'])) {
@ -218,11 +221,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
// More subfeatures to check
if (!empty($feature2)) $feature2 = explode("|", $feature2);
// More parameters
$params = explode('&', $tableandshare);
$dbtablename = (!empty($params[0]) ? $params[0] : '');
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename);
$listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
// Check read permission from module
@ -247,6 +245,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; }
} elseif ($feature == 'projet') {
if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; }
} elseif ($feature == 'payment') {
if (!$user->rights->facture->lire) { $readok = 0; $nbko++; }
} elseif ($feature == 'payment_supplier') {
if (!$user->rights->fournisseur->facture->lire) { $readok = 0; $nbko++; }
} elseif (!empty($feature2)) { // This is for permissions on 2 levels
$tmpreadok = 1;
foreach ($feature2 as $subfeature) {
@ -426,6 +428,10 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
{
global $db, $conf;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".join(',', $featuresarray).", feature2=".$feature2.", objectid=".$objectid;
//print ", tableandshare=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select."<br>";
// More parameters
$params = explode('&', $tableandshare);
$dbtablename = (!empty($params[0]) ? $params[0] : '');
@ -440,13 +446,13 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'project') $feature = 'projet';
if ($feature == 'task') $feature = 'projet_task';
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company)
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company)
$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 + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$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
//$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 + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
// If dbtablename not defined, we use same name for table than module name
if (empty($dbtablename))
@ -455,17 +461,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too.
}
// Check permission for object with entity
// Check permission for object on entity only
if (in_array($feature, $check))
{
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled))
{
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{
if ($conf->entity == 1 && $user->admin && !$user->entity)
{
if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { // Special for multicompany
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if ($conf->entity == 1 && $user->admin && !$user->entity) {
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IS NOT NULL";
} else {
@ -490,15 +493,12 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
}
}
} elseif (in_array($feature, $checksoc)) // We check feature = checksoc
{
// If external user: Check permission for external users
if ($user->socid > 0)
{
} elseif (in_array($feature, $checksoc)) { // We check feature = checksoc
if ($user->socid > 0) {
// If external user: Check permission for external users
if ($user->socid <> $objectid) return false;
} // If internal user: Check permission for internal users that are restricted on their objects
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
{
} 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
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe as s)";
@ -506,15 +506,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND sc.fk_user = ".$user->id;
$sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
} // If multicompany and internal users with all permissions, check user is in correct entity
elseif (!empty($conf->multicompany->enabled))
{
} elseif (!empty($conf->multicompany->enabled)) {
// If multicompany and internal users with all permissions, check user is in correct entity
$sql = "SELECT COUNT(s.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid IN (".$objectid.")";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
}
} elseif (in_array($feature, $checkother)) // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
} elseif (in_array($feature, $checkother)) // Test on entity + link to thirdparty. Allowed if link is empty (Ex: contacts...).
{
// If external user: Check permission for external users
if ($user->socid > 0)
@ -582,29 +581,34 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$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 ($user->socid > 0)
{
if ($user->socid > 0) {
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " WHERE dbt.rowid IN (".$objectid.")";
$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) && ($user->rights->societe->lire && !$user->rights->societe->client->voir))
{
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield;
$sql .= " AND dbt.".$dbt_keyfield." = s.rowid";
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
$sql .= " AND sc.fk_user = ".$user->id;
} elseif (!empty($conf->societe->enabled) && !$user->rights->societe->client->voir) {
// If internal user: Check permission for internal users that are restricted on their objects
if ($feature != 'ticket') {
if (empty($dbt_keyfield)) dol_print_error('', 'Param dbt_keyfield is required but not defined');
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$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_user = ".$user->id;
} else {
// On ticket, the thirdparty is not mandatory, so we need a special test to accept record with no thirdparties.
$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
elseif (!empty($conf->multicompany->enabled))
{

View File

@ -283,7 +283,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out = '';
$histo = array();
$numaction = 0;
$now = dol_now('tzuser');
$now = dol_now();
// Open DSI -- Fix order by -- Begin
$sortfield_list = explode(',', $sortfield);
@ -622,7 +622,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= '<!-- timeline time label -->';
$out .= '<li class="time-label">';
$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 .= '</li>';
$out .= '<!-- /.timeline-label -->';
@ -660,14 +660,14 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out .= '</span>';
// Date
$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']) {
$tmpa = dol_getdate($histo[$key]['datestart'], true);
$tmpb = dol_getdate($histo[$key]['dateend'], true);
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 {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour');
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour', 'tzuserrel');
}
}
$late = 0;

View File

@ -1451,7 +1451,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) {
$newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create", $langs->trans("MenuNewTypeAssets"), 2, (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance));
$newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->setup_advance);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
}
}

View File

@ -198,8 +198,8 @@ class MenuManager
$submenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1);
$submenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1);
$submenu->add("/admin/boxes.php", $langs->trans("Boxes"), 1);
$submenu->add("/admin/delais.php", $langs->trans("Alerts"), 1);
$submenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1);
$submenu->add("/admin/delais.php?mainmenu=home", $langs->trans("Alerts"), 1);
$submenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"), 1);
$submenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1);
$submenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);
@ -340,8 +340,8 @@ class MenuManager
$this->menu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"), 1);
$this->menu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"), 1);
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"), 1);
$this->menu->add("/admin/delais.php", $langs->trans("Alerts"), 1);
$this->menu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"), 1);
$this->menu->add("/admin/delais.php?mainmenu=home", $langs->trans("Alerts"), 1);
$this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"), 1);
$this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"), 1);
$this->menu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1);

View File

@ -101,7 +101,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta"));
$dir = $_dir."/".get_exdir($number, 0, 1, 0, $object, 'cheque').$number;
$dir = $_dir."/".get_exdir($number, 0, 1, 0, $object, 'checkdeposits');
if (!is_dir($dir))
{

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