Merge remote-tracking branch 'Dolibarr/14.0' into 14

This commit is contained in:
Francis Appels 2021-10-04 18:52:43 +02:00
commit 616bebfe55
91 changed files with 780 additions and 461 deletions

View File

@ -154,18 +154,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
### Other application/modules
- Electronic Document Management (EDM)
- Electronic Document Management (EDM)
- Bookmarks management
- Reporting
- Data export/import
- Barcodes
- Barcodes
- Margin calculations
- LDAP connectivity
- ClickToDial integration
- Mass emailing
- RSS integration
- Skype integration
- Social platforms linking
- Social platforms linking
- Payment platforms integration (PayPal, Stripe, Paybox...)
- Email-Collector
@ -179,14 +179,11 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Multi-Users and groups with finely grained rights
- Multi-Currency
- Multi-Company (by adding of an external module)
- Very user friendly and easy to use
- customizable Dashboard
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- APIs (REST, SOAP)
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
- Support a lot of country specific features:
- Spanish Tax RE and ISPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
@ -197,7 +194,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Compatible with European GDPR rules
- ...
- Flexible PDF & ODT generation for invoices, proposals, orders...
-
- ...
### System Environment / Requirements

View File

@ -186,18 +186,35 @@ if ($action == 'update') {
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
$ko++;
} else {
$db->begin();
$sql = '';
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, '".$db->escape($accountancy_field_name)."')";
$sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')";
$sql .= " ON DUPLICATE KEY UPDATE ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'";
$sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity";
$sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity);
$resql_exists = $db->query($sql_exists);
if (!$resql_exists) {
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>';
$ko++;
} else {
$nb_exists = $db->num_rows($resql_exists);
if ($nb_exists <= 0) {
// insert
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')";
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
} else {
$obj_exists = $db->fetch_object($resql_exists);
// update
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity";
$sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'";
$sql .= " WHERE rowid = " . ((int) $obj_exists->rowid);
}
}
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."product";
$sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'";
$sql .= " WHERE rowid = ".((int) $productid);
}
$db->begin();
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql)) {
$ok++;

View File

@ -591,7 +591,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
} elseif (!$notifiedexportdate || !$notifiedvalidationdate) {
} elseif (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
// Specify as export : update field date_export or date_validated
$error = 0;
$db->begin();
@ -602,17 +602,17 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET";
if (!$notifiedexportdate && !$notifiedvalidationdate) {
if (!empty($notifiedexportdate) && !empty($notifiedvalidationdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
$sql .= ", date_validated = '".$db->idate($now)."'";
} elseif (!$notifiedexportdate) {
} elseif (!empty($notifiedexportdate)) {
$sql .= " date_export = '".$db->idate($now)."'";
} elseif (!$notifiedvalidationdate) {
} elseif (!empty($notifiedvalidationdate)) {
$sql .= " date_validated = '".$db->idate($now)."'";
}
$sql .= " WHERE rowid = ".((int) $movement->id);
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result) {
$error++;

View File

@ -38,10 +38,12 @@ header('Content-Type: text/csv');
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
$accountancyexport = new AccountancyExport($db);
if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") { // Specific filename for FEC model export into the general ledger
// Specific filename for FEC model export into the general ledger
if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountancyexport->getFormatCode($formatexportset) == 'fec2')
&& $type_export == "general_ledger") {
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
if (empty($search_date_end)) {
// TODO Get the max date into bookeeping table
// TODO Get the max date into bookkeeping table
$search_date_end = dol_now();
}
$datetouseforfilename = $search_date_end;
@ -58,7 +60,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_CIEL && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
} elseif ($accountancyexport->getFormatCode($formatexportset) == 'ciel' && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
$completefilename = "XIMPORT.TXT";
} else {
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;

View File

@ -318,6 +318,19 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print "</tr>";
$i++;
}
// If no record found
if ($num == 0) {
/*$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}*/
$colspan = 8;
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>";
print '</div>';

View File

@ -1175,6 +1175,8 @@ if ($id) {
$sql .= natural_search("r.code_region", $search_code);
} elseif ($search_code != '' && $id == 7) {
$sql .= natural_search("a.code", $search_code);
} elseif ($search_code != '' && $id == 10) {
$sql .= natural_search("t.code", $search_code);
} elseif ($search_code != '' && $id != 9) {
$sql .= natural_search("code", $search_code);
}

View File

@ -232,7 +232,7 @@ class PrestaShopWebservice
if ($response != '') {
libxml_clear_errors();
libxml_use_internal_errors(true);
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA);
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
if (libxml_get_errors()) {
$msg = var_export(libxml_get_errors(), true);
libxml_clear_errors();

View File

@ -160,6 +160,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabhelp = array();
$tabhelp[25] = array(
'label'=>$langs->trans('EnterAnyCode'),
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
@ -683,8 +684,8 @@ if ($action == 'view') {
$tmpaction = 'create';
$parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]
);
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
@ -822,7 +823,7 @@ if ($resql) {
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150');
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150');
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
@ -1187,7 +1188,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($value == 'fk_user') {
print '<td>';
if ($user->admin) {
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth300');
} else {
if ($context == 'add') { // I am not admin and we show the add form
print $user->getNomUrl(1); // Me

View File

@ -133,7 +133,7 @@ if ($action == 'install') {
// $original_file should match format module_modulename-x.y[.z].zip
$original_file = basename($_FILES["fileinstall"]["name"]);
$original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file);
$original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file);
$newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
if (!$original_file) {

View File

@ -51,7 +51,7 @@ if ($action == 'getlastversion') {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
if (function_exists('simplexml_load_string')) {
$sfurl = simplexml_load_string($result['content']);
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
}

View File

@ -171,7 +171,7 @@ if (GETPOST('target') == 'remote') {
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
$xmlfile = $xmlarray['content'];
//print "xmlfilestart".$xmlfile."xmlfileend";
$xml = simplexml_load_string($xmlfile);
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
setEventMessages($errormsg, null, 'errors');

View File

@ -63,7 +63,7 @@ print '<br>';
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled');
if ($test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotSlowedDownByThis");
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' <span class="opacitymedium">'.$langs->trans("NotSlowedDownByThis").'</span>';
} else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';

View File

@ -110,7 +110,7 @@ if (!empty($conf->syslog->enabled)) {
print '<input type="radio" name="choice" id="choicetempfiles" value="tempfiles"';
print (!$choice || $choice == 'tempfiles' || $choice == 'allfiles') ? ' checked' : '';
print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFiles").'</label><br><br>';
print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFilesShort").'</label><br><br>';
print '<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
print ($choice && $choice == 'confirm_allfiles') ? ' checked' : '';

View File

@ -61,7 +61,7 @@ $version = '0.0';
if ($action == 'getlastversion') {
$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
}

View File

@ -37,6 +37,7 @@ if (!$user->admin) {
$id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optionscss', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ09');
$langcode = GETPOST('langcode', 'alphanohtml');
$transkey = GETPOST('transkey', 'alphanohtml');
@ -458,18 +459,8 @@ if ($mode == 'searchkey') {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
print '<td align="center"></td>';
print "</tr>\n";
// Line to search new record
print "\n";
print '<tr class="oddeven"><td>';
print '<tr class="liste_titre_filter"><td>';
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1);
print '</td>'."\n";
@ -495,6 +486,15 @@ if ($mode == 'searchkey') {
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
print '<td align="center"></td>';
print "</tr>\n";
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') {
ksort($recordtoshow);
}

View File

@ -1683,7 +1683,7 @@ class Setup extends DolibarrApi
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
$xmlfile = $xmlarray['content'];
//print "xmlfilestart".$xmlfile."endxmlfile";
$xml = simplexml_load_string($xmlfile);
$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
} else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
throw new RestException(500, $errormsg);

View File

@ -75,6 +75,7 @@ if ($object->id > 0) {
$object->calculateCosts();
}
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
@ -115,8 +116,13 @@ if (empty($reshook)) {
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// The fetch/fetch_lines was redone into the inc.php so we must recall the calculateCosts()
if ($action == 'confirm_validate' && $object->id > 0) {
$object->calculateCosts();
}
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';

View File

@ -865,6 +865,7 @@ class ActionComm extends CommonObject
$this->fetchResources();
}
}
$this->db->free($resql);
} else {
$this->error = $this->db->lasterror();

View File

@ -13,9 +13,9 @@
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 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
@ -88,12 +88,30 @@ $search_zip = GETPOST('search_zip', 'alpha');
$search_state = GETPOST("search_state");
$search_country = GETPOST("search_country", 'int');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_end_startday = GETPOST('search_date_end_startday', 'int');
$search_date_end_startmonth = GETPOST('search_date_end_startmonth', 'int');
$search_date_end_startyear = GETPOST('search_date_end_startyear', 'int');
$search_date_end_endday = GETPOST('search_date_end_endday', 'int');
$search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int');
$search_date_end_endyear = GETPOST('search_date_end_endyear', 'int');
$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver
$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear);
$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int');
$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int');
$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear);
$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
$search_availability = GETPOST('search_availability', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
@ -278,12 +296,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_type = '';
$search_country = '';
$search_type_thirdparty = '';
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_dateend_start = '';
$search_dateend_end = '';
$search_datedelivery_start = '';
$search_datedelivery_end = '';
$search_date_end_startday = '';
$search_date_end_startmonth = '';
$search_date_end_startyear = '';
$search_date_end_endday = '';
$search_date_end_endmonth = '';
$search_date_end_endyear = '';
$search_date_end_start = '';
$search_date_end_end = '';
$search_date_delivery_startday = '';
$search_date_delivery_startmonth = '';
$search_date_delivery_startyear = '';
$search_date_delivery_endday = '';
$search_date_delivery_endmonth = '';
$search_date_delivery_endyear = '';
$search_date_delivery_start = '';
$search_date_delivery_end = '';
$search_availability = '';
$search_status = '';
$object_statut = '';
@ -471,11 +507,11 @@ $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity as user_entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
if ($search_categ_cus) {
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
@ -493,7 +529,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus)) {
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
@ -592,6 +628,7 @@ if ($search_multicurrency_montant_ttc != '') {
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
}
@ -627,17 +664,17 @@ if ($search_date_start) {
if ($search_date_end) {
$sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
}
if ($search_dateend_start) {
$sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
if ($search_date_end_start) {
$sql .= " AND p.fin_validite >= '".$db->idate($search_date_end_start)."'";
}
if ($search_dateend_end) {
$sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
if ($search_date_end_end) {
$sql .= " AND p.fin_validite <= '".$db->idate($search_date_end_end)."'";
}
if ($search_datedelivery_start) {
$sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
if ($search_date_delivery_start) {
$sql .= " AND p.date_livraison >= '".$db->idate($search_date_delivery_start)."'";
}
if ($search_datedelivery_end) {
$sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
if ($search_date_delivery_end) {
$sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
}
if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
@ -712,12 +749,60 @@ if ($resql) {
if ($sall) {
$param .= '&sall='.urlencode($sall);
}
if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y'));
if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y'));
if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y'));
if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y'));
if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y'));
if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y'));
if ($search_date_startday) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
}
if ($search_date_startmonth) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
if ($search_date_startyear) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
if ($search_date_endday) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
if ($search_date_endmonth) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
if ($search_date_endyear) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($search_date_end_startday) {
$param .= '&search_date_end_startday='.urlencode($search_date_end_startday);
}
if ($search_date_end_startmonth) {
$param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth);
}
if ($search_date_end_startyear) {
$param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear);
}
if ($search_date_end_endday) {
$param .= '&search_date_end_endday='.urlencode($search_date_end_endday);
}
if ($search_date_end_endmonth) {
$param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth);
}
if ($search_date_end_endyear) {
$param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear);
}
if ($search_date_delivery_startday) {
$param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday);
}
if ($search_date_delivery_startmonth) {
$param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth);
}
if ($search_date_delivery_startyear) {
$param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear);
}
if ($search_date_delivery_endday) {
$param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday);
}
if ($search_date_delivery_endmonth) {
$param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth);
}
if ($search_date_delivery_endyear) {
$param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear);
}
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
@ -1017,10 +1102,10 @@ if ($resql) {
if (!empty($arrayfields['p.fin_validite']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print $form->selectDate($search_date_end_end ? $search_date_end_end : -1, 'search_date_end_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
@ -1028,10 +1113,10 @@ if ($resql) {
if (!empty($arrayfields['p.date_livraison']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '</td>';
}
@ -1708,8 +1793,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->email = $obj->user_email;
$userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->user_entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;

View File

@ -278,6 +278,7 @@ if (empty($reshook)) {
if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
$regs = array();
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
$element = $regs [1];
$subelement = $regs [2];
@ -1394,6 +1395,7 @@ if (empty($reshook)) {
/*
* View
*/
$title = $langs->trans('Order')." - ".$langs->trans('Card');
$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
llxHeader('', $title, $help_url);
@ -2347,17 +2349,17 @@ if ($action == 'create' && $usercancreate) {
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>';
// Multicurrency Amount VAT
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>';
// Multicurrency Amount TTC
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '<td class="valuefield nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
print '</tr>';
}
@ -2367,23 +2369,23 @@ if ($action == 'create' && $usercancreate) {
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
}
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).$alert.'</td>';
print '<td class="valuefield">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
// Total VAT
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
}
// Total TTC
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
// Statut
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';

View File

@ -299,13 +299,9 @@ class Commande extends CommonOrder
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
@ -344,6 +340,10 @@ class Commande extends CommonOrder
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
);

View File

@ -426,7 +426,7 @@ $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multic
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
$sql .= ' c.fk_input_reason';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
@ -545,7 +545,7 @@ if ($search_state) {
if ($search_country) {
$sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
}
if ($search_type_thirdparty) {
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
if ($search_company) {
@ -787,7 +787,7 @@ if ($resql) {
if ($search_country != '') {
$param .= '&search_country='.urlencode($search_country);
}
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
}
if ($search_product_category != '') {
@ -1682,8 +1682,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->email = $obj->user_email;
$userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;

View File

@ -393,13 +393,21 @@ if (empty($reshook)) {
} elseif ($action == 'setinvoicedate' && $usercancreate) {
$object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement;
$date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'));
if (empty($date)) {
$newdate = dol_mktime(0, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int'), 'tzserver');
if (empty($newdate)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate&token='.newToken());
exit;
}
$object->date = $date;
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
} else {
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
}
}
$object->date = $newdate;
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement) {
$object->date_lim_reglement = $new_date_lim_reglement;
@ -413,7 +421,9 @@ if (empty($reshook)) {
}
} elseif ($action == 'setdate_pointoftax' && $usercancreate) {
$object->fetch($id);
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
$object->date_pointoftax = $date_pointoftax;
$result = $object->update($user);
if ($result < 0) {
@ -986,14 +996,16 @@ if (empty($reshook)) {
$error++;
}
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
// Replacement invoice
if (GETPOST('type') == Facture::TYPE_REPLACEMENT) {
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@ -1005,8 +1017,6 @@ if (empty($reshook)) {
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) {
// This is a replacement invoice
$result = $object->fetch(GETPOST('fac_replacement', 'int'));
@ -1049,19 +1059,16 @@ if (empty($reshook)) {
$action = 'create';
}
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!$error) {
if (!empty($originentity)) {
$object->entity = $originentity;
@ -1265,19 +1272,16 @@ if (empty($reshook)) {
// Standard invoice or Deposit invoice, created from a Predefined template invoice
if ((GETPOST('type') == Facture::TYPE_STANDARD || GETPOST('type') == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) {
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
if (!$error) {
$object->socid = GETPOST('socid', 'int');
$object->type = GETPOST('type');
@ -1312,8 +1316,6 @@ if (empty($reshook)) {
$typeamount = GETPOST('typedeposit', 'aZ09');
$valuestandardinvoice = price2num(str_replace('%', '', GETPOST('valuestandardinvoice', 'alpha')), 'MU');
$valuedeposit = price2num(str_replace('%', '', GETPOST('valuedeposit', 'alpha')), 'MU');
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (GETPOST('socid', 'int') < 1) {
$error++;
@ -1325,7 +1327,7 @@ if (empty($reshook)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@ -1807,19 +1809,16 @@ if (empty($reshook)) {
// Situation invoices
if (GETPOST('type') == Facture::TYPE_SITUATION && GETPOST('situations')) {
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($dateinvoice)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date"));
setEventMessages($mesg, null, 'errors');
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
}
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
if (!(GETPOST('situations', 'int') > 0)) {
$error++;
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InvoiceSituation"));
@ -3514,7 +3513,8 @@ if ($action == 'create') {
print '</td></tr>';
}
$newdateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');
$date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver');
// Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
@ -3524,7 +3524,6 @@ if ($action == 'create') {
// Date point of tax
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
print '</td></tr>';
}

View File

@ -497,7 +497,7 @@ $sql .= ' typent.code as typent_code,';
$sql .= ' state.code_departement as state_code, state.nom as state_name,';
$sql .= ' country.code as country_code,';
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
$sql .= ' u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (!$sall) {
@ -520,7 +520,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
@ -1915,8 +1915,8 @@ if ($resql) {
$userstatic->login = $obj->login;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$userstatic->email = $obj->user_email;
$userstatic->statut = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;

View File

@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
// Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'other'));
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
if ($mode == 'customer' && !$user->rights->facture->lire) {
accessforbidden();
}
@ -244,7 +244,7 @@ if (!count($arrayyears)) {
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
$head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear';
$h++;
@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type);
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
//Array passed as an argument to Form::selectarray to build a proper select input
$companies = array();
foreach ($tmp_companies as $value) {
$companies[$value['key']] = $value['label'];
$filter = '';
if ($mode == 'customer') {
$filter = 's.client in (1,2,3)';
}
if ($mode == 'supplier') {
$filter = 's.fournisseur = 1';
}
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -281,14 +281,8 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') {
$filter = 's.client in (1,2,3)';
}
if ($mode == 'supplier') {
$filter = 's.fournisseur = 1';
}
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// ThirdParty Type

View File

@ -206,6 +206,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowraponall">';
print $tmpinvoice->getNomUrl(1, '');
print '</td>';
@ -222,15 +223,19 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
print '</td></tr></table>';
print '</td>';
print '<td class="left">';
print '<td class="tdoverflowmax150">';
print $thirdpartystatic->getNomUrl(1, 'customer', 44);
print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht).'</span></td>';
}
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).'</span></td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
print '<td>'.$tmpinvoice->getLibStatut(3, $obj->am).'</td>';
print '</tr>';
$total_ttc += $obj->total_ttc;

View File

@ -151,7 +151,9 @@ if ($id) {
print $bon->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($lipre->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($lipre->amount).'</span></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$lipre->LibStatut($lipre->statut, 1).'</td></tr>';
if ($lipre->statut == 3) {
@ -159,6 +161,7 @@ if ($id) {
$resf = $rej->fetch($lipre->id);
if ($resf == 0) {
print '<tr><td>'.$langs->trans("RefusedReason").'</td><td>'.$rej->motif.'</td></tr>';
print '<tr><td>'.$langs->trans("RefusedData").'</td><td>';
if ($rej->date_rejet == 0) {
/* Historique pour certaines install */
@ -167,6 +170,7 @@ if ($id) {
print dol_print_date($rej->date_rejet, 'day');
}
print '</td></tr>';
print '<tr><td>'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
} else {
print '<tr><td>'.$resf.'</td></tr>';
@ -229,7 +233,7 @@ if ($id) {
/*
* Action bar
*/
print "<div class=\"tabsAction\">";
print '<div class="tabsAction">';
if ($action == '') {
if ($bon->statut == BonPrelevement::STATUS_CREDITED) {
@ -245,7 +249,7 @@ if ($id) {
}
}
print "</div>";
print '</div>';
/*
* List of invoices
@ -267,7 +271,7 @@ if ($id) {
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
$result = $db->query($sql);

View File

@ -570,13 +570,13 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
}
$param .= '&amp;begin='.urlencode($begin).'&amp;userid='.urlencode($userid).'&amp;contactname='.urlencode($sall);
$param .= '&amp;type='.urlencode($type).'&amp;view='.urlencode($view);
if (!empty($search_categ)) {
if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&amp;search_categ='.urlencode($search_categ);
}
if (!empty($search_categ_thirdparty)) {
if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&amp;search_categ_thirdparty='.urlencode($search_categ_thirdparty);
}
if (!empty($search_categ_supplier)) {
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&amp;search_categ_supplier='.urlencode($search_categ_supplier);
}
if ($sall != '') {

View File

@ -421,16 +421,16 @@ if ($search_dfyear != '') {
if ($search_dfmonth != '') {
$param .= '&search_dfmonth='.urlencode($search_dfmonth);
}
if ($search_sale != '') {
if ($search_sale > 0) {
$param .= '&search_sale='.urlencode($search_sale);
}
if ($search_user != '') {
if ($search_user > 0) {
$param .= '&search_user='.urlencode($search_user);
}
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
if ($search_type_thirdparty > 0) {
$param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
}
if ($search_product_category != '') {
if ($search_product_category > 0) {
$param .= '&search_product_category='.urlencode($search_product_category);
}
if ($show_files) {

View File

@ -117,6 +117,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) {
$result = $object->create($user);
var_dump($object);exit;
if ($result > 0) {
// Creation OK
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;

View File

@ -99,6 +99,8 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
$perm = 1;
} else {
$tmparray = explode('_', $table_element_line);
$tmpmodule = $tmparray[0]; $tmpobject = preg_replace('/line$/', '', $tmparray[1]);
@ -111,7 +113,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
// We should not be here. If we are not allowed to reorder rows, feature should not be visible on script.
// If we are here, it is a hack attempt, so we report a warning.
print 'Bad permission to modify position of lines for object in table '.$table_element_line;
dol_syslog('Bad permission to modify position of lines for object in table '.$table_element_line.', fk_element '.$fk_element, LOG_WARNING);
dol_syslog('Bad permission to modify position of lines for object in table='.$table_element_line.', fk_element='.$fk_element, LOG_WARNING);
accessforbidden('Bad permission to modify position of lines for object in table '.$table_element_line);
}

View File

@ -3526,7 +3526,7 @@ abstract class CommonObject
$this->db->free($resql);
// Now update global field total_ht, total_ttc and tva
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
$fieldht = 'total_ht';
$fieldtva = 'tva';
$fieldlocaltax1 = 'localtax1';
@ -3569,6 +3569,7 @@ abstract class CommonObject
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
@ -5296,7 +5297,7 @@ abstract class CommonObject
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
$ecmfile->keywords = ''; // keyword content
$ecmfile->src_object_type = $this->table_element;
$ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module);
$ecmfile->src_object_id = $this->id;
$result = $ecmfile->create($user);
@ -9134,6 +9135,11 @@ abstract class CommonObject
*/
public function setCategoriesCommon($categories, $type_categ = '', $remove_existing = true)
{
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
dol_syslog(get_class($this)."::setCategoriesCommon Oject Id:".$this->id.' type_categ:'.$type_categ.' nb tag add:'.count($categories), LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@ -9143,11 +9149,6 @@ abstract class CommonObject
return -1;
}
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
$c = new Categorie($this->db);
$existing = $c->containing($this->id, $type_categ, 'id');

View File

@ -2047,9 +2047,9 @@ class ExtraFields
*
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param object $object Object
* @param string $onlykey Only some keys are filled:$this
* @param string $onlykey Only some keys are filled:
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
* '@GETPOSTISSET' => When we make update of extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')

View File

@ -1675,11 +1675,6 @@ class Form
if ($resql) {
$num = $this->db->num_rows($resql);
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
}
if ($htmlname != 'none' && !$options_only) {
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
}
@ -1810,6 +1805,11 @@ class Form
$out .= '</select>';
}
if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
}
$this->num = $num;
return $out;
} else {
@ -8529,8 +8529,8 @@ class Form
public function showFilterButtons()
{
$out = '<div class="nowraponall">';
$out .= '<button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$out .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$out .= '<button type="submit" class="liste_titre button_search reposition" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$out .= '<button type="submit" class="liste_titre button_removefilter reposition" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$out .= '</div>';
return $out;

View File

@ -136,6 +136,7 @@ class FormFile
$out .= '<input type="hidden" id="'.$htmlname.'_section_id" name="section_id" value="'.$sectionid.'">'."\n";
$out .= '<input type="hidden" name="sortfield" value="'.GETPOST('sortfield', 'aZ09comma').'">'."\n";
$out .= '<input type="hidden" name="sortorder" value="'.GETPOST('sortorder', 'aZ09comma').'">'."\n";
$out .= '<input type="hidden" name="page_y" value="">'."\n";
}
$out .= '<table class="nobordernopadding centpercent">';
@ -215,13 +216,13 @@ class FormFile
$langs->load('link');
$out .= '<span class="nowraponsmartphone"><input style="margin-right: 2px;" type="checkbox" id="overwritefile" name="overwritefile" value="1"><label for="overwritefile">'.$langs->trans("OverwriteIfExists").'</label></span>';
}
$out .= '<input type="submit" class="button reposition" name="sendit" value="'.$langs->trans("Upload").'"';
$out .= '<input type="submit" class="button small reposition" name="sendit" value="'.$langs->trans("Upload").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>';
if ($addcancel) {
$out .= ' &nbsp; ';
$out .= '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
$out .= '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
}
if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
@ -275,6 +276,7 @@ class FormFile
$out .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
$out .= '<input type="hidden" name="page_y" value="">'."\n";
}
$out .= '<div class="valignmiddle">';
@ -293,7 +295,7 @@ class FormFile
$out .= '<input type="hidden" name="objectid" value="'.$object->id.'">';
$out .= '</div>';
$out .= '<div class="inline-block" style="padding-right: 10px;">';
$out .= '<input type="submit" class="button" name="linkit" value="'.$langs->trans("ToLink").'"';
$out .= '<input type="submit" class="button small reposition" name="linkit" value="'.$langs->trans("ToLink").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
$out .= '>';
$out .= '</div>';
@ -1672,7 +1674,8 @@ class FormFile
dol_include_once($hookmanager->resArray['classpath']);
if (array_key_exists('classname', $hookmanager->resArray) && !empty($hookmanager->resArray['classname'])) {
if (class_exists($hookmanager->resArray['classname'])) {
$object_instance = new ${$hookmanager->resArray['classname']}($this->db);
$tmpclassname = $hookmanager->resArray['classname'];
$object_instance = new $tmpclassname($this->db);
}
}
}
@ -1811,9 +1814,11 @@ class FormFile
print '</td>';
// File
// Check if document source has external module part, if it the case use it for module part on document.php
preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix);
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.(empty($modulesuffix) ? $modulepart : $modulesuffix[1]);
if ($forcedownload) {
print '&attachment=1';
}
@ -1824,7 +1829,7 @@ class FormFile
//print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print $this->showPreview($file, $modulepart, $file['relativename']);
print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']);
print "</td>\n";

View File

@ -240,7 +240,7 @@ class RssParser
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
//print 'xx'.LIBXML_NOCDATA;
libxml_use_internal_errors(false);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA);
} else {
if (!function_exists('xml_parser_create')) {
$this->error = 'Function xml_parser_create are not supported by your PHP';

View File

@ -177,6 +177,14 @@ interface Database
*/
public function escape($stringtoencode);
/**
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
*/
public function escapeunderscore($stringtoencode);
/**
* Sanitize a string for SQL forging
*

View File

@ -430,6 +430,17 @@ class DoliDBMysqli extends DoliDB
return $this->db->real_escape_string($stringtoencode);
}
/**
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
*/
public function escapeunderscore($stringtoencode)
{
return str_replace('_', '\_', $stringtoencode);
}
/**
* Return generic error code of last operation.
*

View File

@ -700,6 +700,17 @@ class DoliDBPgsql extends DoliDB
return pg_escape_string($stringtoencode);
}
/**
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
*/
public function escapeunderscore($stringtoencode)
{
return str_replace('_', '\_', $stringtoencode);
}
/**
* Format a SQL IF
*

View File

@ -635,6 +635,17 @@ class DoliDBSqlite3 extends DoliDB
return Sqlite3::escapeString($stringtoencode);
}
/**
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
*/
public function escapeunderscore($stringtoencode)
{
return str_replace('_', '\_', $stringtoencode);
}
/**
* Renvoie le code erreur generique de l'operation precedente.
*

View File

@ -2487,7 +2487,7 @@ function dol_getdate($timestamp, $fast = false, $forcetimezone = '')
* False or 0 or 'tzserver' = local to server TZ
* 'auto'
* 'tzuser' = local to user TZ taking dst into account at the current date. Not yet implemented.
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user.
* 'tzuserrel' = local to user TZ taking dst into account at the given date. Use this one to convert date input from user into a GMT date.
* 'tz,TimeZone' = use specified timezone
* @param int $check 0=No check on parameters (Can use day 32, etc...)
* @return int|string Date as a timestamp, '' or false if error
@ -3704,7 +3704,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account',
'bank_account'=>'bg-infobox-bank_account',
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
'conferenceorbooth'=>'infobox-project',
'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project',
'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'collab'=>'infobox-action', 'conversation'=>'infobox-contrat',
'donation'=>'infobox-commande', 'dolly'=>'infobox-commande', 'dollyrevert'=>'flip infobox-order_supplier',
'ecm'=>'infobox-action', 'eventorganization'=>'infobox-project',
@ -6944,7 +6944,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = 'Security key for payment on a member subscription (one key per member)';
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order';
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice';
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service';
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a service of a contract';
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal';
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order';

View File

@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '')
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) {
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->stock->enabled)) {
$nbElements = 0;
// Enable caching of thirdrparty count Contacts
$cachekey = 'count_elements_project_'.$project->id;
@ -134,6 +134,9 @@ function project_prepare_head(Project $project, $moreparam = '')
if (!is_null($dataretrieved)) {
$nbElements = $dataretrieved;
} else {
if (!empty($conf->stock->enabled)) {
$nbElements += $project->getElementCount('stock', 'entrepot', 'fk_project');
}
if (!empty($conf->propal->enabled)) {
$nbElements += $project->getElementCount('propal', 'propal');
}
@ -974,6 +977,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
// Computed progress
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress_calculated']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned) {
@ -981,6 +985,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
print '</td>';
}
// Declared progress
if (count($arrayfields) > 0 && !empty($arrayfields['t.progress']['checked'])) {
print '<td class="nowrap liste_total right">';
if ($total_projectlinesa_planned) {

View File

@ -866,11 +866,11 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= " AND (";
$searchalgo = '';
if (preg_match('/meta/', $algo)) {
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escape($searchstring)."%' OR wp.description LIKE '%".$db->escape($searchstring)."%'";
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escape($searchstring).",%' OR wp.keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.title LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%' OR wp.description LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.keywords LIKE '".$db->escapeunderscore($db->escape($searchstring)).",%' OR wp.keywords LIKE '% ".$db->escapeunderscore($db->escape($searchstring))."%'"; // TODO Use a better way to scan keywords
}
if (preg_match('/content/', $algo)) {
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escape($searchstring)."%'";
$searchalgo .= ($searchalgo ? ' OR ' : '')."wp.content LIKE '%".$db->escapeunderscore($db->escape($searchstring))."%'";
}
$sql .= $searchalgo;
if (is_array($otherfilters) && !empty($otherfilters['category'])) {
@ -879,6 +879,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
$sql .= ")";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($max);
//print $sql;
$resql = $db->query($sql);
if ($resql) {

View File

@ -175,10 +175,11 @@ class pdf_standard extends ModeleExpenseReport
//$this->posxdate=88;
//$this->posxtype=107;
//$this->posxprojet=120;
$this->posxtva = 130;
$this->posxup = 145;
$this->posxqty = 168;
$this->postotalttc = 178;
$this->posxtva = 112;
$this->posxup = 127;
$this->posxqty = 150;
$this->postotalht = 160;
$this->postotalttc = 180;
// if (empty($conf->projet->enabled)) {
// $this->posxtva-=20;
// $this->posxup-=20;
@ -642,11 +643,15 @@ class pdf_standard extends ModeleExpenseReport
// Quantity
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
$pdf->MultiCell($this->postotalht - $this->posxqty - 0.8, 4, $object->lines[$linenumber]->qty, 0, 'R');
// Total without taxes
$pdf->SetXY($this->postotalht, $curY);
$pdf->MultiCell($this->postotalttc - $this->postotalht - 0.8, 4, price($object->lines[$linenumber]->total_ht), 0, 'R');
// Total with all taxes
$pdf->SetXY($this->postotalttc - 1, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 4, price($object->lines[$linenumber]->total_ttc), 0, 'R');
// Comments
$pdf->SetXY($this->posxcomment, $curY);
@ -950,14 +955,14 @@ class pdf_standard extends ModeleExpenseReport
// Accountancy piece
if (empty($hidetop)) {
$pdf->SetXY($this->posxpiece - 1, $tab_top + 1);
$pdf->MultiCell($this->posxcomment - $this->posxpiece - 1, 1, '', '', 'R');
$pdf->MultiCell($this->posxcomment - $this->posxpiece - 0.8, 1, '', '', 'R');
}
// Comments
$pdf->line($this->posxcomment - 1, $tab_top, $this->posxcomment - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxcomment - 1, $tab_top + 1);
$pdf->MultiCell($this->posxdate - $this->posxcomment - 1, 1, $outputlangs->transnoentities("Description"), '', 'L');
$pdf->MultiCell($this->posxdate - $this->posxcomment - 0.8, 1, $outputlangs->transnoentities("Description"), '', 'L');
}
// Date
@ -990,7 +995,7 @@ class pdf_standard extends ModeleExpenseReport
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxtva - 1, $tab_top + 1);
$pdf->SetXY($this->posxtva - 0.8, $tab_top + 1);
$pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
}
}
@ -998,22 +1003,29 @@ class pdf_standard extends ModeleExpenseReport
// Unit price
$pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxup - 1, $tab_top + 1);
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C');
$pdf->SetXY($this->posxup - 0.8, $tab_top + 1);
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUTTC"), '', 'C');
}
// Quantity
$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxqty - 1, $tab_top + 1);
$pdf->MultiCell($this->postotalttc - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
$pdf->SetXY($this->posxqty - 0.8, $tab_top + 1);
$pdf->MultiCell($this->postotalht - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
}
// Total without taxes
$pdf->line($this->postotalht - 1, $tab_top, $this->postotalht - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->postotalht - 0.8, $tab_top + 1);
$pdf->MultiCell($this->postotalttc - $this->postotalht + 1, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
}
// Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->postotalttc - 1, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
$pdf->SetXY($this->postotalttc - 0.8, $tab_top + 1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc + 1, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
}
$pdf->SetTextColor(0, 0, 0);

View File

@ -281,6 +281,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->export_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
$this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
}
// Add multicompany field
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
@ -317,7 +320,8 @@ class modSociete extends DolibarrModules
'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text',
's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text',
'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text',
's.entity'=>'Numeric', 's.price_level'=>'Numeric'
's.entity'=>'Numeric', 's.price_level'=>'Numeric',
's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text'
);
$this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto
@ -488,6 +492,9 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
$this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
}
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -621,7 +628,9 @@ class modSociete extends DolibarrModules
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"',
's.accountancy_code_sell' => '707',
's.accountancy_code_buy' => '607',
);
$this->import_updatekeys_array[$r] = array(
's.nom' => 'Name',

View File

@ -135,19 +135,19 @@ if ($permission) {
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="external" />
<input type="hidden" name="page_y" value="" />
<?php if (!empty($withproject)) {
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
} ?>
<div class="tagtd nowrap maxwidthonsmartphone noborderbottom">
<div class="tagtd nowrap noborderbottom">
<?php
$selectedCompany = GETPOSTISSET("newcompany") ? GETPOST("newcompany", 'int') : (empty($object->socid) ? 0 : $object->socid);
$selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
</div>
<!-- <div class="tagtd nowrap noborderbottom"><?php echo img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>-->
<div class="tagtd maxwidthonsmartphone noborderbottom">
<div class="tagtd noborderbottom minwidth500imp">
<?php
print img_object('', 'contact', 'class="pictofixedwidth"').$form->selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
print img_object('', 'contact', 'class="pictofixedwidth"').$form->selectcontacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth400');
$nbofcontacts = $form->num;
$newcardbutton = '';
@ -157,7 +157,7 @@ if ($permission) {
print $newcardbutton;
?>
</div>
<div class="tagtd maxwidthonsmartphone noborderbottom">
<div class="tagtd noborderbottom">
<?php
$tmpobject = $object;
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {

View File

@ -346,7 +346,7 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
$resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
}
if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') {
$xml = simplexml_load_string($resgetcommitstrip['content']);
$xml = simplexml_load_string($resgetcommitstrip['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
$little = $xml->channel->item[0]->children('content', true);
print preg_replace('/width="650" height="658"/', '', $little->encoded);
}

View File

@ -101,8 +101,11 @@ class InterfaceEventOrganization extends DolibarrTriggers
$defaultref = '';
}
$task->ref = $defaultref;
$task->date_start = $object->date_start;
$task->date_end = $object->date_end;
// TODO Can set offset for start date or endline from setup of task to create when creating event
$task->date_start = null;
$task->date_end = null;
$result = $task->create($user);
if ($result < 0) {
$this->errors=array_merge($this->errors, $task->errors);

View File

@ -78,7 +78,11 @@ class InterfaceContactRoles extends DolibarrTriggers
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$contactdefault = new Contact($this->db);
$contactdefault->socid = $socid;
$TContact = $contactdefault->getContactRoles($object->element);
$TContact = array();
if (method_exists($contactdefault, 'getContactRoles')) { // For backward compatibility
$TContact = $contactdefault->getContactRoles($object->element);
}
if (is_array($TContact) && !empty($TContact)) {
$TContactAlreadyLinked = array();

View File

@ -250,6 +250,17 @@ class TraceableDB extends DoliDB
return $this->db->escape($stringtoencode);
}
/**
* Escape a string to insert data
*
* @param string $stringtoencode String to escape
* @return string String escaped
*/
public function escapeunderscore($stringtoencode)
{
return $this->db->escapeunderscore($stringtoencode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT

View File

@ -42,6 +42,7 @@ if (!$section) {
$section = 0;
}
$section_dir = GETPOST('section_dir', 'alpha');
$overwritefile = GETPOST('overwritefile', 'int');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -120,7 +121,7 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC))
if (!$error) {
$generatethumbs = 0;
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs);
$res = dol_add_file_process($upload_dir, $overwritefile, 1, 'userfile', '', null, '', $generatethumbs);
if ($res > 0) {
$result = $ecmdir->changeNbOfFiles('+');
}

View File

@ -956,7 +956,7 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start for id=".$this->id, LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda"));
$langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda", "commercial"));
$error = 0;
$this->output = '';

View File

@ -248,9 +248,9 @@ class ConferenceOrBoothAttendee extends CommonObject
}
$result = $this->createCommon($user, $notrigger);
if ($result>0) {
$result =$this->fetch($result);
if ($result>0) {
if ($result > 0) {
$result = $this->fetch($result);
if ($result > 0) {
$this->ref = $this->id;
$result = $this->update($user);
}
@ -293,7 +293,7 @@ class ConferenceOrBoothAttendee extends CommonObject
// Clear fields
if (property_exists($object, 'ref')) {
$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
$object->ref = empty($this->fields['ref']['default']) ? "(PROV)" : $this->fields['ref']['default'];
}
if (property_exists($object, 'label')) {
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
@ -327,6 +327,9 @@ class ConferenceOrBoothAttendee extends CommonObject
$error++;
$this->error = $object->error;
$this->errors = $object->errors;
} else {
$object->ref = $object->id;
$result = $object->update($user);
}
if (!$error) {

View File

@ -41,7 +41,7 @@ global $dolibarr_main_url_root;
//dol_include_once('/othermodule/class/otherobject.class.php');
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other", "projects"));
$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -643,6 +643,7 @@ print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="page_y" value="">';
$title = $langs->trans("ListOfConferencesOrBooths");

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "other"));
$langs->loadLangs(array("eventorganization", "other", "projects", "companies"));
// Get parameters
$id = GETPOST('id', 'int');
@ -110,6 +110,7 @@ $permissionnote = $user->rights->eventorganization->write; // Used by the includ
$permissiondellink = $user->rights->eventorganization->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1];
/*
* Actions
*/
@ -134,7 +135,7 @@ if (empty($reshook)) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?id='.($id > 0 ? $id : '__ID__');
$backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__');
}
}
}
@ -205,13 +206,12 @@ if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
$withProjectUrl='';
$object->project = clone $projectstatic;
if (!empty($withproject)) {
// Tabs for project
$tab = 'eventorganisation';
$withProjectUrl = "&withproject=1";
$head = project_prepare_head($projectstatic);
print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', '');
@ -421,8 +421,10 @@ if (!empty($withproject)) {
if ($action == 'create') {
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].(!empty($withProjectUrl)?'?'.$withProjectUrl:'').'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].(empty($withproject) ? '' : '?withproject=1').'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
if ($confOrBooth->id > 0) {
print '<input type="hidden" name="conforboothid" value="'.$confOrBooth->id.'">';
@ -432,8 +434,6 @@ if ($action == 'create') {
print '<input type="hidden" name="projectid" value="'.$projectstatic->id.'">';
}
print '<input type="hidden" name="action" value="add">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}

View File

@ -697,6 +697,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
print '<input type="hidden" name="page_y" value="">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);

View File

@ -220,7 +220,7 @@ if (empty($reshook)) {
$object->fk_user_author = $user->id;
}
// Check that expense report is for a user inside the hierarchy or advanced permission for all is set
// Check that expense report is for a user inside the hierarchy, or that advanced permission for all is set
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) {
$error++;
@ -1095,7 +1095,7 @@ if (empty($reshook)) {
$action = '';
}
if ((int) $tmpvat < 0 || $tmpvat == '') {
if ((float) $tmpvat < 0 || $tmpvat === '') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
$action = '';
@ -1190,7 +1190,6 @@ if (empty($reshook)) {
}
}
$object->update_totaux_del($object_ligne->total_ht, $object_ligne->total_tva);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
exit;
} else {
@ -1240,7 +1239,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action = '';
}
if ((int) $tmpvat < 0 || $tmpvat == '') {
if ((float) $tmpvat < 0 || $tmpvat == '') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
$action = '';
@ -1277,8 +1276,6 @@ if (empty($reshook)) {
}
}
$result = $object->recalculer($id);
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
//exit;
} else {
@ -1441,8 +1438,6 @@ if ($action == 'create') {
} elseif ($id > 0 || $ref) {
$result = $object->fetch($id, $ref);
$res = $object->fetch_optionals();
if ($result > 0) {
if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) {
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
@ -1843,12 +1838,22 @@ if ($action == 'create') {
print '<tr>';
print '<td>'.$langs->trans("AmountVAT").'</td>';
print '<td class="nowrap amountcard">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
print '<td class="nowrap amountcard">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td>';
print '</tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td class="valuefield">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
}
print '<tr>';
print '<td>'.$langs->trans("AmountTTC").'</td>';
print '<td class="nowrap amountcard">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
print '<td class="nowrap amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td>';
print '</tr>';
// List of payments already done
@ -2053,7 +2058,7 @@ if ($action == 'create') {
// Comment
print '<td class="left">'.dol_nl2br($line->comments).'</td>';
// VAT rate
print '<td class="right">'.vatrate($line->vatrate, true).'</td>';
print '<td class="right">'.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).'</td>';
// Unit price HT
print '<td class="right">';
if (!empty($line->value_unit_ht)) {
@ -2260,8 +2265,9 @@ if ($action == 'create') {
print '</td>';
// VAT
$selectedvat = price2num($line->vatrate).($line->vat_src_code ? ' ('.$line->vat_src_code.')' : '');
print '<td class="right">';
print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1);
print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1);
print '</td>';
// Unit price

View File

@ -80,8 +80,6 @@ class ExpenseReport extends CommonObject
*/
public $fk_statut;
public $vat_src_code;
public $fk_c_paiement;
public $paid;
@ -124,6 +122,9 @@ class ExpenseReport extends CommonObject
// Paiement
public $user_paid_infos;
public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject)
public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject)
/**
* Draft status
@ -213,6 +214,10 @@ class ExpenseReport extends CommonObject
$this->total_ht = 0;
$this->total_ttc = 0;
$this->total_tva = 0;
$this->total_localtax1 = 0;
$this->total_localtax2 = 0;
$this->localtax1 = 0; // For backward compatibility
$this->localtax2 = 0; // For backward compatibility
$this->modepaymentid = 0;
// List of language codes for status
@ -314,12 +319,18 @@ class ExpenseReport extends CommonObject
$newndfline->fk_project = $line->fk_project;
$newndfline->vatrate = $line->vatrate;
$newndfline->vat_src_code = $line->vat_src_code;
$newndfline->localtax1_tx = $line->localtax1_tx;
$newndfline->localtax2_tx = $line->localtax2_tx;
$newndfline->localtax1_type = $line->localtax1_type;
$newndfline->localtax2_type = $line->localtax2_type;
$newndfline->comments = $line->comments;
$newndfline->qty = $line->qty;
$newndfline->value_unit = $line->value_unit;
$newndfline->total_ht = $line->total_ht;
$newndfline->total_ttc = $line->total_ttc;
$newndfline->total_tva = $line->total_tva;
$newndfline->total_localtax1 = $line->total_localtax1;
$newndfline->total_localtax2 = $line->total_localtax2;
$newndfline->date = $line->date;
$newndfline->rule_warning_message = $line->rule_warning_message;
$newndfline->fk_c_exp_tax_cat = $line->fk_c_exp_tax_cat;
@ -539,7 +550,8 @@ class ExpenseReport extends CommonObject
$sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT
$sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
$sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS
$sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
$sql .= " d.total_ht, d.total_ttc, d.total_tva,";
$sql .= " d.localtax1 as total_localtax1, d.localtax2 as total_localtax2,";
$sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,"; // DATES (datetime)
$sql .= " d.fk_user_creat, d.fk_user_author, d.fk_user_modif, d.fk_user_validator,";
$sql .= " d.fk_user_valid, d.fk_user_approve,";
@ -565,6 +577,11 @@ class ExpenseReport extends CommonObject
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
$this->total_ttc = $obj->total_ttc;
$this->localtax1 = $obj->total_localtax1; // For backward compatibility
$this->localtax2 = $obj->total_localtax2; // For backward compatibility
$this->total_localtax1 = $obj->total_localtax1;
$this->total_localtax2 = $obj->total_localtax2;
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->detail_refuse = $obj->detail_refuse;
@ -962,54 +979,6 @@ class ExpenseReport extends CommonObject
}
}
/**
* recalculer
* TODO Replace this with call to update_price if not already done
*
* @param int $id Id of expense report
* @return int <0 if KO, >0 if OK
*/
public function recalculer($id)
{
$sql = 'SELECT tt.total_ht, tt.total_ttc, tt.total_tva';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as tt';
$sql .= ' WHERE tt.'.$this->fk_element.' = '.((int) $id);
$total_ht = 0; $total_tva = 0; $total_ttc = 0;
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$total_ht += $objp->total_ht;
$total_tva += $objp->total_tva;
$i++;
}
$total_ttc = $total_ht + $total_tva;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql .= " total_ht = ".price2num($total_ht, 'MT');
$sql .= " , total_ttc = ".price2num($total_ttc, 'MT');
$sql .= " , total_tva = ".price2num($total_tva, 'MT');
$sql .= " WHERE rowid = ".((int) $id);
$result = $this->db->query($sql);
if ($result) {
$this->db->free($result);
return 1;
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
return -3;
}
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR);
return -3;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* fetch_lines
@ -1024,14 +993,18 @@ class ExpenseReport extends CommonObject
$this->lines = array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,';
$sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project, de.tva_tx, de.fk_ecm_files,';
$sql .= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_c_exp_tax_cat, de.fk_projet as fk_project,';
$sql .= ' de.tva_tx, de.vat_src_code,';
$sql .= ' de.localtax1_tx, de.localtax2_tx, de.localtax1_type, de.localtax2_type,';
$sql .= ' de.fk_ecm_files,';
$sql .= ' de.total_ht, de.total_tva, de.total_ttc,';
$sql .= ' de.total_localtax1, de.total_localtax2,';
$sql .= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql .= ' p.ref as ref_projet, p.title as title_projet';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as de';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON de.fk_c_type_fees = ctf.id';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON de.fk_projet = p.rowid';
$sql .= ' WHERE de.'.$this->fk_element.' = '.$this->id;
$sql .= ' WHERE de.'.$this->fk_element.' = '.((int) $this->id);
if (!empty($conf->global->EXPENSEREPORT_LINES_SORTED_BY_ROWID)) {
$sql .= ' ORDER BY de.rang ASC, de.rowid ASC';
} else {
@ -1065,11 +1038,20 @@ class ExpenseReport extends CommonObject
$deplig->total_ht = $objp->total_ht;
$deplig->total_tva = $objp->total_tva;
$deplig->total_ttc = $objp->total_ttc;
$deplig->total_localtax1 = $objp->total_localtax1;
$deplig->total_localtax2 = $objp->total_localtax2;
$deplig->type_fees_code = empty($objp->code_type_fees) ? 'TF_OTHER' : $objp->code_type_fees;
$deplig->type_fees_libelle = $objp->libelle_type_fees;
$deplig->tva_tx = $objp->tva_tx;
$deplig->tva_tx = $objp->tva_tx;
$deplig->vatrate = $objp->tva_tx;
$deplig->vat_src_code = $objp->vat_src_code;
$deplig->localtax1_tx = $objp->localtax1_tx;
$deplig->localtax2_tx = $objp->localtax2_tx;
$deplig->localtax1_type = $objp->localtax1_type;
$deplig->localtax2_type = $objp->localtax2_type;
$deplig->projet_ref = $objp->ref_projet;
$deplig->projet_title = $objp->title_projet;
@ -1757,41 +1739,12 @@ class ExpenseReport extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update total of an expense report when you delete a line.
*
* @param string $ligne_total_ht Amount without taxes
* @param string $ligne_total_tva Amount of all taxes
* @return void
*/
public function update_totaux_del($ligne_total_ht, $ligne_total_tva)
{
// phpcs:enable
$this->total_ht = $this->total_ht - $ligne_total_ht;
$this->total_tva = $this->total_tva - $ligne_total_tva;
$this->total_ttc = $this->total_ht + $this->total_tva;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql .= " total_ht = ".$this->total_ht;
$sql .= " , total_ttc = ".$this->total_ttc;
$sql .= " , total_tva = ".$this->total_tva;
$sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql);
if ($result) {
return 1;
} else {
$this->error = $this->db->error();
return -1;
}
}
/**
* addline
*
* @param float $qty Qty
* @param double $up Value init
* @param double $up Unit price (price with tax)
* @param int $fk_c_type_fees Type payment
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
* @param string $date Date
@ -1838,7 +1791,14 @@ class ExpenseReport extends CommonObject
$this->line = new ExpenseReportLine($this->db);
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
// We don't know seller and buyer for expense reports
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
$seller->tva_assuj = 1; // Most seller uses vat
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$buyer = new Societe($this->db);
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
$vat_src_code = '';
$reg = array();
@ -1848,16 +1808,22 @@ class ExpenseReport extends CommonObject
}
$vatrate = preg_replace('/\*/', '', $vatrate);
$seller = ''; // seller is unknown
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$tmp = calcul_price_total($qty, $up, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$this->line->value_unit = $up;
$this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate);
$this->line->localtax1_tx = $localtaxes_type[1];
$this->line->localtax2_tx = $localtaxes_type[3];
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
$this->line->total_localtax1 = $tmp[9];
$this->line->total_localtax2 = $tmp[10];
$this->line->fk_expensereport = $this->id;
$this->line->qty = $qty;
@ -1899,13 +1865,13 @@ class ExpenseReport extends CommonObject
/**
* Check constraint of rules and update price if needed
*
* @param int $type type of line
* @param string $seller seller, but actually he is unknown
* @return true or false
* @param int $type Type of line
* @param string $seller Seller, but actually he is unknown
* @return true or false
*/
public function checkRules($type = 0, $seller = '')
{
global $user, $conf, $db, $langs;
global $user, $conf, $db, $langs, $mysoc;
$langs->load('trips');
@ -1913,6 +1879,15 @@ class ExpenseReport extends CommonObject
return true; // if don't use rules
}
// We don't know seller and buyer for expense reports
if (!is_object($seller)) {
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
$seller->tva_assuj = 1; // Most seller uses vat
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
}
//$buyer = new Societe($this->db);
$rulestocheck = ExpenseReportRule::getAllRule($this->line->fk_c_type_fees, $this->line->date, $this->fk_user_author);
$violation = 0;
@ -1960,6 +1935,8 @@ class ExpenseReport extends CommonObject
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
$this->line->total_localtax1 = $tmp[9];
$this->line->total_localtax2 = $tmp[10];
return false;
} else {
@ -1970,11 +1947,13 @@ class ExpenseReport extends CommonObject
/**
* Method to apply the offset if needed
*
* @return boolean true=applied, false=not applied
* @param int $type Type of line
* @param string $seller Seller, but actually he is unknown
* @return boolean True=applied, False=not applied
*/
public function applyOffset()
public function applyOffset($type = 0, $seller = '')
{
global $conf;
global $conf, $mysoc;
if (empty($conf->global->MAIN_USE_EXPENSE_IK)) {
return false;
@ -1987,6 +1966,15 @@ class ExpenseReport extends CommonObject
return false;
}
// We don't know seller and buyer for expense reports
if (!is_object($seller)) {
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
$seller->tva_assuj = 1; // Most seller uses vat
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
}
//$buyer = new Societe($this->db);
$range = ExpenseReportIk::getRangeByUser($userauthor, $this->line->fk_c_exp_tax_cat);
if (empty($range)) {
@ -2010,6 +1998,8 @@ class ExpenseReport extends CommonObject
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
$this->line->total_localtax1 = $tmp[9];
$this->line->total_localtax2 = $tmp[10];
return true;
}
@ -2033,7 +2023,7 @@ class ExpenseReport extends CommonObject
$sql .= ' AND d.rowid <> '.$this->line->id;
}
dol_syslog(get_class($this)."::offsetAlreadyGiven sql=".$sql);
dol_syslog(get_class($this)."::offsetAlreadyGiven");
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -2056,7 +2046,7 @@ class ExpenseReport extends CommonObject
* @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)'
* @param string $comments Description
* @param float $qty Qty
* @param double $value_unit Value init
* @param double $value_unit Unit price (with taxes)
* @param int $date Date
* @param int $expensereport_id Expense report id
* @param int $fk_c_exp_tax_cat Id of category of car
@ -2073,7 +2063,10 @@ class ExpenseReport extends CommonObject
$type = 0; // TODO What if type is service ?
// We don't know seller and buyer for expense reports
$seller = $mysoc;
$seller = $mysoc; // We use same than current company (expense report are often done in same country)
$seller->tva_assuj = 1; // Most seller uses vat
$seller->localtax1_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$seller->localtax2_assuj = $mysoc->localtax1_assuj; // We don't know, we reuse the state of company
$buyer = new Societe($this->db);
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $buyer, $seller);
@ -2087,8 +2080,8 @@ class ExpenseReport extends CommonObject
}
$vatrate = preg_replace('/\*/', '', $vatrate);
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$tmp = calcul_price_total($qty, $value_unit, 0, $vatrate, -1, -1, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
//var_dump($vatrate);var_dump($localtaxes_type);var_dump($tmp);exit;
// calcul total of line
//$total_ttc = price2num($qty*$value_unit, 'MT');
@ -2109,14 +2102,17 @@ class ExpenseReport extends CommonObject
$this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate);
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
$this->line->localtax1_tx = $localtaxes_type[1];
$this->line->localtax2_tx = $localtaxes_type[3];
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
$this->line->total_tva = $tmp[1];
$this->line->total_localtax1 = $tmp[9];
$this->line->total_localtax2 = $tmp[10];
$this->line->fk_ecm_files = $fk_ecm_files;
$this->line->id = ((int) $rowid);
@ -2184,6 +2180,8 @@ class ExpenseReport extends CommonObject
return -1;
}
$this->update_price();
$this->db->commit();
return 1;
@ -2593,9 +2591,17 @@ class ExpenseReportLine
public $projet_title;
public $vatrate;
public $vat_src_code;
public $localtax1_tx;
public $localtax2_tx;
public $localtax1_type;
public $localtax2_type;
public $total_ht;
public $total_tva;
public $total_ttc;
public $total_localtax1;
public $total_localtax2;
/**
* @var int ID into llx_ecm_files table to link line to attached file
@ -2623,6 +2629,7 @@ class ExpenseReportLine
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_c_exp_tax_cat, fde.fk_projet as fk_project, fde.date,';
$sql .= ' fde.tva_tx as vatrate, fde.vat_src_code, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc, fde.fk_ecm_files,';
$sql .= ' fde.localtax1_tx, fde.localtax2_tx, fde.localtax1_type, fde.localtax2_type, fde.total_localtax1, fde.total_localtax2,';
$sql .= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql .= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql .= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@ -2652,11 +2659,20 @@ class ExpenseReportLine
$this->type_fees_libelle = $objp->type_fees_libelle;
$this->projet_ref = $objp->projet_ref;
$this->projet_title = $objp->projet_title;
$this->vatrate = $objp->vatrate;
$this->vat_src_code = $objp->vat_src_code;
$this->localtax1_tx = $objp->localtax1_tx;
$this->localtax2_tx = $objp->localtax2_tx;
$this->localtax1_type = $objp->localtax1_type;
$this->localtax2_type = $objp->localtax2_type;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->total_localtax1 = $objp->total_localtax1;
$this->total_localtax2 = $objp->total_localtax2;
$this->fk_ecm_files = $objp->fk_ecm_files;
$this->db->free($result);
@ -2695,18 +2711,29 @@ class ExpenseReportLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql .= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
$sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
$sql .= ' tva_tx, vat_src_code,';
$sql .= ' localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' comments, qty, value_unit,';
$sql .= ' total_ht, total_tva, total_ttc,';
$sql .= ' total_localtax1, total_localtax2,';
$sql .= ' date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
$sql .= " VALUES (".$this->db->escape($this->fk_expensereport).",";
$sql .= " ".((int) $this->fk_c_type_fees).",";
$sql .= " ".((int) (!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).",";
$sql .= " ".((float) $this->vatrate).",";
$sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',";
$sql .= " ".((float) price2num($this->localtax1_tx)).",";
$sql .= " ".((float) price2num($this->localtax2_tx)).",";
$sql .= " '".$this->db->escape($this->localtax1_type)."',";
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " '".$this->db->escape($this->comments)."',";
$sql .= " ".((float) $this->qty).",";
$sql .= " ".((float) $this->value_unit).",";
$sql .= " ".((float) price2num($this->total_ht)).",";
$sql .= " ".((float) price2num($this->total_tva)).",";
$sql .= " ".((float) price2num($this->total_ttc)).",";
$sql .= " ".((float) price2num($this->total_localtax1)).",";
$sql .= " ".((float) price2num($this->total_localtax2)).",";
$sql .= " '".$this->db->idate($this->date)."',";
$sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").",";
$sql .= " ".((int) $this->fk_c_exp_tax_cat).",";
@ -2814,11 +2841,17 @@ class ExpenseReportLine
$sql .= ", value_unit = ".((float) $this->value_unit);
$sql .= ", qty=".((float) $this->qty);
$sql .= ", date='".$this->db->idate($this->date)."'";
$sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'))."";
$sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'))."";
$sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'))."";
$sql .= ", total_ht=".((float) price2num($this->total_ht, 'MT'));
$sql .= ", total_tva=".((float) price2num($this->total_tva, 'MT'));
$sql .= ", total_ttc=".((float) price2num($this->total_ttc, 'MT'));
$sql .= ", total_localtax1=".((float) price2num($this->total_localtax1, 'MT'));
$sql .= ", total_localtax2=".((float) price2num($this->total_localtax2, 'MT'));
$sql .= ", tva_tx=".((float) $this->vatrate);
$sql .= ", vat_src_code='".$this->db->escape($this->vat_src_code)."'";
$sql .= ", localtax1_tx=".((float) $this->localtax1_tx);
$sql .= ", localtax2_tx=".((float) $this->localtax2_tx);
$sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
$sql .= ", rule_warning_message='".$this->db->escape($this->rule_warning_message)."'";
$sql .= ", fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat);
$sql .= ", fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null');

View File

@ -846,7 +846,7 @@ class ProductFournisseur extends Product
$this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $record["unitprice"];
$this->fourn_unitprice = $fourn_unitprice;
$this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"];
$this->fourn_id = $record["fourn_id"];

View File

@ -408,9 +408,9 @@ if (empty($reshook)) {
dol_print_error($db);
}
} elseif ($action == 'setdatef' && $usercancreate) {
$newdate = dol_mktime(0, 0, 0, $_POST['datefmonth'], $_POST['datefday'], $_POST['datefyear']);
if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE) ? 0 : $conf->global->INVOICE_MAX_OFFSET_IN_FUTURE))) {
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) {
$newdate = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int'), 'tzserver');
if ($newdate > (dol_now('tzuserrel') + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
if (empty($conf->global->INVOICE_MAX_FUTURE_DELAY)) {
setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
} else {
setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
@ -434,7 +434,7 @@ if (empty($reshook)) {
}
} elseif ($action == 'setdate_lim_reglement' && $usercancreate) {
$object->fetch($id);
$object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
$object->date_echeance = dol_mktime(12, 0, 0, GETPOST('date_lim_reglementmonth', 'int'), GETPOST('date_lim_reglementday', 'int'), GETPOST('date_lim_reglementyear', 'int'));
if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
$object->date_echeance = $object->date;
setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
@ -692,8 +692,12 @@ if (empty($reshook)) {
$error++;
}
$dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$datedue = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
$datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver');
/*var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
var_dump($db->idate($dateinvoice));
exit;*/
// Replacement invoice
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
@ -702,7 +706,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@ -766,7 +770,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';
@ -875,7 +879,7 @@ if (empty($reshook)) {
$action = 'create';
$_GET['socid'] = $_POST['socid'];
$error++;
} elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
} elseif ($dateinvoice > (dol_get_last_hour(dol_now('tzuserrel')) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) {
$error++;
setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors');
$action = 'create';

View File

@ -441,7 +441,7 @@ $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (!empty($search_categ_sup)) {
if (!empty($search_categ_sup) && $search_categ_supplier != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
}

View File

@ -358,7 +358,7 @@ if (count($typeleaves) == 0) {
//var_dump($users['rowid'].' - '.$val['rowid']);
print '<td style="text-align:center">';
if ($canedit) {
print '<input type="text"'.($canedit ? '' : ' disabled="disabled"').' value="'.$nbtoshow.'" name="nb_holiday_'.$val['rowid'].'['.$users['rowid'].']" size="5" style="text-align: center;"/>';
print '<input type="text"'.($canedit ? '' : ' disabled="disabled"').' value="'.$nbtoshow.'" name="nb_holiday_'.$val['rowid'].'['.$users['rowid'].']" class="width75 center" />';
} else {
print $nbtoshow;
}

View File

@ -336,6 +336,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
),
'supplier_proposal' =>
array(
'lang' => 'supplier_proposal',
'groupName' => 'SupplierProposals',
'globalStatsKey' => 'askprice',
'stats' =>
@ -485,6 +486,9 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
if (!empty($boards)) {
if (!empty($groupElement['lang'])) {
$langs->load($groupElement['lang']);
}
$groupName = $langs->trans($groupElement['groupName']);
$groupKeyLowerCase = strtolower($groupKey);
$nbTotalForGroup = 0;

View File

@ -425,14 +425,22 @@ CREATE TABLE llx_eventorganization_conferenceorboothattendee(
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_project integer NOT NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN fk_invoice integer NULL;
ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_soc;
ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_actioncomm;
ALTER TABLE llx_eventorganization_conferenceorboothattendee DROP FOREIGN KEY fx_eventorganization_conferenceorboothattendee_fk_project;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_actioncomm, email);
-- VMYSQL4.1 DROP INDEX uk_eventorganization_conferenceorboothattendee on llx_eventorganization_conferenceorboothattendee;
-- VPGSQL8.2 DROP INDEX uk_eventorganization_conferenceorboothattendee;
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);
create table llx_eventorganization_conferenceorboothattendee_extrafields
(

View File

@ -18,15 +18,11 @@
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_rowid (rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_ref (ref);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_soc (fk_soc);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_actioncomm (fk_actioncomm);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm(id);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_fk_project (fk_project);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD CONSTRAINT fx_eventorganization_conferenceorboothattendee_fk_project FOREIGN KEY (fk_project) REFERENCES llx_projet(rowid);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_email (email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD INDEX idx_eventorganization_conferenceorboothattendee_status (status);
-- END MODULEBUILDER INDEXES
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_soc, fk_project, fk_actioncomm, email);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD UNIQUE INDEX uk_eventorganization_conferenceorboothattendee(fk_project, email, fk_actioncomm);

View File

@ -144,11 +144,6 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('upgrade'));
if (!$db->connected) {
print '<tr><td colspan="4">'.$langs->trans("ErrorFailedToConnectToDatabase", $conf->db->name).'</td><td class="right">'.$langs->trans('Error').'</td></tr>';
dolibarr_install_syslog('upgrade2: failed to connect to database :'.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR);
@ -182,6 +177,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
}
// Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('upgrade'));
/***************************************************************************************
*

View File

@ -37,8 +37,8 @@ OtherInfo=Other information
DeleteCptCategory=Remove accounting account from group
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group?
JournalizationInLedgerStatus=Status of journalization
AlreadyInGeneralLedger=Already transferred in accounting journals and ledger
NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger
AlreadyInGeneralLedger=Already transferred to accounting journals and ledger
NotYetInGeneralLedger=Not yet transferred to accouting journals and ledger
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
DetailByAccount=Show detail by account
AccountWithNonZeroValues=Accounts with non-zero values
@ -298,7 +298,7 @@ NoNewRecordSaved=No more record to journalize
ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account
ChangeBinding=Change the binding
Accounted=Accounted in ledger
NotYetAccounted=Not yet accounted in the ledger
NotYetAccounted=Not yet transferred to accounting
ShowTutorial=Show Tutorial
NotReconciled=Not reconciled
WarningRecordWithoutSubledgerAreExcluded=Warning, all operations without subledger account defined are filtered and excluded from this view

View File

@ -131,7 +131,6 @@ IdModule=Module ID
IdPermissions=Permissions ID
LanguageBrowserParameter=Parameter %s
LocalisationDolibarrParameters=Localization parameters
ClientTZ=Client Time Zone (user)
ClientHour=Client time (user)
OSTZ=Server OS Time Zone
PHPTZ=PHP server Time Zone
@ -159,7 +158,7 @@ Purge=Purge
PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in <b>%s</b> directory). Using this feature is not normally necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server.
PurgeDeleteLogFile=Delete log files, including <b>%s</b> defined for Syslog module (no risk of losing data)
PurgeDeleteTemporaryFiles=Delete all log and temporary files (no risk of losing data). Parameter can be 'tempfilesold', 'logfiles' or both 'tempfilesold+logfiles'. Note: Deletion of temporary files is done only if the temp directory was created more than 24 hours ago.
PurgeDeleteTemporaryFilesShort=Delete log and temporary files
PurgeDeleteTemporaryFilesShort=Delete log and temporary files (no risk of losing data)
PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory: <b>%s</b>.<br>This will delete all generated documents related to elements (third parties, invoices etc...), files uploaded into the ECM module, database backup dumps and temporary files.
PurgeRunNow=Purge now
PurgeNothingToDelete=No directory or files to delete.
@ -1921,7 +1920,7 @@ SellTaxRate=Sales tax rate
RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases.
UrlTrackingDesc=If the provider or transport service offers a page or web site to check the status of your shipments, you may enter it here. You can use the key {TRACKID} in the URL parameters so the system will replace it with the tracking number the user entered into the shipment card.
OpportunityPercent=When you create a lead, you will define an estimated amount of project/lead. According to status of the lead, this amount may be multiplied by this rate to evaluate a total amount all your leads may generate. Value is a percentage (between 0 and 100).
TemplateForElement=This template record is dedicated to which element
TemplateForElement=This mail template is related to what type of object? An email template is available only when using the "Send Email" button from the related object.
TypeOfTemplate=Type of template
TemplateIsVisibleByOwnerOnly=Template is visible to owner only
VisibleEverywhere=Visible everywhere

View File

@ -1138,4 +1138,5 @@ InformationOnLinkToContract=This amount is only the total of all the lines of th
ConfirmCancel=Are you sure you want to cancel
EmailMsgID=Email MsgID
Forthcoming=Forthcoming
Currently=Currently
Currently=Currently
ClientTZ=Client Time Zone (user)

View File

@ -251,18 +251,6 @@ if ($action == 'edit') {
}
print '</td></tr>';
// EMail
//If linked user, then emails are going to be sent to users' email
if (!$object->fk_user_creat) {
print '<tr><td>'.$langs->trans("EMail").'</td><td colspan="2">';
if ($action == 'edit') {
print '<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.'">';
} else {
print dol_print_email($object->mail_admin, 0, 0, 1);
}
print '</td></tr>';
}
// Receive an email with each vote
print '<tr><td>'.$langs->trans('ToReceiveEMailForEachVote').'</td><td colspan="2">';
if ($action == 'edit') {
@ -312,10 +300,14 @@ print '</td></tr>';
// Author
print '<tr><td>';
print $langs->trans("Author").'</td><td colspan="2">';
if ($object->fk_user_creat) {
if ($object->fk_user_creat > 0) {
print $userstatic->getLoginUrl(1);
} else {
print dol_htmlentities($object->nom_admin);
if ($action == 'edit') {
print '<input type="text" name="nouvelleadresse" class="minwith200" value="'.$object->mail_admin.'">';
} else {
print dol_print_email($object->mail_admin, 0, 0, 1);
}
}
print '</td></tr>';

View File

@ -170,7 +170,7 @@ if ($_SESSION["mailsonde"]) {
$cochemail = "checked";
}
print '<input type="checkbox" name="mailsonde" '.$cochemail.'> '.$langs->trans("ToReceiveEMailForEachVote").'<br>'."\n";
print '<input type="checkbox" id="mailsonde" name="mailsonde" '.$cochemail.'> <label for="mailsonde">'.$langs->trans("ToReceiveEMailForEachVote").'</label><br>'."\n";
if ($_SESSION['allow_comments']) {
$allow_comments = 'checked';
@ -178,7 +178,7 @@ if ($_SESSION['allow_comments']) {
if (GETPOSTISSET('allow_comments')) {
$allow_comments = GETPOST('allow_comments') ? 'checked' : '';
}
print '<input type="checkbox" name="allow_comments" '.$allow_comments.'"> '.$langs->trans('CanComment').'<br>'."\n";
print '<input type="checkbox" id="allow_comments" name="allow_comments" '.$allow_comments.'"> <label for="allow_comments">'.$langs->trans('CanComment').'</label><br>'."\n";
if ($_SESSION['allow_spy']) {
$allow_spy = 'checked';
@ -186,7 +186,7 @@ if ($_SESSION['allow_spy']) {
if (GETPOSTISSET('allow_spy')) {
$allow_spy = GETPOST('allow_spy') ? 'checked' : '';
}
print '<input type="checkbox" name="allow_spy" '.$allow_spy.'> '.$langs->trans('CanSeeOthersVote').'<br>'."\n";
print '<input type="checkbox" id="allow_spy" name="allow_spy" '.$allow_spy.'> <label for="allow_spy">'.$langs->trans('CanSeeOthersVote').'</label><br>'."\n";
if (GETPOST('choix_sondage')) {
if (GETPOST('choix_sondage') == 'date') {

View File

@ -584,7 +584,7 @@ if (empty($reshook)) {
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
if ($ret < 0) {
$error++;
}

View File

@ -189,7 +189,7 @@ if ($fourn_id > 0) {
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
}
// Insert categ filter
if ($search_categ) {
if ($search_categ > 0) {
$sql .= " AND cp.fk_categorie = ".((int) $search_categ);
}
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";

View File

@ -454,7 +454,7 @@ class Tasks extends DolibarrApi
throw new RestException(404, 'Task not found');
}
if (!DolibarrApi::_checkAccessToResource('tasks', $this->project->id)) {
if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
foreach ($request_data as $field => $value) {
@ -488,7 +488,7 @@ class Tasks extends DolibarrApi
throw new RestException(404, 'Task not found');
}
if (!DolibarrApi::_checkAccessToResource('tasks', $this->project->id)) {
if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@ -813,7 +813,7 @@ class Project extends CommonObject
'propal'=>'fk_projet', 'commande'=>'fk_projet', 'facture'=>'fk_projet',
'supplier_proposal'=>'fk_projet', 'commande_fournisseur'=>'fk_projet', 'facture_fourn'=>'fk_projet',
'expensereport_det'=>'fk_projet', 'contrat'=>'fk_projet', 'fichinter'=>'fk_projet', 'don'=>'fk_projet',
'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project'
'actioncomm'=>'fk_project', 'mrp_mo'=>'fk_project', 'entrepot'=>'fk_project'
);
foreach ($listoftables as $key => $value) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$key." SET ".$value." = NULL where ".$value." = ".((int) $this->id);

View File

@ -173,16 +173,16 @@ class Task extends CommonObject
$sql .= ", planned_workload";
$sql .= ", progress";
$sql .= ") VALUES (";
$sql .= $conf->entity;
$sql .= ", ".$this->fk_project;
$sql .= ((int) $conf->entity);
$sql .= ", ".((int) $this->fk_project);
$sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null');
$sql .= ", ".$this->fk_task_parent;
$sql .= ", ".((int) $this->fk_task_parent);
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->description)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id;
$sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql .= ", ".((int) $user->id);
$sql .= ", ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null');
$sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null');
$sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null');
$sql .= ")";

View File

@ -36,6 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (!empty($conf->stock->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
}
if (!empty($conf->propal->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}

View File

@ -89,6 +89,7 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $c
$title = ($object->ref ? $object->ref.' '.$object->name.' - ' : '').$langs->trans("Gantt");
}
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("", $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss);
if (($id > 0 && is_numeric($id)) || !empty($ref)) {
@ -136,29 +137,36 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) {
print '<table class="border tableforfield centpercent">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
if (!empty($conf->eventorganization->enabled)) {
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td></tr>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) {
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
print '</td></tr>';
// Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';

View File

@ -459,7 +459,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Usage
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) {
@ -532,7 +532,7 @@ if ($id > 0 || !empty($ref)) {
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
@ -541,7 +541,7 @@ if ($id > 0 || !empty($ref)) {
// Categories
if ($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>";
}

View File

@ -992,6 +992,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="tab" value="'.$tab.'">';
print '<input type="hidden" name="page_y" value="">';
// Form to convert time spent into invoice
if ($massaction == 'generateinvoice') {

View File

@ -914,7 +914,7 @@ if ($action == 'create') {
$ent = "entrepot_".$reg[1].'_'.$reg[2];
$pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount
$fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2];
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'));
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' => GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' => GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'));
}
// with batch module enabled
@ -929,13 +929,13 @@ if ($action == 'create') {
$ent = 'entrepot_'.$reg[1].'_'.$reg[2];
$pu = 'pu_'.$reg[1].'_'.$reg[2];
$lot = 'lot_number_'.$reg[1].'_'.$reg[2];
$dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']);
$dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']);
$dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dluo_'.$reg[1].'_'.$reg[2].'year', 'int'));
$dDLC = dol_mktime(12, 0, 0, GETPOST('dlc_'.$reg[1].'_'.$reg[2].'month', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'day', 'int'), GETPOST('dlc_'.$reg[1].'_'.$reg[2].'year', 'int'));
$fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2];
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha'));
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha'));
}
// If create form is coming from same page post was sent but an error occured
// If create form is coming from same page, it means that post was sent but an error occured
if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) {
$numAsked++;
@ -951,7 +951,7 @@ if ($action == 'create') {
$dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int'));
$dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int'));
$fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1];
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha'));
$dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' => price2num(GETPOST($qty), 'MS'), 'ent' =>GETPOST($ent, 'int'), 'pu' => price2num(GETPOST($pu), 'MU'), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha'));
}
}

View File

@ -2575,13 +2575,13 @@ class Societe extends CommonObject
$label .= ' '.$this->getLibStatut(5);
}
if (!empty($this->name)) {
$label .= '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name);
if (!empty($this->name_alias)) {
$label .= ' ('.dol_escape_htmltag($this->name_alias).')';
}
$label .= '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag($this->name);
if (!empty($this->name_alias)) {
$label .= ' ('.dol_escape_htmltag($this->name_alias).')';
}
if ($this->email) {
$label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
}
$label .= '<br>'.img_picto('', 'email', 'class="pictofixedwidth"').$this->email;
if (!empty($this->phone) || !empty($this->fax)) {
$phonelist = array();
if ($this->phone) {

View File

@ -89,9 +89,9 @@ $search_idprof4 = trim(GETPOST('search_idprof4', 'alpha'));
$search_idprof5 = trim(GETPOST('search_idprof5', 'alpha'));
$search_idprof6 = trim(GETPOST('search_idprof6', 'alpha'));
$search_vat = trim(GETPOST('search_vat', 'alpha'));
$search_sale = trim(GETPOST("search_sale", 'int'));
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
$search_sale = GETPOST("search_sale", 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_categ_sup = GETPOST("search_categ_sup", 'int');
$search_country = GETPOST("search_country", 'intcomma');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_price_level = GETPOST('search_price_level', 'int');
@ -100,8 +100,8 @@ $search_status = GETPOST("search_status", 'int');
$search_type = GETPOST('search_type', 'alpha');
$search_level = GETPOST("search_level", "array");
$search_stcomm = GETPOST('search_stcomm', 'int');
$search_import_key = GETPOST("search_import_key", "alpha");
$search_parent_name = GETPOST('search_parent_name', 'alpha');
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
$search_parent_name = trim(GETPOST('search_parent_name', 'alpha'));
$type = GETPOST('type', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@ -494,10 +494,10 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_ef
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
// We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ_cus) && $search_categ_cus!=-1) {
if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
if (!empty($search_categ_sup) && $search_categ_sup!=-1) {
if (!empty($search_categ_sup) && $search_categ_sup != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";

View File

@ -44,8 +44,8 @@ $langs->loadLangs(array("admin", "cashdesk", "commercial"));
if (GETPOST('action', 'alpha') == 'set') {
$db->begin();
$res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity);

View File

@ -329,7 +329,7 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><span class="hideonsmartphone"><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
} else {
print '<button type="button" class="calcbutton2">'.$langs->trans("NoPaimementModesDefined").'</button>';
}
@ -355,7 +355,7 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[1]->code)).'</button>';
} else {
$button = array_pop($action_buttons);
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
@ -382,7 +382,7 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$paycode.'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span>'.(!empty($conf->global->TAKEPOS_NUMPAD_FORCE_PAYMENT_ICONS_LABELS) ? '<br> '. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : '') : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[2]->code)).'</button>';
} else {
$button = array_pop($action_buttons);
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
@ -394,7 +394,23 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
$i = 3;
while ($i < count($arrayOfValidPaymentModes)) {
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($arrayOfValidPaymentModes[$i]->code).'\');">'.$langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[$i]->code).'</button>';
$paycode = $arrayOfValidPaymentModes[$i]->code;
$payIcon = '';
if ($paycode == 'LIQ') {
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'coins';
}
} elseif ($paycode == 'CB') {
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'credit-card';
}
} elseif ($paycode == 'CHQ') {
if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$payIcon = 'money-check';
}
}
print '<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.' iconwithlabel"></span><br>'. $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[$i]->code) : $langs->trans("PaymentTypeShort".$arrayOfValidPaymentModes[$i]->code)).'</button>';
$i = $i + 1;
}

View File

@ -119,7 +119,7 @@ if (!empty($conf->global->TAKEPOS_HEADER) || !empty($conf->global->{$constFreeTe
if (!empty($conf->global->{$constFreeText})) {
$newfreetext .= make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
}
print $newfreetext;
print nl2br($newfreetext);
}
?>
</p>

View File

@ -1732,6 +1732,20 @@ td.showDragHandle {
display: inline-block;
}
/*
.classforhorizontalscrolloftabs .fiche .div-table-responsive
{
transform:rotateX(180deg);
-ms-transform:rotateX(180deg);
-webkit-transform:rotateX(180deg);
}
.classforhorizontalscrolloftabs .fiche .div-table-responsive-inside
{
transform:rotateX(180deg);
-ms-transform:rotateX(180deg);
-webkit-transform:rotateX(180deg);
}
*/
<?php if (empty($conf->global->THEME_DISABLE_STICKY_TOPMENU)) { ?>
@ -1842,10 +1856,11 @@ div.vmenu, td.vmenu {
display: none;
}
/* if no side-nav, we don't need to have width forced */
/* if no side-nav, we don't need to have width forced to calc(100% - 210px); */
.classforhorizontalscrolloftabs #id-right {
width: unset;
display: unset;
width: 100%;
/* width: unset; */
/* display: unset; */
}
body.sidebar-collapse .login_block {

View File

@ -45,7 +45,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ticketlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -698,6 +698,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'" >';
if ($socid) {
print '<input type="hidden" name="socid" value="'.$socid.'" >';
}
@ -759,6 +760,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<div class="div-table-responsive-inside">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -1088,6 +1090,7 @@ print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
print '</div>'."\n";
print '</form>'."\n";

View File

@ -415,7 +415,7 @@ if ($action == 'create') {
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre"><td class="titlefield liste_titre">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
print '<td class="liste_titre">';
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'maxwidth300');
print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500');
print ' &nbsp; ';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
print '<input type="submit" class="button buttongen" value="'.$langs->trans("Add").'">';

View File

@ -89,12 +89,12 @@ $searchbox .= '<input type="hidden" name="token" value="'.newToken().'">';
$searchbox .= '<table class="noborder nohover centpercent">';
$searchbox .= '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Search").'</td></tr>';
$searchbox .= '<tr><td>';
$searchbox .= $langs->trans("User").':</td><td><input class="flat inputsearch" type="text" name="search_user" size="18"></td></tr>';
$searchbox .= $langs->trans("User").':</td><td><input class="flat inputsearch width200" type="text" name="search_user"></td></tr>';
// Search Group
if ($canreadperms) {
$searchbox .= '<tr><td>';
$searchbox .= $langs->trans("Group").':</td><td><input class="flat inputsearch" type="text" name="search_group" size="18"></td></tr>';
$searchbox .= $langs->trans("Group").':</td><td><input class="flat inputsearch width200" type="text" name="search_group"></td></tr>';
}
$searchbox .= '<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';