Merge remote-tracking branch 'refs/remotes/Dolibarr/8.0' into 8.0

This commit is contained in:
fappels 2018-10-21 18:20:56 +02:00
commit 749a1e6242
346 changed files with 36117 additions and 34756 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@ dolibarr_install.log
upgrade.log upgrade.log
doxygen_warnings.log doxygen_warnings.log
/.project /.project
/.vscode
.DS_Store .DS_Store
.idea .idea
*.iml *.iml

View File

@ -2,7 +2,7 @@
# from Dolibarr GitHub repository. # from Dolibarr GitHub repository.
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/
# We use dist: precise to have php 5.3 available # We use dist: trusty to have php 5.4+ available
dist: trusty dist: trusty
sudo: required sudo: required
@ -37,7 +37,6 @@ php:
- '7.0' - '7.0'
- '7.1' - '7.1'
- '7.2' - '7.2'
#- hhvm only with dist: trusty
- nightly - nightly
env: env:
@ -59,10 +58,17 @@ env:
matrix: matrix:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- php: hhvm
- php: nightly - php: nightly
# We exclude some combinations not usefull to save Travis CPU # We exclude some combinations not usefull to save Travis CPU
exclude: exclude:
- php: '5.5'
env: DB=mariadb
- php: '5.6'
env: DB=mariadb
- php: '7.0'
env: DB=mariadb
- php: '7.1'
env: DB=mariadb
- php: '5.5' - php: '5.5'
env: DB=postgresql env: DB=postgresql
- php: '5.6' - php: '5.6'
@ -71,8 +77,6 @@ matrix:
env: DB=postgresql env: DB=postgresql
- php: '7.1' - php: '7.1'
env: DB=postgresql env: DB=postgresql
- php: hhvm
env: DB=postgresql
- php: nightly - php: nightly
env: DB=postgresql env: DB=postgresql

View File

@ -38,6 +38,12 @@ source_file = htdocs/langs/en_US/bills.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.blockedlog]
file_filter = htdocs/langs/<lang>/blockedlog.lang
source_file = htdocs/langs/en_US/blockedlog.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.bookmarks] [dolibarr.bookmarks]
file_filter = htdocs/langs/<lang>/bookmarks.lang file_filter = htdocs/langs/<lang>/bookmarks.lang
source_file = htdocs/langs/en_US/bookmarks.lang source_file = htdocs/langs/en_US/bookmarks.lang

158
ChangeLog
View File

@ -2,6 +2,73 @@
English Dolibarr ChangeLog English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 8.0.2 compared to 8.0.1 *****
FIX: #8452
FIX: #9043
FIX: #9316 Error when listing invoices
FIX: #9317
FIX: #9353 Bug: html error - div inside span on graphs
FIX: #9355
FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES
FIX: #9394
FIX: #9396
FIX: #9403
FIX: #9412
FIX: #9497
FIX: Add paypal error message in alert email when online payment fails.
FIX: better compatibility with multicompany
FIX: capital must be empty and not 0 if undefined
FIX: character making error on bill list
FIX: Entering negative price on order.
FIX: Expedition not showing extrafields on creation.
FIX: Homepage links were using wrong topmenus
FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES
FIX: invert mime type and name.
FIX: invoice popup hide localtax2 and 3 if not defined.
FIX: Lose filter on payment type or category after a sort on invoice list.
FIX: Maxi debug to allow to load chart of account with multicompany.
FIX: Missing translation in predefined email to membership renewal.
FIX: Mixing tickets of different thirdparties.
FIX: "Other ..." link so the "Back to" link works.
FIX: PDF address: handle when contact thirdparty is different from thirdparty of document
FIX: Problems with permissions of module to record payment of salaries
FIX: remove debug
FIX: Several fixes on the management of minimal amount for orders
FIX: wrong var name
***** ChangeLog for 8.0.1 compared to 8.0.0 *****
FIX: #9258
FIX: #9328
FIX: #9337
FIX: adding GROUP BY for PostgreSQL
FIX: API template for list pages in module builder
FIX: API template for record page to delete a record
FIX: a removed option was still in setup
FIX: badge on time spent on project and tasks
FIX: Delete file on smartphone
FIX: Fetch function will fetch comments
FIX: Fetch task will now fetch comments
FIX: $fk_account is always empty, must be $soc->fk_account
FIX: Force stripe api version to avoid trouble if we update stripe api
FIX: get_product_vat_for_country functions.lib.php
FIX: Get templates in a forced language
FIX: hook on dispatch order fourn
FIX: Language selection lost if error during creation of email template
FIX: Look and feel v8
FIX: propal.class.php
FIX: Add calls to fetchComments function
FIX: Remove fetchComments from project and task fetch function
FIX: remove internal property isextrafieldmanaged from API returns
FIX: sql error
FIX: table llx_chargessociales doesn't exists
FIX: trans on null object
FIX: vat rate code not returned by get_product_vat_for_country
FIX: warning for late template invoices to remove when suspended
FIX: Add hidden option MAIN_xxx_IN_SOURCE_ADDRESS to solve legal issues on PDF
FIX: Table llx_facture_rec_extrafields missing after migration
***** ChangeLog for 8.0.0 compared to 7.0.0 ***** ***** ChangeLog for 8.0.0 compared to 7.0.0 *****
For Users: For Users:
@ -19,7 +86,7 @@ NEW: Add a tab to specify accountant/auditor of the company
NEW: Add Date delivery and Availability on Propals List NEW: Add Date delivery and Availability on Propals List
NEW: Add date in goods reception supplier order table NEW: Add date in goods reception supplier order table
NEW: Add delivery_time_days of suppliers in export profile NEW: Add delivery_time_days of suppliers in export profile
NEW: Add Docments'tab to expedition module NEW: Add Documents'tab to expedition module
NEW: Use dol_print_phone in thirdparty list page to format phone NEW: Use dol_print_phone in thirdparty list page to format phone
NEW: Add entry for the GDPR contact NEW: Add entry for the GDPR contact
NEW: Add extrafield type "html" NEW: Add extrafield type "html"
@ -189,9 +256,72 @@ Following changes may create regressions for some external modules, but were nec
* Remove method Categorie:get_nb_categories() that was not used. * Remove method Categorie:get_nb_categories() that was not used.
* Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip * Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip
are now replaced with hook getNomUrl. are now replaced with hook getNomUrl.
* The substitution key __CONTACTCIVNAME__ is no longer present, it has been replaced by __CONTACT_NAME_{TYPE}__
where {TYPE} is contact type code (BILLING, SHIPPING, CUSTOMER, ... see contact type dictionnary).
***** ChangeLog for 7.0.4 compared to 7.0.3 *****
FIX: #8984 button create expense report
FIX: #9032
FIX: #9161
FIX: #9328
FIX: According to french law, if seller is in France and buyer isn't in UE and isn't a company, TVA used = TVA product
FIX: Add calls to fetchComments function
FIX: better compatibility with multicompany
FIX: case when we valid form with keyboard
FIX: character making error on bill list
FIX: check !empty exclude select element
FIX: combo into popup become crazy with IE10
FIX: combo of stock in popup are crazy in IE
FIX: Deletion of files in migration
FIX: exclude element of the select
FIX: extrafieldkey
FIX: Fetch function will fetch comments
FIX: Fetch task will now fetch comments
FIX: filter supplier invoice list by societe name.
FIX: $fk_account is always empty, must be $soc->fk_account
FIX: Force stripe api version to avoid trouble if we update stripe api
FIX: getEntity project and not projet
FIX: Get templates in a forced language
FIX: global $mysoc missing (to avoid php notice on lines 279, 280 & 281)
FIX: Injection
FIX: invoice stats: situation invoices were not counted
FIX: keep context filter on contact list on change column displayed
FIX: Keep same project when creating shipping from order
FIX: langs fr
FIX: Lose filter on payment type or category after a sort on invoice list
FIX: Missing behavior
FIX: missing hook to edit sql
FIX: multicompany compatibility !
FIX: need to filter on current entity on replenish
FIX: Option MAIN_DISABLE_NOTES_TAB #9611
FIX: page must always be 0 when we search (to avoid case : when we're on page 3 and we're looking for a precise thirdparty, we stay on page 3 and nothing's displaied)
FIX: Pagination on related item pages
FIX: Pagination on withdraw request list
FIX: PDF address: handle when contact thirdparty different from document thirdparty
FIX: PHP warning, undefined index notnull
FIX: Product marge tabs on product card
FIX: Product margin tab and credit note
FIX: propal: correctly preset project when creating with origin/originid
FIX: remain to pay for credit note was wrong on invoice list
FIX: remove debug
FIX: Remove fetchComments from project and task fetch function
FIX: remove rowid for multicompany compatibility
FIX: Search on Ref project on order list
FIX: search on ref project on propal list
FIX: showOptionals: column mismatches
FIX: SQL Injections reported by mu shcor (ADLab of Venustech)
FIX: stock replenish with multientity
FIX: table llx_chargessociales doesn't exists
FIX: we must see number of all shared projects
FIX: when stock is empty for current entity but > 0 in other entity, until this commit product wasn't displaied on replenishment, it must depends on multientity stock sharing
FIX: when we're just admin and not super admin, if we create new user with transverse mode, we don't see it then we can't add him in usergroup
FIX: wrong function name
FIX: Wrong position of firstname lastname
FIX: wrong value for module part and return access denied
FIX: Wrong variable and trigger name
***** ChangeLog for 7.0.3 compared to 7.0.2 ***** ***** ChangeLog for 7.0.3 compared to 7.0.2 *****
FIX: 7.0 task contact card without withproject parameters FIX: 7.0 task contact card without withproject parameters
FIX: #8722 FIX: #8722
@ -674,6 +804,32 @@ Following changes may create regressions for some external modules, but were nec
multicompany module to a version that support Dolibarr v7, everything should work as expected. multicompany module to a version that support Dolibarr v7, everything should work as expected.
***** ChangeLog for 6.0.8 compared to 6.0.7 *****
FIX: #8762
FIX: #9032
FIX: case when we valid form with keyboard
FIX: clause must not be there
FIX: dol_delete_file must work in a context without db handler loaded
FIX: entity test must be on product_fourn_price table and not product table
FIX: Fetch shipping will now fetch project id
FIX: $fk_account is always empty, must be $soc->fk_account
FIX: getEntity project and not projet
FIX: If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def.
FIX: Keep supplier proposal price for supplier order
FIX: langs fr
FIX: missing filters during reordering
FIX: need to filter on aa.entity for same accounting accounts available in several entities
FIX: page must always be 0 when we search (to avoid case : when we're on page 3 and we're looking for a precise thirdparty, we stay on page 3 and nothing's displaied)
FIX: PDF address: handle when contact thirdparty different from document thirdparty
FIX: propal: correctly preset project when creating with origin/originid
FIX: pu_ht_devise was not converted to numeric so decimals were lost when calculating total_ht_devise
FIX: remain to pay for credit note was wrong on invoice list
FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods
FIX: showOptionals: column mismatches
FIX: sometimes amounts are identical but php find them different.
FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url
FIX: we must see number of all shared projects
FIX: wrong var name
***** ChangeLog for 6.0.7 compared to 6.0.6 ***** ***** ChangeLog for 6.0.7 compared to 6.0.6 *****
FIX: #8023 FIX: #8023

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/8.0.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).

View File

@ -63,9 +63,9 @@ if (! $sortorder) $sortorder = "ASC";
$arrayfields=array( $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
); );
@ -121,7 +121,28 @@ if (empty($reshook))
if ($country_code) if ($country_code)
{ {
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql'; $sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
$result = run_sql($sqlfile, 1, 0, 1);
$offsetforchartofaccount = 0;
// Get the comment line '-- ADD CCCNNNNN to rowid...' to find CCCNNNNN (CCC is country num, NNNNN is id of accounting account)
// and pass CCCNNNNN + (num of company * 100 000 000) as offset to the run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value.
// This is to be sure there is no conflict for each chart of account, whatever is country, whatever is company when multicompany is used.
$tmp = file_get_contents($sqlfile);
if (preg_match('/-- ADD (\d+) to rowid/ims', $tmp, $reg))
{
$offsetforchartofaccount += $reg[1];
}
$offsetforchartofaccount+=($conf->entity * 100000000);
$result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', $offsetforchartofaccount);
if ($result > 0)
{
setEventMessages($langs->trans("ChartLoaded"), null);
}
else
{
setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings');
}
} }
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {

View File

@ -5,7 +5,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -50,11 +50,11 @@ $main_option = array (
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param]; $listparam = $configuration['param'];
$listformat = $configuration[format]; $listformat = $configuration['format'];
$listcr = $configuration[cr]; $listcr = $configuration['cr'];
$model_option = array ( $model_option = array (
@ -117,7 +117,7 @@ if ($action == 'update') {
if (! $error) { if (! $error) {
// reload // reload
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param]; $listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@ -142,27 +142,27 @@ print ' {'."\n";
foreach ($listparam as $key => $param) { foreach ($listparam as $key => $param) {
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n"; print ' {'."\n";
print ' //console.log("'.$param[label].'");'."\n"; print ' //console.log("'.$param['label'].'");'."\n";
if (empty($param[ACCOUNTING_EXPORT_FORMAT])) { if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) { if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) { if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
} }
if (empty($param[ACCOUNTING_EXPORT_DATE])) { if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else { } else {
@ -257,15 +257,15 @@ if ($num2) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $key[label]; $label = $key['label'];
print '<td width="50%">' . $langs->trans($label) . '</td>'; print '<td width="50%">' . $langs->trans($label) . '</td>';
// Value // Value
print '<td>'; print '<td>';
if (is_array($key[param])) { if (is_array($key['param'])) {
print $form->selectarray($label, $key[param], $conf->global->$label, 0); print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
} else { } else {
print '<input type="text" size="20" id="'. $label .'" name="' . $key[label] . '" value="' . $conf->global->$label . '">'; print '<input type="text" size="20" id="'. $label .'" name="' . $key['label'] . '" value="' . $conf->global->$label . '">';
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -41,6 +41,21 @@ $page = GETPOST("page");
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
if (GETPOST("exportcsv",'alpha')) $action = 'export_csv';
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
//if (! $sortfield) $sortfield="p.date_fin";
//if (! $sortorder) $sortorder="DESC";
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
@ -53,14 +68,6 @@ if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
} }
if (GETPOST("exportcsv",'alpha')) $action = 'export_csv';
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$object = new BookKeeping($db); $object = new BookKeeping($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
@ -96,23 +103,27 @@ if ($sortorder == "")
if ($sortfield == "") if ($sortfield == "")
$sortfield = "t.numero_compte"; $sortfield = "t.numero_compte";
$options = '';
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
$filter = array (); $filter = array ();
if (! empty($search_date_start)) { if (! empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$options .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int'); $param .= '&amp;date_startmonth=' . GETPOST('date_startmonth', 'int') . '&amp;date_startday=' . GETPOST('date_startday', 'int') . '&amp;date_startyear=' . GETPOST('date_startyear', 'int');
} }
if (! empty($search_date_end)) { if (! empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$options .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int'); $param .= '&amp;date_endmonth=' . GETPOST('date_endmonth', 'int') . '&amp;date_endday=' . GETPOST('date_endday', 'int') . '&amp;date_endyear=' . GETPOST('date_endyear', 'int');
} }
if (! empty($search_accountancy_code_start)) { if (! empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start; $filter['t.numero_compte>='] = $search_accountancy_code_start;
$options .= '&amp;search_accountancy_code_start=' . $search_accountancy_code_start; $param .= '&amp;search_accountancy_code_start=' . $search_accountancy_code_start;
} }
if (! empty($search_accountancy_code_end)) { if (! empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$options .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
} }
@ -134,8 +145,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
* View * View
*/ */
if ($action == 'export_csv') { if ($action == 'export_csv')
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$filename = 'balance'; $filename = 'balance';
@ -187,7 +198,8 @@ else {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />'; $button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, $button, $result, $result, 'title_accountancy', 0);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
$moreforfilter = ''; $moreforfilter = '';
@ -225,12 +237,12 @@ else {
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n"; print "</tr>\n";
$total_debit = 0; $total_debit = 0;

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -688,7 +689,7 @@ class AccountancyCategory // extends CommonObject
* Return list of personalized groups that are active * Return list of personalized groups that are active
* *
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array Array of groups * @return array|int Array of groups or -1 if error
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
@ -745,7 +746,7 @@ class AccountancyCategory // extends CommonObject
* *
* @param int $cat_id Id if personalized accounting group/category * @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @return array Array of accounting accounts * @return array|int Array of accounting accounts or -1 if error
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {

View File

@ -986,16 +986,21 @@ class BookKeeping extends CommonObject
} }
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql)
{
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { $i = 0;
while (($obj = $this->db->fetch_object($resql)) && ($i < min($limit, $num)))
{
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$this->lines[] = $line; $this->lines[] = $line;
$i++;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -146,9 +146,12 @@ if ($conf->accounting->enabled)
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled))
{
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
}
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";

View File

@ -60,11 +60,15 @@ $now = dol_now();
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
$hookmanager->initHooks(array('sellsjournal'));
$parameters=array();
/* /*
* Actions * Actions
*/ */
$reshook=$hookmanager->executeHooks('doActions',$parameters,$user,$action); // Note that $action and $object may have been modified by some hooks
// Get informations of journal // Get informations of journal
$accountingjournalstatic = new AccountingJournal($db); $accountingjournalstatic = new AccountingJournal($db);
$accountingjournalstatic->fetch($id_journal); $accountingjournalstatic->fetch($id_journal);

View File

@ -55,14 +55,12 @@ if ($action == 'update')
$amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); $amount=GETPOST('MEMBER_NEWFORM_AMOUNT');
$editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
$payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE');
$email=GETPOST('MEMBER_PAYONLINE_SENDEMAIL');
$forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE');
$res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity);
$res=dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL",$email,'chaine',0,'',$conf->entity);
if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE",$conf->entity); if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE",$conf->entity);
else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE",$forcetype,'chaine',0,'',$conf->entity); else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE",$forcetype,'chaine',0,'',$conf->entity);
@ -211,13 +209,6 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0); print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0);
print "</td></tr>\n"; print "</td></tr>\n";
// Jump to an online payment page
print '<tr class="oddeven" id="tremail"><td>';
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
print '</td><td align="right">';
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
print "</td></tr>\n";
print '</table>'; print '</table>';
print '<center>'; print '<center>';

View File

@ -209,7 +209,7 @@ if (empty($reshook))
} }
else else
{ {
setEventMessages($object->errors, $object->error, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -639,7 +639,9 @@ if (empty($reshook))
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2); $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
@ -710,7 +712,9 @@ if (empty($reshook))
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1); $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n";
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
} }
if ($result < 0) if ($result < 0)
{ {

View File

@ -79,7 +79,6 @@ class Adherent extends CommonObject
var $datec; var $datec;
var $datem; var $datem;
var $datefin;
var $datevalid; var $datevalid;
var $birth; var $birth;
@ -95,6 +94,8 @@ class Adherent extends CommonObject
var $fk_soc; var $fk_soc;
var $datefin; // From member table
// Fields loaded by fetch_subscriptions() // Fields loaded by fetch_subscriptions()
var $first_subscription_date; var $first_subscription_date;
var $first_subscription_amount; var $first_subscription_amount;
@ -125,7 +126,7 @@ class Adherent extends CommonObject
/** /**
* Function sending an email has the adherent with the text supplied in parameter. * Function sending an email to the current member with the text supplied in parameter.
* *
* @param string $text Content of message (not html entities encoded) * @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message * @param string $subject Subject of message
@ -137,9 +138,10 @@ class Adherent extends CommonObject
* @param int $deliveryreceipt Ask a delivery receipt * @param int $deliveryreceipt Ask a delivery receipt
* @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection
* @param string $errors_to erros to * @param string $errors_to erros to
* @param string $moreinheader Add more html headers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='', $moreinheader='')
{ {
global $conf,$langs; global $conf,$langs;
@ -160,9 +162,11 @@ class Adherent extends CommonObject
$from=$conf->email_from; $from=$conf->email_from;
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
$trackid = 'mem'.$this->id;
// Send email (substitutionarray must be done just before this) // Send email (substitutionarray must be done just before this)
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml); $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader);
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {
return 1; return 1;
@ -531,6 +535,13 @@ class Adherent extends CommonObject
$luser->pass=$this->pass; $luser->pass=$this->pass;
$luser->societe_id=$this->societe; $luser->societe_id=$this->societe;
$luser->birth=$this->birth;
$luser->address=$this->address;
$luser->zip=$this->zip;
$luser->town=$this->town;
$luser->country_id=$this->country_id;
$luser->state_id=$this->state_id;
$luser->email=$this->email; $luser->email=$this->email;
$luser->skype=$this->skype; $luser->skype=$this->skype;
$luser->office_phone=$this->phone; $luser->office_phone=$this->phone;
@ -1178,11 +1189,9 @@ class Adherent extends CommonObject
/** /**
* Fonction qui recupere pour un adherent les parametres * Function to get member subscriptions data
* first_subscription_date * first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
* first_subscription_amount * last_subscription_date, last_subscription_date_start, last_subscription_date_end, last_subscription_amount
* last_subscription_date
* last_subscription_amount
* *
* @return int <0 si KO, >0 si OK * @return int <0 si KO, >0 si OK
*/ */
@ -1212,10 +1221,14 @@ class Adherent extends CommonObject
{ {
if ($i==0) if ($i==0)
{ {
$this->first_subscription_date=$obj->dateh; $this->first_subscription_date=$this->db->jdate($obj->datec);
$this->first_subscription_date_start=$this->db->jdate($obj->dateh);
$this->first_subscription_date_end=$this->db->jdate($obj->datef);
$this->first_subscription_amount=$obj->subscription; $this->first_subscription_amount=$obj->subscription;
} }
$this->last_subscription_date=$obj->dateh; $this->last_subscription_date=$this->db->jdate($obj->datec);
$this->last_subscription_date_start=$this->db->jdate($obj->datef);
$this->last_subscription_date_end=$this->db->jdate($obj->datef);
$this->last_subscription_amount=$obj->subscription; $this->last_subscription_amount=$obj->subscription;
$subscription=new Subscription($this->db); $subscription=new Subscription($this->db);
@ -1300,9 +1313,9 @@ class Adherent extends CommonObject
{ {
// Change properties of object (used by triggers) // Change properties of object (used by triggers)
$this->last_subscription_date=dol_now(); $this->last_subscription_date=dol_now();
$this->last_subscription_amount=$amount;
$this->last_subscription_date_start=$date; $this->last_subscription_date_start=$date;
$this->last_subscription_date_end=$datefin; $this->last_subscription_date_end=$datefin;
$this->last_subscription_amount=$amount;
} }
if (! $error) if (! $error)
@ -1340,7 +1353,7 @@ class Adherent extends CommonObject
* @param string $num_chq Numero cheque (if Id bank account provided) * @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer * @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque * @param string $emetteur_banque Name of bank of cheque
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty and we request an option that generate invoice. * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)
@ -2231,8 +2244,13 @@ class Adherent extends CommonObject
$this->need_subscription=0; $this->need_subscription=0;
$this->first_subscription_date=time(); $this->first_subscription_date=time();
$this->first_subscription_date_start=$this->first_subscription_date;
$this->first_subscription_date_end=dol_time_plus_duree($this->first_subscription_date_start, 1, 'y');
$this->first_subscription_amount=10; $this->first_subscription_amount=10;
$this->last_subscription_date=time();
$this->last_subscription_date=$this->first_subscription_date;
$this->last_subscription_date_start=$this->first_subscription_date;
$this->last_subscription_date_end=dol_time_plus_duree($this->last_subscription_date_start, 1, 'y');
$this->last_subscription_amount=10; $this->last_subscription_amount=10;
} }
@ -2532,10 +2550,10 @@ class Adherent extends CommonObject
* Send reminders by emails before subscription end * Send reminders by emails before subscription end
* CAN BE A CRON TASK * CAN BE A CRON TASK
* *
* @param int $daysbeforeend Nb of days before end of subscription (negative number = after subscription) * @param string $daysbeforeendlist Nb of days before end of subscription (negative number = after subscription). Can be a list of delay, separated by a semicolon, for example '10;5;0;-5'
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/ */
public function sendReminderForExpiredSubscription($daysbeforeend=10) public function sendReminderForExpiredSubscription($daysbeforeendlist='10')
{ {
global $conf, $langs, $mysoc, $user; global $conf, $langs, $mysoc, $user;
@ -2553,11 +2571,23 @@ class Adherent extends CommonObject
}*/ }*/
$now = dol_now(); $now = dol_now();
$nbok = 0;
$nbko = 0;
dol_syslog(__METHOD__, LOG_DEBUG); $arraydaysbeforeend=explode(';',$daysbeforeendlist);
foreach($arraydaysbeforeend as $daysbeforeend) // Loop on each delay
{
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
if (! is_numeric($daysbeforeend))
{
$blockingerrormsg="Value for delta is not a positive or negative numeric";
$nbko++;
break;
}
$tmp=dol_getdate($now); $tmp=dol_getdate($now);
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), -1 * $daysbeforeend, 'd'); $datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent'; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
$sql.= " WHERE datefin = '".$this->db->idate($datetosearchfor)."'"; $sql.= " WHERE datefin = '".$this->db->idate($datetosearchfor)."'";
@ -2572,13 +2602,11 @@ class Adherent extends CommonObject
$formmail = new FormMail($this->db); $formmail = new FormMail($this->db);
$i=0; $i=0;
$nbok = 0;
$nbko = 0;
while ($i < $num_rows) while ($i < $num_rows)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$adherent->fetch($obj->rowid); $adherent->fetch($obj->rowid, '', '', '', true, true);
if (empty($adherent->email)) if (empty($adherent->email))
{ {
@ -2592,6 +2620,7 @@ class Adherent extends CommonObject
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members"));
dol_syslog("sendReminderForExpiredSubscription Language set to ".$outputlangs->defaultlang);
$arraydefaultmessage=null; $arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
@ -2609,8 +2638,11 @@ class Adherent extends CommonObject
$from = $conf->global->ADHERENT_MAIL_FROM; $from = $conf->global->ADHERENT_MAIL_FROM;
$to = $adherent->email; $to = $adherent->email;
$trackid = 'mem'.$adherent->id;
$moreinheader='X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n";
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader);
$result = $cmail->sendfile(); $result = $cmail->sendfile();
if (! $result) if (! $result)
{ {
@ -2622,6 +2654,9 @@ class Adherent extends CommonObject
else else
{ {
$nbok++; $nbok++;
// TODO Add event email sent for member
} }
} }
else else
@ -2640,6 +2675,7 @@ class Adherent extends CommonObject
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
return 1; return 1;
} }
}
if ($blockingerrormsg) if ($blockingerrormsg)
{ {

View File

@ -75,7 +75,7 @@ if ($action == 'dolibarr2ldap')
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs'); setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
} }
else { else {
setEventMessages($ldap->errors, $ldap->error, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }
} }

View File

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

View File

@ -327,7 +327,7 @@ if ($action == 'edit' || $action == 'updateedit')
// Name // Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Addresse // Addresse
@ -336,11 +336,11 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha')) . '"></td></tr>'."\n"; print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml')) . '"></td></tr>'."\n"; print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml')) . '"></td></tr>'."\n";
// Country // Country
@ -362,29 +362,29 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>'; print '<input name="tel" id="phone" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL) . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>'; print '<input name="fax" id="fax" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX) . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>'; print '<input name="mail" id="email" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL) . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>'; print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>'; print '<input name="web" id="web" class="minwidth300" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_WEB) . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Barcode // Barcode
if (! empty($conf->barcode->enabled)) { if (! empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>'; print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>'; print '<input name="barcode" id="barcode" class="minwidth150" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD) . '"></td></tr>';
print '</td></tr>'; print '</td></tr>';
} }
@ -423,19 +423,19 @@ if ($action == 'edit' || $action == 'updateedit')
// Managing Director(s) // Managing Director(s)
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>'; print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>'; print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS) . '"></td></tr>';
// GDPR contact // GDPR contact
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print '</td><td>'; print '</td><td>';
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . $conf->global->MAIN_INFO_GDPR . '"></td></tr>'; print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_GDPR) . '"></td></tr>';
// Capital // Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>'; print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
print '<input name="capital" id="capital" class="minwidth100" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>'; print '<input name="capital" id="capital" class="minwidth100" value="' . dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL) . '"></td></tr>';
// Juridical Status // Juridical Status
@ -454,7 +454,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="siren" id="profid1" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">'; print '<input name="siren" id="profid1" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '') . '">';
} }
else else
{ {
@ -470,7 +470,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="siret" id="profid2" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">'; print '<input name="siret" id="profid2" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '' ) . '">';
} }
else else
{ {
@ -486,7 +486,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="ape" id="profid3" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">'; print '<input name="ape" id="profid3" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '') . '">';
} }
else else
{ {
@ -502,7 +502,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="rcs" id="profid4" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">'; print '<input name="rcs" id="profid4" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '') . '">';
} }
else else
{ {
@ -518,7 +518,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">'; print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '') . '">';
} }
else else
{ {
@ -534,7 +534,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>'; print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code)) if (! empty($mysoc->country_code))
{ {
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">'; print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '') . '">';
} }
else else
{ {
@ -546,7 +546,7 @@ if ($action == 'edit' || $action == 'updateedit')
// TVA Intra // TVA Intra
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>'; print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">'; print '<input name="tva" id="intra_vat" class="minwidth200" value="' . dol_escape_htmltag(! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '</td></tr>'; print '</td></tr>';
// Object of the company // Object of the company

View File

@ -244,8 +244,8 @@ if ($resql)
preg_match('/^([0-9]+)/i',$obj->note,$reg); preg_match('/^([0-9]+)/i',$obj->note,$reg);
$idrss = $reg[1]; $idrss = $reg[1];
$keyrsstitle="EXTERNAL_RSS_TITLE_".$idrss;
$keyrssurl="EXTERNAL_RSS_URLRSS_".$idrss; $keyrssurl="EXTERNAL_RSS_URLRSS_".$idrss;
$keyrsstitle="EXTERNAL_RSS_URLRSS_".$idrss;
//print "x".$idrss; //print "x".$idrss;
$rssparser=new RssParser($db); $rssparser=new RssParser($db);

View File

@ -320,9 +320,10 @@ if (empty($reshook))
$sql.= $field."="; $sql.= $field."=";
//print $keycode.' - '.$_POST[$keycode].'<br>'; //print $keycode.' - '.$_POST[$keycode].'<br>';
if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1 elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1
elseif ($keycode == 'position') $sql.=((int) $_POST[$keycode]);
else $sql.="'".$db->escape($_POST[$keycode])."'"; else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++; $i++;
} }

View File

@ -833,6 +833,8 @@ if ($mode == 'common')
dol_fiche_end(); dol_fiche_end();
print '<br>';
// Show warning about external users // Show warning about external users
print info_admin(showModulesExludedForExternal($modules))."\n"; print info_admin(showModulesExludedForExternal($modules))."\n";

View File

@ -160,7 +160,7 @@ print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n"; print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print " <td align=\"right\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$found=0; $found=0;
@ -262,7 +262,7 @@ print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n"; print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print " <td align=\"right\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$found=0; $found=0;
@ -341,7 +341,7 @@ print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n"; print " <td>".$langs->trans("RuleForStockAvailability")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print " <td align=\"right\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
@ -416,7 +416,7 @@ if ($virtualdiffersfromphysical)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n"; print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print " <td align=\"right\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -439,12 +439,12 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print " <td>".$langs->trans("Other")."</td>\n"; print " <td>".$langs->trans("Other")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n"; print " <td align=\"right\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>'; print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
print '<td class="width100" align="right">'; print '<td align="right">';
print "<form method=\"post\" action=\"stock.php\">"; print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">"; print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
@ -456,7 +456,8 @@ print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")).'</td>'; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
print '</td>';
print '<td align="right">'; print '<td align="right">';
print "<form method=\"post\" action=\"stock.php\">"; print "<form method=\"post\" action=\"stock.php\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -502,7 +503,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Inventory").'</td>'."\n"; print '<td>'.$langs->trans("Inventory").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>'; print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">&nbsp;</td>'."\n"; print '<td align="center">&nbsp;</td>'."\n";
// Example with a yes / no select // Example with a yes / no select
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -56,9 +56,12 @@ $specimenthirdparty->initAsSpecimen();
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconstinvoice=GETPOST('maskconstinvoice','alpha'); $maskconstinvoice=GETPOST('maskconstinvoice','alpha');
$maskvalue=GETPOST('maskinvoice','alpha'); $maskconstcredit=GETPOST('maskconstcredit','alpha');
$maskinvoice=GETPOST('maskinvoice','alpha');
$maskcredit=GETPOST('maskcredit','alpha');
if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskvalue,'chaine',0,'',$conf->entity); if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskinvoice,'chaine',0,'',$conf->entity);
if ($maskconstcredit) $res = dolibarr_set_const($db,$maskconstcredit,$maskcredit,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;

View File

@ -157,7 +157,8 @@ $i=0;
foreach($_SESSION as $key => $val) foreach($_SESSION as $key => $val)
{ {
if ($i > 0) print ', '; if ($i > 0) print ', ';
print $key.' => '.dol_escape_htmltag($val); if (is_array($val)) print $key.' => array(...)';
else print $key.' => '.dol_escape_htmltag($val);
$i++; $i++;
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -337,7 +337,13 @@ if (! $error && $xml)
$i++; $i++;
$out.='<tr class="oddeven">'; $out.='<tr class="oddeven">';
$out.='<td>'.$i.'</td>' . "\n"; $out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n"; $out.='<td>'.$file['filename'];
$out.=PHP_OS;
if (! preg_match('/^win/i',PHP_OS)) {
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm');
}
$out.='</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n"; $out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
$out.='<td align="center">'.$file['md5'].'</td>' . "\n"; $out.='<td align="center">'.$file['md5'].'</td>' . "\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);

View File

@ -129,7 +129,7 @@ if ($what == 'mysql')
{ {
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
$ok=0; $ok=0;
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
foreach($arrayofallowedcommand as $allowedcommand) foreach($arrayofallowedcommand as $allowedcommand)
{ {
if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump))
@ -235,176 +235,3 @@ $time_end = time();
$db->close(); $db->close();
// MYSQL NO BINARIES (only php)
/** Backup the db OR just a table without mysqldump binary (does not require any exec permission)
* Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php)
* Updated and enhanced by Stephen Larroque (lrq3000) and by the many commentators from the blog
* Note about foreign keys constraints: for Dolibarr, since there are a lot of constraints and when imported the tables will be inserted in the dumped order, not in constraints order, then we ABSOLUTELY need to use SET FOREIGN_KEY_CHECKS=0; when importing the sql dump.
* Note2: db2SQL by Howard Yeend can be an alternative, by using SHOW FIELDS FROM and SHOW KEYS FROM we could generate a more precise dump (eg: by getting the type of the field and then precisely outputting the right formatting - in quotes, numeric or null - instead of trying to guess like we are doing now).
*
* @param string $outputfile Output file name
* @param string $tables Table name or '*' for all
* @return int <0 if KO, >0 if OK
*/
function backup_tables($outputfile, $tables='*')
{
global $db, $langs;
global $errormsg;
// Set to UTF-8
if (is_a($db, 'DoliDBMysqli')) {
/** @var DoliDBMysqli $db */
$db->db->set_charset('utf8');
} else {
/** @var DoliDB $db */
$db->query('SET NAMES utf8');
$db->query('SET CHARACTER SET utf8');
}
//get all of the tables
if ($tables == '*')
{
$tables = array();
$result = $db->query('SHOW FULL TABLES WHERE Table_type = \'BASE TABLE\'');
while($row = $db->fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
$handle = fopen($outputfile, 'w+');
if (fwrite($handle, '') === false)
{
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
return -1;
}
// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".$db::LABEL." dump via php with Dolibarr ".DOL_VERSION."
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------
-- Server version ".$db->db->server_info."
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
";
if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n";
//$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n";
fwrite($handle, $sqlhead);
$ignore = '';
if (GETPOST("nobin_sql_ignore")) $ignore = 'IGNORE ';
$delayed = '';
if (GETPOST("nobin_delayed")) $delayed = 'DELAYED ';
// Process each table and print their definition + their datas
foreach($tables as $table)
{
// Saving the table structure
fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n");
if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it
fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
$row2 = $db->fetch_row($resqldrop);
if (empty($row2[1]))
{
fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
}
else
{
fwrite($handle,$row2[1].";\n");
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
// Dumping the data (locking the table and disabling the keys check while doing the process)
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
$sql='SELECT * FROM '.$table;
$result = $db->query($sql);
while($row = $db->fetch_row($result))
{
// For each row of data we print a line of INSERT
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
$columns = count($row);
for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null && !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL';
} elseif(is_string($row[$j]) && $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
} elseif(is_numeric($row[$j]) && !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
// if it's a number, we return it as-is
// $row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
$row[$j] = "'".$row[$j]."'";
}
}
fwrite($handle,implode(',', $row).");\n");
}
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
fwrite($handle,"\n\n\n");
}
}
/* Backup Procedure structure*/
/*
$result = $db->query('SHOW PROCEDURE STATUS');
if ($db->num_rows($result) > 0)
{
while ($row = $db->fetch_row($result)) { $procedures[] = $row[1]; }
foreach($procedures as $proc)
{
fwrite($handle,"DELIMITER $$\n\n");
fwrite($handle,"DROP PROCEDURE IF EXISTS '$name'.'$proc'$$\n");
$resqlcreateproc=$db->query("SHOW CREATE PROCEDURE '$proc'");
$row2 = $db->fetch_row($resqlcreateproc);
fwrite($handle,"\n".$row2[2]."$$\n\n");
fwrite($handle,"DELIMITER ;\n\n");
}
}
*/
/* Backup Procedure structure*/
// Write the footer (restore the previous database settings)
$sqlfooter="\n\n";
if (GETPOST("nobin_use_transaction")) $sqlfooter .= "COMMIT;\n";
if (GETPOST("nobin_disable_fk")) $sqlfooter .= "SET FOREIGN_KEY_CHECKS=1;\n";
$sqlfooter.="\n\n-- Dump completed on ".date('Y-m-d G-i-s');
fwrite($handle, $sqlfooter);
fclose($handle);
return 1;
}

View File

@ -99,7 +99,7 @@ $usefilter=0;
$listofsessions=listOfSessions(); $listofsessions=listOfSessions();
$num=count($listofsessions); $num=count($listofsessions);
print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup'); print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'', $num, ($num?$num:''),'setup'); // Do not show numer (0) if no session found (it means we can't know)
$savehandler=ini_get("session.save_handler"); $savehandler=ini_get("session.save_handler");
$savepath=ini_get("session.save_path"); $savepath=ini_get("session.save_path");

View File

@ -98,6 +98,7 @@ class DolibarrApi
// Remove $db object property for object // Remove $db object property for object
unset($object->db); unset($object->db);
unset($object->isextrafieldmanaged);
unset($object->ismultientitymanaged); unset($object->ismultientitymanaged);
unset($object->restrictiononfksoc); unset($object->restrictiononfksoc);

View File

@ -65,8 +65,11 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss); llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
print load_fiche_titre($title); print load_fiche_titre($title, $newcardbutton);
//print '<table border="0" width="100%" class="notopnoleftnoright">'; //print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">'; //print '<tr><td valign="top" width="30%" class="notopnoleft">';

View File

@ -1250,8 +1250,13 @@ if ($id > 0)
if (! empty($object->fk_element) && ! empty($object->elementtype)) if (! empty($object->fk_element) && ! empty($object->elementtype))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("LinkedObject").'</td>'; print '<tr>';
print '<td>'.dolGetElementUrl($object->fk_element,$object->elementtype,1).'</td></tr>'; print '<td>'.$langs->trans("LinkedObject").'</td>';
print '<td>'.dolGetElementUrl($object->fk_element,$object->elementtype,1);
print '<input type="hidden" name="fk_element" value="'.$object->fk_element.'">';
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
print '</td>';
print '</tr>';
} }
// Description // Description
@ -1610,7 +1615,7 @@ if ($id > 0)
$delallowed=$user->rights->agenda->myactions->create; $delallowed=$user->rights->agenda->myactions->create;
print $formfile->showdocuments('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); print $formfile->showdocuments('actions',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -883,7 +883,7 @@ class ActionComm extends CommonObject
$val=array('id'=>$val); $val=array('id'=>$val);
} }
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")"; $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory'])?'0':$val['mandatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)

View File

@ -181,7 +181,7 @@ if (empty($reshook))
if ($action == 'setorder_min_amount') if ($action == 'setorder_min_amount')
{ {
$object->fetch($id); $object->fetch($id);
$object->order_min_amount=GETPOST('order_min_amount'); $object->order_min_amount=price2num(GETPOST('order_min_amount','alpha'));
$result=$object->update($object->id, $user); $result=$object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} }
@ -423,16 +423,22 @@ if ($object->id > 0)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
if ($object->client)
{
if (! empty($conf->commande->enabled) && ! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
{
print '<!-- Minimim amount for orders -->'."\n";
print '<tr class="nowrap">'; print '<tr class="nowrap">';
print '<td>'; print '<td>';
print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer); print $form->editfieldkey("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer);
print '</td><td>'; print '</td><td>';
print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : '')); print $form->editfieldval("OrderMinAmount",'order_min_amount',$object->order_min_amount,$object,$user->rights->societe->creer,$limit_field_type,($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
}
// Multiprice level // Multiprice level
@ -660,6 +666,8 @@ if ($object->id > 0)
*/ */
if (! empty($conf->propal->enabled) && $user->rights->propal->lire) if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{ {
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
$sql.= ", p.tva as total_tva"; $sql.= ", p.tva as total_tva";
$sql.= ", p.total as total_ttc"; $sql.= ", p.total as total_ttc";
@ -668,7 +676,7 @@ if ($object->id > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql.= " AND s.rowid = ".$object->id; $sql.= " AND s.rowid = ".$object->id;
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity IN (".getEntity('propal').")";
$sql.= " ORDER BY p.datep DESC"; $sql.= " ORDER BY p.datep DESC";
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -609,12 +609,23 @@ if (empty($reshook))
// Classify billed // Classify billed
else if ($action == 'classifybilled' && $usercanclose) else if ($action == 'classifybilled' && $usercanclose)
{ {
$db->begin();
$result=$object->cloture($user, 4, ''); $result=$object->cloture($user, 4, '');
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
// Close proposal // Close proposal
@ -627,12 +638,23 @@ if (empty($reshook))
// prevent browser refresh from closing proposal several times // prevent browser refresh from closing proposal several times
if ($object->statut == Propal::STATUS_VALIDATED) if ($object->statut == Propal::STATUS_VALIDATED)
{ {
$db->begin();
$result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','none')); $result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','none'));
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
} }
} }
@ -643,12 +665,23 @@ if (empty($reshook))
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
{ {
$db->begin();
$result=$object->reopen($user, 1); $result=$object->reopen($user, 1);
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
if (! $error)
{
$db->commit();
}
else
{
$db->rollback();
}
} }
} }
@ -931,6 +964,7 @@ if (empty($reshook))
// Add custom code and origin country into description // Add custom code and origin country into description
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
{ {
$tmptxt = '(';
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs; $outputlangs = $langs;
@ -1514,7 +1548,7 @@ if ($action == 'create')
// Bank Account // Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>'; print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); $form->select_comptes($soc->fk_account, 'fk_account', 0, '', 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1848,7 +1882,7 @@ if ($action == 'create')
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -13,6 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1007,6 +1008,7 @@ class Propal extends CommonObject
// Add linked object (deprecated, use ->linkedObjectsIds instead) // Add linked object (deprecated, use ->linkedObjectsIds instead)
if (! $error && $this->origin && $this->origin_id) if (! $error && $this->origin && $this->origin_id)
{ {
dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
$ret = $this->add_object_linked(); $ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db); if (! $ret) dol_print_error($this->db);
} }
@ -1079,13 +1081,6 @@ class Propal extends CommonObject
} }
} }
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
// Set delivery address // Set delivery address
if (! $error && $this->fk_delivery_address) if (! $error && $this->fk_delivery_address)
{ {
@ -1322,6 +1317,7 @@ class Propal extends CommonObject
$sql.= ", p.fk_shipping_method"; $sql.= ", p.fk_shipping_method";
$sql.= ", p.fk_incoterms, p.location_incoterms"; $sql.= ", p.fk_incoterms, p.location_incoterms";
$sql.= ", p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc"; $sql.= ", p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc";
$sql.= ", p.tms as date_modification";
$sql.= ", i.libelle as libelle_incoterms"; $sql.= ", i.libelle as libelle_incoterms";
$sql.= ", c.label as statut_label"; $sql.= ", c.label as statut_label";
$sql.= ", ca.code as availability_code, ca.label as availability"; $sql.= ", ca.code as availability_code, ca.label as availability";
@ -1378,6 +1374,7 @@ class Propal extends CommonObject
$this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->datev = $this->db->jdate($obj->datev); // TODO deprecated
$this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
$this->date = $this->db->jdate($obj->dp); // Proposal date $this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated $this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv); $this->fin_validite = $this->db->jdate($obj->dfv);
@ -2440,7 +2437,7 @@ class Propal extends CommonObject
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
$this->statut = $statut; $this->statut = $statut;
$this->date_cloture = $now; $this->date_cloture = $now;
$this->note_private = $note; $this->note_private = $newprivatenote;
} }
if (! $notrigger && empty($error)) if (! $notrigger && empty($error))
@ -2458,6 +2455,10 @@ class Propal extends CommonObject
} }
else else
{ {
$this->statut = $this->oldcopy->statut;
$this->date_cloture = $this->oldcopy->date_cloture;
$this->note_private = $this->oldcopy->note_private;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -3108,7 +3109,7 @@ class Propal extends CommonObject
$this->labelstatut[3]=$langs->trans("PropalStatusNotSigned"); $this->labelstatut[3]=$langs->trans("PropalStatusNotSigned");
$this->labelstatut[4]=$langs->trans("PropalStatusBilled"); $this->labelstatut[4]=$langs->trans("PropalStatusBilled");
$this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort"); $this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort");
$this->labelstatut_short[1]=$langs->trans("Opened"); $this->labelstatut_short[1]=$langs->trans("PropalStatusValidatedShort");
$this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort"); $this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort");
$this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort"); $this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort");
$this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort"); $this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
@ -4186,7 +4187,7 @@ class PropaleLigne extends CommonObjectLine
* Update DB line fields total_xxx * Update DB line fields total_xxx
* Used by migration * Used by migration
* *
* @return int <0 if ko, >0 if ok * @return int <0 if KO, >0 if OK
*/ */
function update_total() function update_total()
{ {

View File

@ -679,7 +679,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++; $error++;
} }
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && (! ($price_ht_devise >= 0) || $price_ht_devise == '')) // Unit price can be 0 but not '' if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for order.
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++; $error++;
@ -1987,7 +1987,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -2387,7 +2387,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Total HT // Total HT
$alert = ''; $alert = '';
if($object->total_ht < $object->thirdparty->order_min_amount) { if (! empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) {
$alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount)); $alert = ' ' . img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
} }
print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';

View File

@ -1877,6 +1877,9 @@ class Commande extends CommonOrder
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
@ -4253,9 +4256,10 @@ class OrderLine extends CommonOrderLine
} }
/** /**
* Update totals of order into database * Update DB line fields total_xxx
* Used by migration
* *
* @return int <0 if ko, >0 if ok * @return int <0 if KO, >0 if OK
*/ */
function update_total() function update_total()
{ {

View File

@ -455,7 +455,7 @@ while($j<$numlt)
// Payment Salary // Payment Salary
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
{ {
if (! $mode || $mode != 'sconly') if (! $mode || $mode != 'sconly')
{ {

View File

@ -694,6 +694,9 @@ if (empty($reshook))
$amount_ht[$line->tva_tx] += $line->total_ht; $amount_ht[$line->tva_tx] += $line->total_ht;
$amount_tva[$line->tva_tx] += $line->total_tva; $amount_tva[$line->tva_tx] += $line->total_tva;
$amount_ttc[$line->tva_tx] += $line->total_ttc; $amount_ttc[$line->tva_tx] += $line->total_ttc;
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
$i ++; $i ++;
} }
} }
@ -749,6 +752,9 @@ if (empty($reshook))
$discount->amount_ht = abs($amount_ht[$tva_tx]); $discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]); $discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]); $discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx); $discount->tva_tx = abs($tva_tx);
$result = $discount->create($user); $result = $discount->create($user);
@ -953,6 +959,8 @@ if (empty($reshook))
if($facture_source->type == Facture::TYPE_SITUATION) if($facture_source->type == Facture::TYPE_SITUATION)
{ {
$source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id
$line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from
if(!empty($facture_source->tab_previous_situation_invoice)) if(!empty($facture_source->tab_previous_situation_invoice))
{ {
@ -976,7 +984,7 @@ if (empty($reshook))
$maxPrevSituationPercent = 0; $maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{ {
if($prevLine->id == $line->fk_prev_id) if($prevLine->id == $source_fk_prev_id)
{ {
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent); $maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
@ -1533,7 +1541,9 @@ if (empty($reshook))
{ {
$line->origin = $object->origin; $line->origin = $object->origin;
$line->origin_id = $line->id; $line->origin_id = $line->id;
$line->fk_prev_id = $line->id;
$line->fetch_optionals($line->id); $line->fetch_optionals($line->id);
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except) if ($line->fk_remise_except)
@ -1680,10 +1690,19 @@ if (empty($reshook))
$error++; $error++;
} }
if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
{
if ($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
else
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++; $error++;
} }
}
if ($qty == '') { if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++; $error++;
@ -2130,6 +2149,21 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
$error++; $error++;
} }
if (empty($productid) && (($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $pu_ht == '') && $pu_ht_devise == '') // Unit price can be 0 but not ''
{
if ($pu_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
else
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
}
// Update line // Update line
if (! $error) { if (! $error) {
@ -3223,8 +3257,7 @@ if ($action == 'create')
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1); print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
// We check if Origin document (id and type is known) has already at least one invoice attached to it // We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid,$origin,'','facture'); $objectsrc->fetchObjectLinked($originid,$origin,'','facture');
$cntinvoice=count($objectsrc->linkedObjects['facture']); if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1)
if ($cntinvoice>=1)
{ {
setEventMessages('WarningBillExist', null, 'warnings'); setEventMessages('WarningBillExist', null, 'warnings');
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')'; echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['facture'])->getNomUrl(1).')';
@ -3619,7 +3652,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)'; if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -3703,7 +3736,7 @@ else if ($id > 0 || ! empty($ref))
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id); $result = $discount->fetch(0, $object->id);
if ($result > 0){ if ($result > 0){
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(), $discount->getNomUrl(1, 'discount')).'<br>'; print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
} }
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -1177,6 +1177,10 @@ class Facture extends CommonInvoice
if ($user->rights->facture->lire) { if ($user->rights->facture->lire) {
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>'; $label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
if ($this->type == self::TYPE_REPLACEMENT) $label='<u>' . $langs->transnoentitiesnoconv("ShowInvoiceReplace") . '</u>';
if ($this->type == self::TYPE_CREDIT_NOTE) $label='<u>' . $langs->transnoentitiesnoconv("ShowInvoiceAvoir") . '</u>';
if ($this->type == self::TYPE_DEPOSIT) $label='<u>' . $langs->transnoentitiesnoconv("ShowInvoiceDeposit") . '</u>';
if ($this->type == self::TYPE_SITUATION) $label='<u>' . $langs->transnoentitiesnoconv("ShowInvoiceSituation") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref; $label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->ref_client)) if (! empty($this->ref_client))
@ -1185,16 +1189,12 @@ class Facture extends CommonInvoice
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva)) if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_localtax1)) if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000'
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>eee' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_localtax2)) if (! empty($this->total_localtax2) && $this->total_localtax2 != 0)
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc)) if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label.=' - '.$moretitle;
} }
@ -1379,7 +1379,7 @@ class Facture extends CommonInvoice
} }
else else
{ {
$this->error='Bill with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; $this->error='Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
return 0; return 0;
} }
@ -1485,7 +1485,7 @@ class Facture extends CommonInvoice
$line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
// TODO Fetch optional like done in fetch line of facture_rec ? $line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
@ -1709,9 +1709,9 @@ class Facture extends CommonInvoice
$facligne->total_ttc = -$remise->amount_ttc; $facligne->total_ttc = -$remise->amount_ttc;
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice; $facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht; $facligne->multicurrency_total_ht = -$remise->multicurrency_amount_ht;
$facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva; $facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva;
$facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc; $facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc;
$lineid=$facligne->insert(); $lineid=$facligne->insert();
if ($lineid > 0) if ($lineid > 0)
@ -3742,7 +3742,7 @@ class Facture extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
$response->label=$langs->trans("CustomerBillsUnpaid"); $response->label=$langs->trans("CustomerBillsUnpaid");
$response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills'; $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=billing&leftmenu=customers_bills';
$response->img=img_object('',"bill"); $response->img=img_object('',"bill");
$generic_facture = new Facture($this->db); $generic_facture = new Facture($this->db);
@ -4784,8 +4784,8 @@ class FactureLigne extends CommonInvoiceLine
} }
/** /**
* Mise a jour en base des champs total_xxx de ligne de facture * Update DB line fields total_xxx
* TODO What is goal of this method ? * Used by migration
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
@ -4828,9 +4828,10 @@ class FactureLigne extends CommonInvoiceLine
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
* *
* @param int $invoiceid Invoice id * @param int $invoiceid Invoice id
* @param bool $include_credit_note Include credit note or not
* @return int >= 0 * @return int >= 0
*/ */
function get_prev_progress($invoiceid) function get_prev_progress($invoiceid, $include_credit_note=true)
{ {
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
return 0; return 0;
@ -4844,7 +4845,26 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) { if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql); $res = $this->db->fetch_array($resql);
return floatval($res['situation_percent']);
$returnPercent = floatval($res['situation_percent']);
if($include_credit_note) {
$sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd';
$sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) ';
$sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id;
$sql.= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed
$sql.= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE;
$res = $this->db->query($sql);
if($res) {
while($obj = $this->db->fetch_object($res)) {
$returnPercent = $returnPercent + floatval($obj->situation_percent);
}
}
}
return $returnPercent;
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->error();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);

View File

@ -84,8 +84,8 @@ class FactureStats extends Stats
$this->where.=" AND f.fk_soc = ".$this->socid; $this->where.=" AND f.fk_soc = ".$this->socid;
} }
if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid; if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid;
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2,5)";
else $this->where.= " AND f.type IN (0,1,2,3)"; else $this->where.= " AND f.type IN (0,1,2,3,5)";
} }

View File

@ -1513,7 +1513,7 @@ else
//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
if (! $object->isMaxNbGenReached()) if (! $object->isMaxNbGenReached())
{ {
if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
} }
else else
{ {

View File

@ -607,7 +607,7 @@ if ($resql)
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>'); print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
if (! $invoicerectmp->isMaxNbGenReached()) if (! $invoicerectmp->isMaxNbGenReached())
{ {
if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); if (! $objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
} }
else else
{ {

View File

@ -464,7 +464,7 @@ if ($search_month > 0)
if ($search_year > 0 && empty($search_day)) if ($search_year > 0 && empty($search_day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
else if ($search_year > 0 && ! empty($search_day)) else if ($search_year > 0 && ! empty($search_day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $serch_year))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
else else
$sql.= " AND date_format(f.datef, '%m') = '".$search_month."'"; $sql.= " AND date_format(f.datef, '%m') = '".$search_month."'";
} }
@ -509,8 +509,9 @@ if (! $sall)
$sql.= ' typent.code,'; $sql.= ' typent.code,';
$sql.= ' state.code_departement, state.nom,'; $sql.= ' state.code_departement, state.nom,';
$sql.= ' country.code,'; $sql.= ' country.code,';
$sql.= " p.rowid, p.ref"; $sql.= " p.rowid, p.ref, p.title";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
{ {
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
@ -574,14 +575,14 @@ if ($resql)
if ($search_zip) $param.='&search_zip='.urlencode($search_zip); if ($search_zip) $param.='&search_zip='.urlencode($search_zip);
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category);
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat);
if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1);
if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2);
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode);
if ($show_files) $param.='&show_files='.urlencode($show_files); if ($show_files) $param.='&show_files='.urlencode($show_files);
if ($option) $param.="&search_option=".urlencode($option); if ($option) $param.="&search_option=".urlencode($option);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
@ -908,6 +909,7 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
$projectstatic=new Project($db); $projectstatic=new Project($db);
$discount = new DiscountAbsolute($db);
if ($num > 0) if ($num > 0)
{ {
@ -922,6 +924,9 @@ if ($resql)
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->total_ttc=$obj->total_ttc;
$facturestatic->paye=$obj->paye;
$facturestatic->fk_soc=$obj->fk_soc;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public; $facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private; $facturestatic->note_private=$obj->note_private;
@ -941,7 +946,12 @@ if ($resql)
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits; $totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay; $remaintopay = $facturestatic->total_ttc - $totalpay;
if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) {
$remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id);
$remaintopay = -$remaincreditnote;
$totalpay = $facturestatic->total_ttc - $remaintopay;
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))

View File

@ -91,7 +91,7 @@ $max=10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,"; $sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref,";
$sql.= " bc.statut, bc.nbcheque,"; $sql.= " bc.statut, bc.nbcheque,";
$sql.= " ba.ref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,"; $sql.= " ba.ref as bref, ba.label, ba.rowid as bid, ba.number, ba.currency_code, ba.account_number, ba.fk_accountancy_journal,";
$sql.= " aj.code"; $sql.= " aj.code";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_journal as aj ON aj.rowid = ba.fk_accountancy_journal";
@ -120,7 +120,7 @@ if ($resql)
$checkdepositstatic->statut=$objp->statut; $checkdepositstatic->statut=$objp->statut;
$accountstatic->id=$objp->bid; $accountstatic->id=$objp->bid;
$accountstatic->ref=$objp->ref; $accountstatic->ref=$objp->bref;
$accountstatic->label=$objp->label; $accountstatic->label=$objp->label;
$accountstatic->number=$objp->number; $accountstatic->number=$objp->number;
$accountstatic->currency_code=$objp->currency_code; $accountstatic->currency_code=$objp->currency_code;

View File

@ -39,7 +39,7 @@ $action=GETPOST('action','aZ09');
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', 'payment'); $result = restrictedArea($user, 'salaries', '', '', '');
$object = new PaymentSalary($db); $object = new PaymentSalary($db);

View File

@ -44,8 +44,9 @@ $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
// Security check // Security check
$socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', $id, ''); $result = restrictedArea($user, 'salaries', '', '', '');
// Get parameters // Get parameters

View File

@ -148,7 +148,7 @@ if ($result)
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
$newcardbutton=''; $newcardbutton='';
if ($user->rights->salaries->payment->write) if (! empty($user->rights->salaries->write))
{ {
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewSalaryPayment').'</span>'; $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/compta/salaries/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewSalaryPayment').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>'; $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';

View File

@ -41,18 +41,6 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', ''); $result = restrictedArea($user, 'salaries', '', '', '');
// Other security check
$childids = $user->getAllChildIds();
$childids[]=$user->id;
if ($userid > 0)
{
if (empty($user->rights->salaries->payment->readall) && ! in_array($userid, $childids))
{
accessforbidden();
exit;
}
}
$nowyear=strftime("%Y", dol_now()); $nowyear=strftime("%Y", dol_now());
$year = GETPOST('year')>0?GETPOST('year'):$nowyear; $year = GETPOST('year')>0?GETPOST('year'):$nowyear;
//$startyear=$year-2; //$startyear=$year-2;
@ -77,11 +65,6 @@ print load_fiche_titre($title, $mesg);
dol_mkdir($dir); dol_mkdir($dir);
$useridtofilter=$userid; // Filter from parameters $useridtofilter=$userid; // Filter from parameters
if (empty($useridtofilter))
{
$useridtofilter=$childids;
if (! empty($user->rights->salaries->payment->readall)) $useridtofilter=0;
}
$stats = new SalariesStats($db, $socid, $useridtofilter); $stats = new SalariesStats($db, $socid, $useridtofilter);

View File

@ -40,7 +40,7 @@ if (! empty($conf->accounting->enabled)) {
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('compta', 'bills')); $langs->loadLangs(array('compta', 'bills', 'banks'));
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$action=GETPOST('action','aZ09'); $action=GETPOST('action','aZ09');

View File

@ -397,7 +397,7 @@ while($j<$numlt)
// Payment Salary // Payment Salary
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read))
{ {
if (! $mode || $mode != 'sconly') if (! $mode || $mode != 'sconly')
{ {

View File

@ -677,6 +677,7 @@ class Contact extends CommonObject
$sql.= " c.photo,"; $sql.= " c.photo,";
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,";
$sql.= " c.import_key,"; $sql.= " c.import_key,";
$sql.= " c.datec as date_creation, c.tms as date_modification,";
$sql.= " co.label as country, co.code as country_code,"; $sql.= " co.label as country, co.code as country_code,";
$sql.= " d.nom as state, d.code_departement as state_code,"; $sql.= " d.nom as state, d.code_departement as state_code,";
$sql.= " u.rowid as user_id, u.login as user_login,"; $sql.= " u.rowid as user_id, u.login as user_login,";
@ -711,6 +712,9 @@ class Contact extends CommonObject
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_departement = $obj->fk_departement; // deprecated $this->fk_departement = $obj->fk_departement; // deprecated
$this->state_id = $obj->fk_departement; $this->state_id = $obj->fk_departement;
$this->departement_code = $obj->state_code; // deprecated $this->departement_code = $obj->state_code; // deprecated
@ -1046,9 +1050,9 @@ class Contact extends CommonObject
function getNbOfEMailings() function getNbOfEMailings()
{ {
$sql = "SELECT count(mc.email) as nb"; $sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; $sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' ";
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -154,7 +154,7 @@ $arrayfields=array(
'p.phone'=>array('label'=>"Phone", 'checked'=>1), 'p.phone'=>array('label'=>"Phone", 'checked'=>1),
'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0), 'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
'p.fax'=>array('label'=>"Fax", 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'checked'=>0),
'p.email'=>array('label'=>"EMail", 'checked'=>1), 'p.email'=>array('label'=>"EMail", 'checked'=>1),
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->skype->enabled))),
'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
@ -307,7 +307,7 @@ if ($search_societe) $sql.= natural_search('s.nom', $search_socie
if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')'; if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')';
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste); if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso); if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone); if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone_pro);
if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile); if (strlen($search_phone_mobile)) $sql.= natural_search('p.phone_mobile', $search_phone_mobile);
if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax);
if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype);
@ -732,7 +732,7 @@ while ($i < min($num,$limit))
// Job position // Job position
if (! empty($arrayfields['p.poste']['checked'])) if (! empty($arrayfields['p.poste']['checked']))
{ {
print '<td>'.dol_trunc($obj->poste,20).'</td>'; print '<td class="tdoverflowmax100">'.$obj->poste.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Zip // Zip

View File

@ -1421,6 +1421,7 @@ else
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {

View File

@ -1045,7 +1045,7 @@ class Contrat extends CommonObject
} }
else else
{ {
$this->error="Failed to add contact"; $this->error="Failed to add contract";
dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;

View File

@ -107,7 +107,6 @@ $fieldstosearchall = array(
'c.ref_customer'=>'RefCustomer', 'c.ref_customer'=>'RefCustomer',
'c.ref_supplier'=>'RefSupplier', 'c.ref_supplier'=>'RefSupplier',
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
'cd.description'=>'Description',
'c.note_public'=>'NotePublic', 'c.note_public'=>'NotePublic',
); );
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
@ -252,7 +251,7 @@ else if ($year > 0)
$sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
} }
if ($search_name) $sql .= natural_search('s.nom', $search_name); if ($search_name) $sql .= natural_search('s.nom', $search_name);
if ($search_email) $sql .= natural_search('s.email', $search_name); if ($search_email) $sql .= natural_search('s.email', $search_email);
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);

View File

@ -1097,6 +1097,18 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
continue; continue;
} }
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
$res = $db->query($sql);
if (!$res)
{
setEventMessage('ErrorRecordParentingNotModified', 'errors');
$error++;
}
}
if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
else $result = $objecttmp->delete($user); else $result = $objecttmp->delete($user);

View File

@ -42,7 +42,7 @@ if (GETPOST('addfile','alpha'))
$vardir=$conf->user->dir_output."/".$user->id; $vardir=$conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid); dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
$action='presend'; $action='presend';
} }

View File

@ -53,6 +53,12 @@ $search_boxvalue=GETPOST('q', 'none');
$arrayresult=array(); $arrayresult=array();
// Define $searchform // Define $searchform
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
{
$arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
}
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
{ {
$arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
@ -63,11 +69,6 @@ if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CON
$arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
} }
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
{
$arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
{ {

View File

@ -75,6 +75,8 @@ class box_factures extends ModeleBoxes
$facturestatic = new Facture($db); $facturestatic = new Facture($db);
$societestatic = new Societe($db); $societestatic = new Societe($db);
$langs->load("bills");
$text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max); $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max);
$this->info_box_head = array( $this->info_box_head = array(
'text' => $text, 'text' => $text,
@ -88,9 +90,7 @@ class box_factures extends ModeleBoxes
$sql.= ", f.total_ttc"; $sql.= ", f.total_ttc";
$sql.= ", f.datef as df"; $sql.= ", f.datef as df";
$sql.= ", f.paye, f.fk_statut, f.datec, f.tms"; $sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
$sql.= ", s.nom as name"; $sql.= ", s.rowid as socid, s.nom as name, s.code_client, s.email, s.tva_intra, s.code_compta, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql.= ", s.rowid as socid";
$sql.= ", s.code_client";
$sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", f.date_lim_reglement as datelimite";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -117,6 +117,7 @@ class box_factures extends ModeleBoxes
$datelimite = $db->jdate($objp->datelimite); $datelimite = $db->jdate($objp->datelimite);
$date = $db->jdate($objp->df); $date = $db->jdate($objp->df);
$datem = $db->jdate($objp->tms); $datem = $db->jdate($objp->tms);
$facturestatic->id = $objp->facid; $facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber; $facturestatic->ref = $objp->facnumber;
$facturestatic->type = $objp->type; $facturestatic->type = $objp->type;
@ -129,7 +130,14 @@ class box_factures extends ModeleBoxes
$societestatic->id = $objp->socid; $societestatic->id = $objp->socid;
$societestatic->name = $objp->name; $societestatic->name = $objp->name;
$societestatic->code_client = $objp->code_client; $societestatic->code_client = $objp->code_client;
$societestatic->tva_intra = $objp->tva_intra;
$societestatic->email = $objp->email;
$societestatic->idprof1 = $objp->idprof1;
$societestatic->idprof2 = $objp->idprof2;
$societestatic->idprof3 = $objp->idprof3;
$societestatic->idprof4 = $objp->idprof4;
$societestatic->idprof5 = $objp->idprof5;
$societestatic->idprof6 = $objp->idprof6;
$late = ''; $late = '';
if ($facturestatic->hasDelay()) { if ($facturestatic->hasDelay()) {

View File

@ -82,7 +82,7 @@ class box_factures_imp extends ModeleBoxes
if ($user->rights->facture->lire) if ($user->rights->facture->lire)
{ {
$sql = "SELECT s.nom as name, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid, s.email,";
$sql.= " s.code_client,"; $sql.= " s.code_client,";
$sql.= " s.logo,"; $sql.= " s.logo,";
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
@ -130,9 +130,11 @@ class box_factures_imp extends ModeleBoxes
$facturestatic->total_ttc = $objp->total_ttc; $facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->statut = $objp->fk_statut; $facturestatic->statut = $objp->fk_statut;
$facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite);
$societestatic->id = $objp->socid; $societestatic->id = $objp->socid;
$societestatic->name = $objp->name; $societestatic->name = $objp->name;
$societestatic->client = 1; $societestatic->client = 1;
$societestatic->email = $objp->email;
$societestatic->code_client = $objp->code_client; $societestatic->code_client = $objp->code_client;
$societestatic->logo = $objp->logo; $societestatic->logo = $objp->logo;

View File

@ -71,6 +71,8 @@ class box_graph_propales_permonth extends ModeleBoxes
//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; //include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
//$propalstatic=new Propal($db); //$propalstatic=new Propal($db);
$langs->load("propal");
$text = $langs->trans("BoxProposalsPerMonth",$max); $text = $langs->trans("BoxProposalsPerMonth",$max);
$this->info_box_head = array( $this->info_box_head = array(
'text' => $text, 'text' => $text,

View File

@ -385,13 +385,17 @@ class CMailFile
// TODO if (! empty($moreinheader)) ... // TODO if (! empty($moreinheader)) ...
// Give the message a subject // Give the message a subject
$this->message->setSubject($this->encodetorfc2822($subject)); try {
$result = $this->message->setSubject($subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Set the From address with an associative array // Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe')); //$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($from)) { if (! empty($from)) {
try { try {
$this->message->setFrom($this->getArrayAddress($from)); $result = $this->message->setFrom($this->getArrayAddress($from));
} catch (Exception $e) { } catch (Exception $e) {
$this->errors[] = $e->getMessage(); $this->errors[] = $e->getMessage();
} }
@ -400,7 +404,7 @@ class CMailFile
// Set the To addresses with an associative array // Set the To addresses with an associative array
if (! empty($to)) { if (! empty($to)) {
try { try {
$this->message->setTo($this->getArrayAddress($to)); $result = $this->message->setTo($this->getArrayAddress($to));
} catch (Exception $e) { } catch (Exception $e) {
$this->errors[] = $e->getMessage(); $this->errors[] = $e->getMessage();
} }
@ -408,13 +412,17 @@ class CMailFile
if (! empty($replyto)) { if (! empty($replyto)) {
try { try {
$this->message->SetReplyTo($this->getArrayAddress($replyto)); $result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
} catch (Exception $e) { } catch (Exception $e) {
$this->errors[] = $e->getMessage(); $this->errors[] = $e->getMessage();
} }
} }
$this->message->setCharSet($conf->file->character_set_client); try {
$result = $this->message->setCharSet($conf->file->character_set_client);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
if (! empty($this->html)) if (! empty($this->html))
{ {

View File

@ -62,7 +62,7 @@ class AntiVir
if (preg_match('/\.virus$/i', $file)) if (preg_match('/\.virus$/i', $file))
{ {
$this->errors='File has an extension saying file is a virus'; $this->errors[] = 'File has an extension saying file is a virus';
return -97; return -97;
} }

View File

@ -596,15 +596,16 @@ abstract class CommonDocGenerator
} }
// Retrieve extrafields // Retrieve extrafields
/*if(is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label('shipment',true); $extralabels = $extrafields->fetch_name_optionals_label('expedition',true);
$object->fetch_optionals(); $object->fetch_optionals();
$array_shipment = $this->fill_substitutionarray_with_extrafields($object,$array_shipment,$extrafields,$array_key,$outputlangs); $array_shipment = $this->fill_substitutionarray_with_extrafields($object,$array_shipment,$extrafields,$array_key,$outputlangs);
}*/ }
return $array_shipment; return $array_shipment;
} }
@ -612,7 +613,7 @@ abstract class CommonDocGenerator
/** /**
* Define array with couple substitution key => substitution value * Define array with couple substitution key => substitution value
* *
* @param array $line Array of lines * @param ExpeditionLigne $line Object line
* @param Translate $outputlangs Lang object to use for output * @param Translate $outputlangs Lang object to use for output
* @return array Substitution array * @return array Substitution array
*/ */
@ -621,7 +622,7 @@ abstract class CommonDocGenerator
global $conf; global $conf;
dol_include_once('/core/lib/product.lib.php'); dol_include_once('/core/lib/product.lib.php');
return array( $resarray = array(
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs), 'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
'line_product_ref'=>$line->product_ref, 'line_product_ref'=>$line->product_ref,
'line_product_label'=>$line->product_label, 'line_product_label'=>$line->product_label,
@ -640,6 +641,18 @@ abstract class CommonDocGenerator
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuring_units_string($line->surface_units, 'surface'), 'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuring_units_string($line->surface_units, 'surface'),
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuring_units_string($line->volume_units, 'volume'), 'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuring_units_string($line->volume_units, 'volume'),
); );
// Retrieve extrafields
$extrafieldkey = $line->element;
$array_key = "line";
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey, true);
$line->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
return $resarray;
} }

View File

@ -46,47 +46,58 @@ abstract class CommonObject
* @var DoliDb Database handler (result of a new DoliDB) * @var DoliDb Database handler (result of a new DoliDB)
*/ */
public $db; public $db;
/** /**
* @var int The object identifier * @var int The object identifier
*/ */
public $id; public $id;
/** /**
* @var string Error string * @var string Error string
* @see errors * @see errors
*/ */
public $error; public $error;
/** /**
* @var string[] Array of error strings * @var string[] Array of error strings
*/ */
public $errors=array(); public $errors=array();
/** /**
* @var string * @var string
*/ */
public $element; public $element;
/** /**
* @var string * @var string
*/ */
public $table_element; public $table_element;
/** /**
* @var * @var
*/ */
public $table_element_line; public $table_element_line;
/** /**
* @var string Key value used to track if data is coming from import wizard * @var string Key value used to track if data is coming from import wizard
*/ */
public $import_key; public $import_key;
/** /**
* @var mixed Contains data to manage extrafields * @var mixed Contains data to manage extrafields
*/ */
public $array_options=array(); public $array_options=array();
/** /**
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked * @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/ */
public $linkedObjectsIds; public $linkedObjectsIds;
/** /**
* @var mixed Array of linked objects. Loaded by ->fetchObjectLinked * @var mixed Array of linked objects. Loaded by ->fetchObjectLinked
*/ */
public $linkedObjects; public $linkedObjects;
/** /**
* @var Object To store a cloned copy of object before to edit it and keep track of old properties * @var Object To store a cloned copy of object before to edit it and keep track of old properties
*/ */
@ -116,11 +127,13 @@ abstract class CommonObject
* @see fetch_projet() * @see fetch_projet()
*/ */
public $project; public $project;
/** /**
* @var int The related project ID * @var int The related project ID
* @see setProject(), project * @see setProject(), project
*/ */
public $fk_project; public $fk_project;
/** /**
* @deprecated * @deprecated
* @see project * @see project
@ -132,6 +145,7 @@ abstract class CommonObject
* @see fetch_contact() * @see fetch_contact()
*/ */
public $contact; public $contact;
/** /**
* @var int The related contact ID * @var int The related contact ID
* @see fetch_contact() * @see fetch_contact()
@ -165,14 +179,17 @@ abstract class CommonObject
* @var string The object's reference * @var string The object's reference
*/ */
public $ref; public $ref;
/** /**
* @var string The object's previous reference * @var string The object's previous reference
*/ */
public $ref_previous; public $ref_previous;
/** /**
* @var string The object's next reference * @var string The object's next reference
*/ */
public $ref_next; public $ref_next;
/** /**
* @var string An external reference for the object * @var string An external reference for the object
*/ */
@ -189,36 +206,43 @@ abstract class CommonObject
* @see getFullAddress() * @see getFullAddress()
*/ */
public $country; public $country;
/** /**
* @var int * @var int
* @see getFullAddress(), country * @see getFullAddress(), country
*/ */
public $country_id; public $country_id;
/** /**
* @var string * @var string
* @see getFullAddress(), isInEEC(), country * @see getFullAddress(), isInEEC(), country
*/ */
public $country_code; public $country_code;
/** /**
* @var string * @var string
* @see getFullAddress() * @see getFullAddress()
*/ */
public $state; public $state;
/** /**
* @var int * @var int
* @see getFullAddress(), state * @see getFullAddress(), state
*/ */
public $state_id; public $state_id;
/** /**
* @var string * @var string
* @see getFullAddress(), state * @see getFullAddress(), state
*/ */
public $state_code; public $state_code;
/** /**
* @var string * @var string
* @see getFullAddress(), region * @see getFullAddress(), region
*/ */
public $region; public $region;
/** /**
* @var string * @var string
* @see getFullAddress(), region * @see getFullAddress(), region
@ -230,16 +254,19 @@ abstract class CommonObject
* @see fetch_barcode() * @see fetch_barcode()
*/ */
public $barcode_type; public $barcode_type;
/** /**
* @var string * @var string
* @see fetch_barcode(), barcode_type * @see fetch_barcode(), barcode_type
*/ */
public $barcode_type_code; public $barcode_type_code;
/** /**
* @var string * @var string
* @see fetch_barcode(), barcode_type * @see fetch_barcode(), barcode_type
*/ */
public $barcode_type_label; public $barcode_type_label;
/** /**
* @var string * @var string
* @see fetch_barcode(), barcode_type * @see fetch_barcode(), barcode_type
@ -257,6 +284,7 @@ abstract class CommonObject
* @see setPaymentTerms() * @see setPaymentTerms()
*/ */
public $cond_reglement_id; public $cond_reglement_id;
/** /**
* @var int Payment terms ID * @var int Payment terms ID
* @deprecated Kept for compatibility * @deprecated Kept for compatibility
@ -294,11 +322,13 @@ abstract class CommonObject
* @see update_note() * @see update_note()
*/ */
public $note_public; public $note_public;
/** /**
* @var string Private note * @var string Private note
* @see update_note() * @see update_note()
*/ */
public $note_private; public $note_private;
/** /**
* @deprecated * @deprecated
* @see note_public * @see note_public
@ -310,21 +340,25 @@ abstract class CommonObject
* @see update_price() * @see update_price()
*/ */
public $total_ht; public $total_ht;
/** /**
* @var float Total VAT amount * @var float Total VAT amount
* @see update_price() * @see update_price()
*/ */
public $total_tva; public $total_tva;
/** /**
* @var float Total local tax 1 amount * @var float Total local tax 1 amount
* @see update_price() * @see update_price()
*/ */
public $total_localtax1; public $total_localtax1;
/** /**
* @var float Total local tax 2 amount * @var float Total local tax 2 amount
* @see update_price() * @see update_price()
*/ */
public $total_localtax2; public $total_localtax2;
/** /**
* @var float Total amount with taxes * @var float Total amount with taxes
* @see update_price() * @see update_price()
@ -347,11 +381,13 @@ abstract class CommonObject
* @see setIncoterms() * @see setIncoterms()
*/ */
public $fk_incoterms; public $fk_incoterms;
/** /**
* @var string * @var string
* @see SetIncoterms() * @see SetIncoterms()
*/ */
public $libelle_incoterms; public $libelle_incoterms;
/** /**
* @var string * @var string
* @see display_incoterms() * @see display_incoterms()
@ -1115,8 +1151,8 @@ abstract class CommonObject
$sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE ec.element_id = ".$id; $sql.= " WHERE ec.element_id = ".$id;
$sql.= " AND ec.fk_socpeople = c.rowid"; $sql.= " AND ec.fk_socpeople = c.rowid";
if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")"; if ($source == 'internal') $sql.= " AND c.entity IN (".getEntity('user').")";
if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('socpeople').")"; if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe').")";
$sql.= " AND ec.fk_c_type_contact = tc.rowid"; $sql.= " AND ec.fk_c_type_contact = tc.rowid";
$sql.= " AND tc.element = '".$element."'"; $sql.= " AND tc.element = '".$element."'";
$sql.= " AND tc.source = '".$source."'"; $sql.= " AND tc.source = '".$source."'";
@ -2812,6 +2848,7 @@ abstract class CommonObject
// Special case // Special case
if ($origin == 'order') $origin='commande'; if ($origin == 'order') $origin='commande';
if ($origin == 'invoice') $origin='facture'; if ($origin == 'invoice') $origin='facture';
if ($origin == 'invoice_template') $origin='facturerec';
$this->db->begin(); $this->db->begin();
@ -3730,6 +3767,7 @@ abstract class CommonObject
$reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) if (empty($reshook))
{ {
// Title line
print "<thead>\n"; print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
@ -3821,7 +3859,6 @@ abstract class CommonObject
//Line extrafield //Line extrafield
$line->fetch_optionals(); $line->fetch_optionals();
//if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) //if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
if (is_object($hookmanager)) // Old code is commented on preceding line. if (is_object($hookmanager)) // Old code is commented on preceding line.
{ {
@ -4690,6 +4727,7 @@ abstract class CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->array_options = array();
$numrows=$this->db->num_rows($resql); $numrows=$this->db->num_rows($resql);
if ($numrows) if ($numrows)
{ {
@ -4815,6 +4853,9 @@ abstract class CommonObject
} }
} }
//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
switch ($attributeType) switch ($attributeType)
{ {
case 'int': case 'int':
@ -4828,6 +4869,21 @@ abstract class CommonObject
$new_array_options[$key] = null; $new_array_options[$key] = null;
} }
break; break;
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value!='')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value=='')
{
$new_array_options[$key] = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$new_array_options[$key] = $value;
break;
/*case 'select': // Not required, we chosed value='0' for undefined values /*case 'select': // Not required, we chosed value='0' for undefined values
if ($value=='-1') if ($value=='-1')
{ {
@ -5022,6 +5078,9 @@ abstract class CommonObject
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key];
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key];
//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
switch ($attributeType) switch ($attributeType)
{ {
case 'int': case 'int':
@ -5035,6 +5094,21 @@ abstract class CommonObject
$this->array_options["options_".$key] = null; $this->array_options["options_".$key] = null;
} }
break; break;
case 'double':
$value = price2num($value);
if (!is_numeric($value) && $value!='')
{
dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
return -1;
}
elseif ($value=='')
{
$this->array_options["options_".$key] = null;
}
//dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG);
$this->array_options["options_".$key] = $value;
break;
/*case 'select': // Not required, we chosed value='0' for undefined values /*case 'select': // Not required, we chosed value='0' for undefined values
if ($value=='-1') if ($value=='-1')
{ {

View File

@ -44,7 +44,7 @@ class Conf
//! To store if javascript/ajax is enabked //! To store if javascript/ajax is enabked
public $use_javascript_ajax; public $use_javascript_ajax;
//! Used to store current currency //! Used to store current currency (ISO code like 'USD', 'EUR', ...)
public $currency; public $currency;
//! Used to store current css (from theme) //! Used to store current css (from theme)
public $theme; // Contains current theme ("eldy", "auguria", ...) public $theme; // Contains current theme ("eldy", "auguria", ...)
@ -519,6 +519,9 @@ class Conf
// By default, we open card if one found // By default, we open card if one found
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1; if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;
// By default, we show state code in combo list
if (! isset($this->global->MAIN_SHOW_STATE_CODE)) $this->global->MAIN_SHOW_STATE_CODE=1;
// Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal" // Define list of limited modules (value must be key found for "name" property of module, so for example 'supplierproposal' for Module "Supplier Proposal"
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later. if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplierproposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent,blockedlog'; // '' means 'all'. Note that contact is added here as it should be a module later.
if (! empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list if (! empty($this->modules_parts['moduleforexternal'])) // Module part to include an external module into the MAIN_MODULES_FOR_EXTERNAL list

View File

@ -108,7 +108,7 @@ class DiscountAbsolute
$this->amount_tva = $obj->amount_tva; $this->amount_tva = $obj->amount_tva;
$this->amount_ttc = $obj->amount_ttc; $this->amount_ttc = $obj->amount_ttc;
$this->multicurrency_amount_ht = $obj->multicurrency_amount_ht; $this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
$this->multicurrency_amount_tva = $obj->multicurrency_amount_tva; $this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
$this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc; $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
@ -156,8 +156,17 @@ class DiscountAbsolute
$this->amount_ht=price2num($this->amount_ht); $this->amount_ht=price2num($this->amount_ht);
$this->amount_tva=price2num($this->amount_tva); $this->amount_tva=price2num($this->amount_tva);
$this->amount_ttc=price2num($this->amount_ttc); $this->amount_ttc=price2num($this->amount_ttc);
$this->tva_tx=price2num($this->tva_tx); $this->tva_tx=price2num($this->tva_tx);
$this->multicurrency_amount_ht=price2num($this->multicurrency_amount_ht);
$this->multicurrency_amount_tva=price2num($this->multicurrency_amount_tva);
$this->multicurrency_amount_ttc=price2num($this->multicurrency_amount_ttc);
if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht=0;
if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva=0;
if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc=0;
// Check parameters // Check parameters
if (empty($this->description)) if (empty($this->description))
{ {
@ -170,10 +179,12 @@ class DiscountAbsolute
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except";
$sql.= " (entity, datec, fk_soc, discount_type, fk_user, description,"; $sql.= " (entity, datec, fk_soc, discount_type, fk_user, description,";
$sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,"; $sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,";
$sql.= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,";
$sql.= " fk_facture_source, fk_invoice_supplier_source"; $sql.= " fk_facture_source, fk_invoice_supplier_source";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$user->id.", '".$this->db->escape($this->description)."',"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$user->id.", '".$this->db->escape($this->description)."',";
$sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.",";
$sql.= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", ";
$sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").","; $sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").",";
$sql.= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'":"null"); $sql.= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'":"null");
$sql.= ")"; $sql.= ")";

View File

@ -924,7 +924,7 @@ class DolGraph
var percent=Math.round(series.percent); var percent=Math.round(series.percent);
var number=series.data[0][1]; var number=series.data[0][1];
return \''; return \'';
$this->stringtoshow.='<div style="font-size:8pt;text-align:center;padding:2px;color:black;">'; $this->stringtoshow.='<span style="font-size:8pt;text-align:center;padding:2px;color:black;">';
if ($urltemp) $this->stringtoshow.='<a style="color: #FFFFFF;" border="0" href="'.$urltemp.'">'; if ($urltemp) $this->stringtoshow.='<a style="color: #FFFFFF;" border="0" href="'.$urltemp.'">';
$this->stringtoshow.='\'+'; $this->stringtoshow.='\'+';
$this->stringtoshow.=($showlegend?'':'label+\' \'+'); // Hide label if already shown in legend $this->stringtoshow.=($showlegend?'':'label+\' \'+'); // Hide label if already shown in legend
@ -932,7 +932,7 @@ class DolGraph
$this->stringtoshow.=($showpercent?'\'<br/>\'+percent+\'%\'+':''); $this->stringtoshow.=($showpercent?'\'<br/>\'+percent+\'%\'+':'');
$this->stringtoshow.='\''; $this->stringtoshow.='\'';
if ($urltemp) $this->stringtoshow.='</a>'; if ($urltemp) $this->stringtoshow.='</a>';
$this->stringtoshow.='</div>\'; $this->stringtoshow.='</span>\';
}, },
background: { background: {
opacity: 0.0, opacity: 0.0,

View File

@ -657,11 +657,22 @@ class ExtraFields
$params=''; $params='';
} }
if ($entity === '' || $entity != '0')
{
// We dont want on all entities, we delete all and current
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
$sql_del.= " WHERE name = '".$attrname."'"; $sql_del.= " WHERE name = '".$attrname."'";
$sql_del.= " AND entity = ".($entity===''?$conf->entity:$entity); $sql_del.= " AND entity IN (0, ".($entity===''?$conf->entity:$entity).")";
$sql_del.= " AND elementtype = '".$elementtype."'"; $sql_del.= " AND elementtype = '".$elementtype."'";
}
else
{
// We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity)
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields";
$sql_del.= " WHERE name = '".$attrname."'";
$sql_del.= " AND entity = 0";
$sql_del.= " AND elementtype = '".$elementtype."'";
}
$resql1=$this->db->query($sql_del); $resql1=$this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(";
@ -1836,12 +1847,17 @@ class ExtraFields
if (empty($enabled)) continue; if (empty($enabled)) continue;
if (empty($perms)) continue; if (empty($perms)) continue;
if ($this->attributes[$object->table_element]['required'][$key] && empty($_POST["options_".$key])) // Check if empty without GETPOST, value can be alpha, int, array, etc... if ($this->attributes[$object->table_element]['required'][$key]) // Value is required
{
// Check if empty without using GETPOST, value can be alpha, int, array, etc...
if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key])))
{ {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
$nofillrequired++; $nofillrequired++;
$error_field_required[] = $langs->transnoentitiesnoconv($value); $error_field_required[] = $langs->transnoentitiesnoconv($value);
} }
}
if (in_array($key_type,array('date'))) if (in_array($key_type,array('date')))
{ {

View File

@ -1110,8 +1110,9 @@ class Form
if (count($scrit) > 1) $sql.=")"; if (count($scrit) > 1) $sql.=")";
if (! empty($conf->barcode->enabled)) if (! empty($conf->barcode->enabled))
{ {
$sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'"; $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
} }
$sql.= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
$sql.=")"; $sql.=")";
} }
$sql.=$this->db->order("nom","ASC"); $sql.=$this->db->order("nom","ASC");
@ -2970,7 +2971,10 @@ class Form
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label=($langs->trans("DemandReasonType".$obj->code)!=("DemandReasonType".$obj->code)?$langs->trans("DemandReasonType".$obj->code):($obj->label!='-'?$obj->label:'')); $label=($obj->label!='-'?$obj->label:'');
if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code)) $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
if ($langs->trans($obj->code) != $obj->code) $label=$langs->trans($obj->code); // So translation key SRC_XXX will work
$tmparray[$obj->rowid]['id'] =$obj->rowid; $tmparray[$obj->rowid]['id'] =$obj->rowid;
$tmparray[$obj->rowid]['code'] =$obj->code; $tmparray[$obj->rowid]['code'] =$obj->code;
$tmparray[$obj->rowid]['label']=$label; $tmparray[$obj->rowid]['label']=$label;
@ -3019,7 +3023,8 @@ class Form
{ {
print '<option value="'.$arraydemandreason['id'].'">'; print '<option value="'.$arraydemandreason['id'].'">';
} }
print $arraydemandreason['label']; $label=$arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
print $langs->trans($label);
print '</option>'; print '</option>';
} }
print '</select>'; print '</select>';
@ -3335,7 +3340,7 @@ class Form
if ($obj->situation_final != 1) { if ($obj->situation_final != 1) {
//Not prov? //Not prov?
if (substr($obj->facnumber, 1, 4) != 'PROV') { if (substr($obj->facnumber, 1, 4) != 'PROV') {
if ($selected == $obj->situation_final) { if ($selected == $obj->rowid) {
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>'; $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>';
} else { } else {
$opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>'; $opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>';
@ -3630,7 +3635,7 @@ class Form
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section. * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section.
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form
*/ */
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=200, $width=500, $disableformtag=0) function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=210, $width=500, $disableformtag=0)
{ {
global $langs,$conf; global $langs,$conf;
global $useglobalvars; global $useglobalvars;
@ -4710,6 +4715,10 @@ class Form
$tmpthirdparty=new Societe($this->db); $tmpthirdparty=new Societe($this->db);
$defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
$defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod);
if (preg_match('/\((.*)\)/', $defaulttx, $reg)) {
$defaultcode=$reg[1];
$defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx);
}
if (empty($defaulttx)) $defaultnpr=0; if (empty($defaulttx)) $defaultnpr=0;
} }
@ -6193,6 +6202,7 @@ class Form
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'), 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
@ -6255,8 +6265,7 @@ class Form
{ {
$objp = $this->db->fetch_object($resqllist); $objp = $this->db->fetch_object($resqllist);
$var = ! $var; print '<tr class="oddeven">';
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">'; print '<td aling="left">';
print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>'; print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
print '</td>'; print '</td>';

View File

@ -122,11 +122,12 @@ class FormFile
if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb // Now $max and $maxphp are in Kb
if ($maxphp > 0) $max=min($max,$maxphp); $maxmin = $max;
if ($maxphp > 0) $maxmin=min($max,$maxphp);
if ($max > 0) if ($maxmin > 0)
{ {
$out .= '<input type="hidden" name="max_file_size" value="'.($max*1024).'">'; $out .= '<input type="hidden" name="max_file_size" value="'.($maxmin*1024).'">';
} }
$out .= '<input class="flat minwidth400" type="file"'; $out .= '<input class="flat minwidth400" type="file"';
@ -179,7 +180,7 @@ class FormFile
if ($linkfiles) if ($linkfiles)
{ {
$out .= "\n<!-- Start form attach new link -->\n"; $out .= "\n<!-- Start form link new url -->\n";
$langs->load('link'); $langs->load('link');
$title = $langs->trans("LinkANewFile"); $title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null); $out .= load_fiche_titre($title, null, null);
@ -207,19 +208,18 @@ class FormFile
$out .= '</div>'; $out .= '</div>';
$out .= '<div class="clearboth"></div>'; $out .= '<div class="clearboth"></div>';
$out .= '</form><br>'; $out .= '</form><br>';
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
$out .= "\n<!-- End form attach new file -->\n"; $out .= "\n<!-- End form link new url -->\n";
} }
$parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm);
$res = $hookmanager->executeHooks('formattachOptions',$parameters,$object);
if (empty($res)) if (empty($res))
{ {
print '<div class="attacharea attacharea'.$htmlname.'">'; print '<div class="attacharea attacharea'.$htmlname.'">';
print $out; print $out;
print '</div>'; print '</div>';
} }
print $hookmanager->resPrint; print $hookmanager->resPrint;
return 1; return 1;

View File

@ -939,6 +939,7 @@ class FormMail extends Form
if (count($validpaymentmethod) > 0 && $paymenturl) if (count($validpaymentmethod) > 0 && $paymenturl)
{ {
$langs->load('other');
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
} }

View File

@ -368,6 +368,7 @@ class Notify
{ {
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($obj->default_lang); $outputlangs->setDefaultLang($obj->default_lang);
$outputlangs->loadLangs(array("main","other"));
} }
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification"); $subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification");
@ -377,72 +378,72 @@ class Notify
$link='/compta/facture/card.php?facid='.$object->id; $link='/compta/facture/card.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'facture'; $object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated",$newref);
break; break;
case 'BILL_PAYED': case 'BILL_PAYED':
$link='/compta/facture/card.php?facid='.$object->id; $link='/compta/facture/card.php?facid='.$object->id;
$dir_output = $conf->facture->dir_output; $dir_output = $conf->facture->dir_output;
$object_type = 'facture'; $object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed",$newref);
break; break;
case 'ORDER_VALIDATE': case 'ORDER_VALIDATE':
$link='/commande/card.php?id='.$object->id; $link='/commande/card.php?id='.$object->id;
$dir_output = $conf->commande->dir_output; $dir_output = $conf->commande->dir_output;
$object_type = 'order'; $object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated",$newref);
break; break;
case 'PROPAL_VALIDATE': case 'PROPAL_VALIDATE':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->multidir_output[$object->entity]; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated",$newref);
break; break;
case 'PROPAL_CLOSE_SIGNED': case 'PROPAL_CLOSE_SIGNED':
$link='/comm/propal/card.php?id='.$object->id; $link='/comm/propal/card.php?id='.$object->id;
$dir_output = $conf->propal->multidir_output[$object->entity]; $dir_output = $conf->propal->multidir_output[$object->entity];
$object_type = 'propal'; $object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned",$newref);
break; break;
case 'FICHINTER_ADD_CONTACT': case 'FICHINTER_ADD_CONTACT':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->ficheinter->dir_output; $dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$newref);
break; break;
case 'FICHINTER_VALIDATE': case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id; $link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->ficheinter->dir_output; $dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter'; $object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated",$newref);
break; break;
case 'ORDER_SUPPLIER_VALIDATE': case 'ORDER_SUPPLIER_VALIDATE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->commande->dir_output; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$object->ref,$user->getFullName($langs)); $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'ORDER_SUPPLIER_APPROVE': case 'ORDER_SUPPLIER_APPROVE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->commande->dir_output; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs)); $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'ORDER_SUPPLIER_REFUSE': case 'ORDER_SUPPLIER_REFUSE':
$link='/fourn/commande/card.php?id='.$object->id; $link='/fourn/commande/card.php?id='.$object->id;
$dir_output = $conf->fournisseur->commande->dir_output; $dir_output = $conf->fournisseur->commande->dir_output;
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n"; $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs)); $mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$newref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n"; $mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
break; break;
case 'SHIPPING_VALIDATE': case 'SHIPPING_VALIDATE':
$dir_output = $conf->expedition->dir_output.'/sending/'; $dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier'; $object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref); $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref);
break; break;
} }
$ref = dol_sanitizeFileName($newref); $ref = dol_sanitizeFileName($newref);
@ -651,6 +652,8 @@ class Notify
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n"; $message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2",$application,$mysoc->name)."\n";
$message.= "\n"; $message.= "\n";
$message.= $mesg; $message.= $mesg;
//if ($link) $message.= "\n" . $urlwithroot . $link; // link already added around the ref into the text
$message = nl2br($message); $message = nl2br($message);
// Replace keyword __SUPERVISOREMAIL__ // Replace keyword __SUPERVISOREMAIL__

View File

@ -749,7 +749,7 @@ function xml2php($xml)
} }
//Let see if the new child is not in the array //Let see if the new child is not in the array
if($tab==false && in_array($key,array_keys($array))) if($tab === false && in_array($key,array_keys($array)))
{ {
//If this element is already in the array we will create an indexed array //If this element is already in the array we will create an indexed array
$tmp = $array[$key]; $tmp = $array[$key];
@ -758,7 +758,7 @@ function xml2php($xml)
$array[$key][] = $child; $array[$key][] = $child;
$tab = true; $tab = true;
} }
elseif($tab == true) elseif($tab === true)
{ {
//Add an element in an existing array //Add an element in an existing array
$array[$key][] = $child; $array[$key][] = $child;

View File

@ -176,14 +176,14 @@ class Utils
* @param int $usedefault 1=Use default backup profile (Set this to 1 when used as cron) * @param int $usedefault 1=Use default backup profile (Set this to 1 when used as cron)
* @param string $file 'auto' or filename to build * @param string $file 'auto' or filename to build
* @param int $keeplastnfiles Keep only last n files (not used yet) * @param int $keeplastnfiles Keep only last n files (not used yet)
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/ */
function dumpDatabase($compression='none', $type='auto', $usedefault=1, $file='auto', $keeplastnfiles=0) function dumpDatabase($compression='none', $type='auto', $usedefault=1, $file='auto', $keeplastnfiles=0, $execmethod=0)
{ {
global $db, $conf, $langs, $dolibarr_main_data_root; global $db, $conf, $langs, $dolibarr_main_data_root;
global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass; global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
$langs->load("admin"); $langs->load("admin");
dol_syslog("Utils::dumpDatabase type=".$type." compression=".$compression." file=".$file, LOG_DEBUG); dol_syslog("Utils::dumpDatabase type=".$type." compression=".$compression." file=".$file, LOG_DEBUG);
@ -291,8 +291,41 @@ class Utils
if ($handle) if ($handle)
{ {
if (! empty($conf->global->MAIN_EXEC_USE_POPEN)) $execmethod=$conf->global->MAIN_EXEC_USE_POPEN;
if (empty($execmethod)) $execmethod=1;
$ok=0; $ok=0;
dol_syslog("Run command ".$fullcommandcrypted); dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_DEBUG);
// TODO Replace with executeCLI function
if ($execmethod == 1)
{
exec($fullcommandclear, $readt, $retval);
$result = $retval;
if ($retval != 0)
{
$langs->load("errors");
dol_syslog("Datadump retval after exec=".$retval, LOG_ERR);
$error = 'Error '.$retval;
$ok=0;
}
else
{
$i=0;
if (!empty($readt))
foreach($readt as $key=>$read)
{
$i++; // output line number
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
fwrite($handle, $read.($execmethod == 2 ? '' : "\n"));
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;
}
}
}
if ($execmethod == 2) // With this method, there is no way to get the return code, only output
{
$handlein = popen($fullcommandclear, 'r'); $handlein = popen($fullcommandclear, 'r');
$i=0; $i=0;
while (!feof($handlein)) while (!feof($handlein))
@ -307,6 +340,9 @@ class Utils
} }
pclose($handlein); pclose($handlein);
}
if ($compression == 'none') fclose($handle); if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle); if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle); if ($compression == 'bz') bzclose($handle);
@ -370,13 +406,13 @@ class Utils
if ($compression == 'gz' or $compression == 'bz') if ($compression == 'gz' or $compression == 'bz')
{ {
backup_tables($outputfiletemp); $this->backup_tables($outputfiletemp);
dol_compress_file($outputfiletemp, $outputfile, $compression); dol_compress_file($outputfiletemp, $outputfile, $compression);
unlink($outputfiletemp); unlink($outputfiletemp);
} }
else else
{ {
backup_tables($outputfile); $this->backup_tables($outputfile);
} }
$this->output = ""; $this->output = "";
@ -782,4 +818,175 @@ class Utils
$this->output = 'Archive log files (keeping last SYSLOG_FILE_SAVES='.$nbSaves.' files) done.'; $this->output = 'Archive log files (keeping last SYSLOG_FILE_SAVES='.$nbSaves.' files) done.';
return 0; return 0;
} }
/** Backup the db OR just a table without mysqldump binary, with PHP only (does not require any exec permission)
* Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php)
* Updated and enhanced by Stephen Larroque (lrq3000) and by the many commentators from the blog
* Note about foreign keys constraints: for Dolibarr, since there are a lot of constraints and when imported the tables will be inserted in the dumped order, not in constraints order, then we ABSOLUTELY need to use SET FOREIGN_KEY_CHECKS=0; when importing the sql dump.
* Note2: db2SQL by Howard Yeend can be an alternative, by using SHOW FIELDS FROM and SHOW KEYS FROM we could generate a more precise dump (eg: by getting the type of the field and then precisely outputting the right formatting - in quotes, numeric or null - instead of trying to guess like we are doing now).
*
* @param string $outputfile Output file name
* @param string $tables Table name or '*' for all
* @return int <0 if KO, >0 if OK
*/
function backup_tables($outputfile, $tables='*')
{
global $db, $langs;
global $errormsg;
// Set to UTF-8
if (is_a($db, 'DoliDBMysqli')) {
/** @var DoliDBMysqli $db */
$db->db->set_charset('utf8');
} else {
/** @var DoliDB $db */
$db->query('SET NAMES utf8');
$db->query('SET CHARACTER SET utf8');
}
//get all of the tables
if ($tables == '*')
{
$tables = array();
$result = $db->query('SHOW FULL TABLES WHERE Table_type = \'BASE TABLE\'');
while($row = $db->fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
$handle = fopen($outputfile, 'w+');
if (fwrite($handle, '') === false)
{
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
return -1;
}
// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".$db::LABEL." dump via php with Dolibarr ".DOL_VERSION."
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------
-- Server version ".$db->db->server_info."
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
";
if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n";
//$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n";
if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n";
fwrite($handle, $sqlhead);
$ignore = '';
if (GETPOST("nobin_sql_ignore")) $ignore = 'IGNORE ';
$delayed = '';
if (GETPOST("nobin_delayed")) $delayed = 'DELAYED ';
// Process each table and print their definition + their datas
foreach($tables as $table)
{
// Saving the table structure
fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n");
if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it
fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
$row2 = $db->fetch_row($resqldrop);
if (empty($row2[1]))
{
fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n");
}
else
{
fwrite($handle,$row2[1].";\n");
//fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
// Dumping the data (locking the table and disabling the keys check while doing the process)
fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n");
if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back)
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n");
else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
$sql='SELECT * FROM '.$table;
$result = $db->query($sql);
while($row = $db->fetch_row($result))
{
// For each row of data we print a line of INSERT
fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES (');
$columns = count($row);
for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null && !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL';
} elseif(is_string($row[$j]) && $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
} elseif(is_numeric($row[$j]) && !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
// if it's a number, we return it as-is
// $row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
$row[$j] = "'".$row[$j]."'";
}
}
fwrite($handle,implode(',', $row).");\n");
}
if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking
if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table
fwrite($handle,"\n\n\n");
}
}
/* Backup Procedure structure*/
/*
$result = $db->query('SHOW PROCEDURE STATUS');
if ($db->num_rows($result) > 0)
{
while ($row = $db->fetch_row($result)) { $procedures[] = $row[1]; }
foreach($procedures as $proc)
{
fwrite($handle,"DELIMITER $$\n\n");
fwrite($handle,"DROP PROCEDURE IF EXISTS '$name'.'$proc'$$\n");
$resqlcreateproc=$db->query("SHOW CREATE PROCEDURE '$proc'");
$row2 = $db->fetch_row($resqlcreateproc);
fwrite($handle,"\n".$row2[2]."$$\n\n");
fwrite($handle,"DELIMITER ;\n\n");
}
}
*/
/* Backup Procedure structure*/
// Write the footer (restore the previous database settings)
$sqlfooter="\n\n";
if (GETPOST("nobin_use_transaction")) $sqlfooter .= "COMMIT;\n";
if (GETPOST("nobin_disable_fk")) $sqlfooter .= "SET FOREIGN_KEY_CHECKS=1;\n";
$sqlfooter.="\n\n-- Dump completed on ".date('Y-m-d G-i-s');
fwrite($handle, $sqlfooter);
fclose($handle);
return 1;
}
} }

View File

@ -121,9 +121,10 @@ function versiondolibarrarray()
* @param int $usesavepoint 1=Run a savepoint before each request and a rollback to savepoint if error (this allow to have some request with errors inside global transactions). * @param int $usesavepoint 1=Run a savepoint before each request and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* @param string $handler Handler targeted for menu * @param string $handler Handler targeted for menu
* @param string $okerror Family of errors we accept ('default', 'none') * @param string $okerror Family of errors we accept ('default', 'none')
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$okerror='default') function run_sql($sqlfile, $silent=1, $entity='', $usesavepoint=1, $handler='', $okerror='default', $offsetforchartofaccount=0)
{ {
global $db, $conf, $langs, $user; global $db, $conf, $langs, $user;
@ -253,6 +254,18 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
$arraysql[$i]=$newsql; $arraysql[$i]=$newsql;
} }
if ($offsetforchartofaccount > 0)
{
// Replace lines
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
// with
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
//var_dump($newsql);
$arraysql[$i] = $newsql;
}
} }
// Loop on each request to execute request // Loop on each request to execute request
@ -1706,7 +1719,7 @@ function email_admin_prepare_head()
} }
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates"); $head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates'; $head[$h][2] = 'templates';
$h++; $h++;

View File

@ -131,7 +131,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px;">'; print '<td class="nowrap" style="padding-bottom: 2px;">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap" style="padding-bottom: 2px;">'; print '</td><td class="nowrap" style="padding-bottom: 2px;">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0); print $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -1303,6 +1303,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
global $param; global $param;
dol_include_once('/comm/action/class/actioncomm.class.php');
// Check parameters // Check parameters
if (! is_object($filterobj) && ! is_object($objcon)) dol_print_error('','BadParameter'); if (! is_object($filterobj) && ! is_object($objcon)) dol_print_error('','BadParameter');
@ -1351,6 +1353,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
//TODO check how ot work with new table actioncomm_resources and multiple contact affectation
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id; if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
// Condition on actioncode // Condition on actioncode
if (! empty($actioncode)) if (! empty($actioncode))
@ -1387,6 +1390,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$contactaction = new ActionComm($db);
$contactaction->id=$obj->id;
$result = $contactaction->fetchResources();
if ($result<0) {
dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource",'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; //if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone=''; $tododone='';
@ -1408,6 +1419,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
'userphoto'=>$obj->user_photo, 'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact, 'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname, 'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname, 'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element, 'fk_element'=>$obj->fk_element,
@ -1485,12 +1497,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
{ {
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$formactions=new FormActions($db); $formactions=new FormActions($db);
@ -1560,7 +1573,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder);
$out.=getTitleFieldOfList(''); $out.=getTitleFieldOfList('');
$out.=getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], 'a.fk_contact', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
$out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); $out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
$out.='</tr>'; $out.='</tr>';
@ -1714,9 +1727,27 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$contactstatic->firstname=$histo[$key]['firstname']; $contactstatic->firstname=$histo[$key]['firstname'];
$contactstatic->id=$histo[$key]['contact_id']; $contactstatic->id=$histo[$key]['contact_id'];
$out.='<td width="120">'.$contactstatic->getNomUrl(1,'',10).'</td>'; $out.='<td width="120">'.$contactstatic->getNomUrl(1,'',10).'</td>';
} elseif (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$out .= '<td>';
foreach ( $histo[$key]['socpeopleassigned'] as $cid => $Tab ) {
$contact = new Contact($db);
$result = $contact->fetch($cid);
if ($result < 0)
dol_print_error($db, $contact->error);
if ($result > 0) {
$out .= $contact->getNomUrl(1);
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (! empty($contact->phone_pro))
$out .= '(' . dol_print_phone($contact->phone_pro) . ')';
} }
else $out .= '<div class="paddingright"></div>';
{ }
}
$out .= '</td>';
}
else {
$out.='<td>&nbsp;</td>'; $out.='<td>&nbsp;</td>';
} }

View File

@ -573,6 +573,8 @@ function dol_get_first_day_week($day,$month,$year,$gm=false)
*/ */
function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $lastday=0) function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $lastday=0)
{ {
global $conf;
$nbFerie = 0; $nbFerie = 0;
// Check to ensure we use correct parameters // Check to ensure we use correct parameters
@ -588,6 +590,26 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR', $
$jour = date("d", $timestampStart); $jour = date("d", $timestampStart);
$mois = date("m", $timestampStart); $mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart); $annee = date("Y", $timestampStart);
// Check into var $conf->global->HOLIDAY_MORE_DAYS MM-DD,YYYY-MM-DD, ...
if (! empty($conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS))
{
$arrayofdaystring=explode(',',$conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS);
foreach($arrayofdaystring as $daystring)
{
$tmp=explode('-',$daystring);
if ($tmp[2])
{
if ($tmp[0] == $annee && $tmp[1] == $mois && $tmp[2] == $jour) $ferie=true;
}
else
{
if ($tmp[0] == $mois && $tmp[1] == $jour) $ferie=true;
}
}
}
if ($countrycode == 'FR') if ($countrycode == 'FR')
{ {
$countryfound=1; $countryfound=1;

View File

@ -2496,7 +2496,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
// Wrapping pour les propales // Wrapping pour les propales
else if ($modulepart == 'propal' && !empty($conf->propal->multidir_output[$entity])) else if (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity]))
{ {
if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i',$original_file))
{ {

View File

@ -13,6 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -4137,13 +4138,13 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi
* @param string $morehtmlright Added message to show on right * @param string $morehtmlright Added message to show on right
* @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param string $picto Icon to use before title (should be a 32x32 transparent png file)
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param int $id To force an id on html objects * @param string $id To force an id on html objects
* @param string $morecssontable More css on table * @param string $morecssontable More css on table
* @param string $morehtmlcenter Added message to show on center * @param string $morehtmlcenter Added message to show on center
* @return string * @return string
* @see print_barre_liste * @see print_barre_liste
*/ */
function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='') function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
{ {
global $conf; global $conf;
@ -4153,7 +4154,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
$return.= "\n"; $return.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>'; $return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>';
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle" id="pictotitle"', $pictoisfullpath).'</td>'; if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
$return.= '<td class="nobordernopadding" valign="middle">'; $return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>'; $return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>'; $return.= '</td>';
@ -4955,7 +4956,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
* *
* @param int $idprod Id of product or 0 if not a predefined product * @param int $idprod Id of product or 0 if not a predefined product
* @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...)
* @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice) * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" proposal/order/invoice)
* @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)' * @return float|string Vat rate to use with format 5.0 or '5.0 (XXX)'
* @see get_product_localtax_for_country * @see get_product_localtax_for_country
*/ */
@ -4976,7 +4977,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
if ($mysoc->country_code == $thirdparty_seller->country_code) // If selling country is ours if ($mysoc->country_code == $thirdparty_seller->country_code) // If selling country is ours
{ {
if ($idprodfournprice > 0) // We want vat for product for a "supplier" order or invoice if ($idprodfournprice > 0) // We want vat for product for a "supplier" object
{ {
$product->get_buyprice($idprodfournprice,0,0,0); $product->get_buyprice($idprodfournprice,0,0,0);
$ret=$product->vatrate_supplier; $ret=$product->vatrate_supplier;
@ -5001,7 +5002,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS))
{ {
// If vat of product for the country not found or not defined, we return the first higher vat of country. // If vat of product for the country not found or not defined, we return the first higher vat of country.
$sql = "SELECT taux as vat_rate"; $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; $sql.= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
$sql.= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC"; $sql.= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC";
@ -5014,6 +5015,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr
if ($obj) if ($obj)
{ {
$ret=$obj->vat_rate; $ret=$obj->vat_rate;
if ($obj->default_vat_code) $ret.=' ('.$obj->default_vat_code.')';
} }
$db->free($sql); $db->free($sql);
} }
@ -5175,6 +5177,12 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
} }
} }
// Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle
if (! empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany())
{
return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice);
}
// Sinon la TVA proposee par defaut=0. Fin de regle. // Sinon la TVA proposee par defaut=0. Fin de regle.
// Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe // Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe
//print 'VATRULE 5'; //print 'VATRULE 5';
@ -5914,7 +5922,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_ZIP__' => $mysoc->zip, '__MYCOMPANY_ZIP__' => $mysoc->zip,
'__MYCOMPANY_TOWN__' => $mysoc->town, '__MYCOMPANY_TOWN__' => $mysoc->town,
'__MYCOMPANY_COUNTRY__' => $mysoc->country, '__MYCOMPANY_COUNTRY__' => $mysoc->country,
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id,
'__MYCOMPANY_CURRENCY_CODE__' => $conf->currency
)); ));
} }
@ -5930,6 +5939,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__'; $substitutionarray['__THIRDPARTY_ID__'] = '__THIRDPARTY_ID__';
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__'; $substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = '__THIRDPARTY_NAME_ALIAS__';
$substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__'; $substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__';
if (is_object($object) && $object->element == 'member') if (is_object($object) && $object->element == 'member')
@ -5992,6 +6002,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__MEMBER_PHONE__']=$msgishtml?dol_htmlentitiesbr($object->phone):$object->phone; $substitutionarray['__MEMBER_PHONE__']=$msgishtml?dol_htmlentitiesbr($object->phone):$object->phone;
$substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso; $substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso;
$substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile; $substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile;
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'dayrfc');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc');
if (is_object($object) && $object->element == 'societe') if (is_object($object) && $object->element == 'societe')
{ {
@ -6063,7 +6079,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
{ {
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key // Set the online payment url link into __ONLINE_PAYMENT_URL__ key
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$outputlangs->load('paypal'); $outputlangs->loadLangs(array('paypal','other'));
$typeforonlinepayment='free'; $typeforonlinepayment='free';
if (is_object($object) && $object->element == 'commande') $typeforonlinepayment='order'; if (is_object($object) && $object->element == 'commande') $typeforonlinepayment='order';
if (is_object($object) && $object->element == 'facture') $typeforonlinepayment='invoice'; if (is_object($object) && $object->element == 'facture') $typeforonlinepayment='invoice';
@ -6072,7 +6088,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$paymenturl=$url; $paymenturl=$url;
} }
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):''); $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl; $substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
} }
} }
@ -6087,11 +6103,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object)?$object->total_localtax1:''; if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object)?$object->total_localtax1:'';
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object)?$object->total_localtax2:''; if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object)?$object->total_localtax2:'';
$substitutionarray['__AMOUNT_FORMATED__'] = is_object($object)?price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code):''; $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object)?price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency):'';
$substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code):''; $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object)?price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency):'';
$substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object)?($object->total_vat?price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency_code):price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency_code)):''; $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object)?($object->total_vat?price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency):price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency)):'';
if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object)?price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency_code):''; if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object)?price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency):'';
if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object)?price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency_code):''; if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object)?price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency):'';
// TODO Add keys for foreign multicurrency // TODO Add keys for foreign multicurrency
@ -6104,6 +6120,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
} }
} }
//var_dump($substitutionarray['__AMOUNT_FORMATED__']);
if (empty($exclude) || ! in_array('date', $exclude)) if (empty($exclude) || ! in_array('date', $exclude))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -6153,7 +6170,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
* @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...) * @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal', ...)
* @param Translate $outputlangs Output language * @param Translate $outputlangs Output language
* @return string Output string after substitutions * @return string Output string after substitutions
* @see complete_substitutions_array * @see complete_substitutions_array, getCommonSubstitutionArray
*/ */
function make_substitutions($text, $substitutionarray, $outputlangs=null) function make_substitutions($text, $substitutionarray, $outputlangs=null)
{ {
@ -6959,6 +6976,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if ($reshook > 0) if ($reshook > 0)
{ {
$head = $hookmanager->resArray; $head = $hookmanager->resArray;
$h = count($head);
} }
} }
} }

View File

@ -1770,7 +1770,7 @@ function getSoapParams()
*/ */
function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='') function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
{ {
global $db,$conf; global $db, $conf, $langs;
$ret=''; $ret='';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -20,10 +21,9 @@
*/ */
/** /**
* \file htdocs/core/lib/order.lib.php * \file htdocs/core/lib/import.lib.php
* \brief Ensemble de fonctions de base pour le module commande * \brief Ensemble de fonctions de base pour le module import
* \ingroup commande * \ingroup import
*/
/** /**
* Function to return list of tabs for import pages * Function to return list of tabs for import pages

View File

@ -1,6 +1,7 @@
<?php <?php
/** /**
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -162,7 +163,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
} }
} }
if ($type == 'order') elseif ($type == 'order')
{ {
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':''); $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='order_ref'; if ($mode == 1) $out.='order_ref';
@ -180,7 +181,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
} }
} }
} }
if ($type == 'invoice') elseif ($type == 'invoice')
{ {
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':''); $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='invoice_ref'; if ($mode == 1) $out.='invoice_ref';
@ -198,7 +199,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
} }
} }
} }
if ($type == 'contractline') elseif ($type == 'contractline')
{ {
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':''); $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='contractline_ref'; if ($mode == 1) $out.='contractline_ref';
@ -216,7 +217,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
} }
} }
} }
if ($type == 'member' || $type == 'membersubscription') elseif ($type == 'member' || $type == 'membersubscription')
{ {
$out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':''); $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'<font color="#666666">':'');
if ($mode == 1) $out.='member_ref'; if ($mode == 1) $out.='member_ref';
@ -329,7 +330,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $
print '<font style="font-size: 10px;"><br><hr>'."\n"; print '<font style="font-size: 10px;"><br><hr>'."\n";
print $fromcompany->name.'<br>'; print $fromcompany->name.'<br>';
print $line1; print $line1;
if (strlen($line1+$line2) > 50) print '<br>'; if (strlen($line1.$line2) > 50) print '<br>';
else print ' - '; else print ' - ';
print $line2; print $line2;
print '</font></div>'."\n"; print '</font></div>'."\n";

View File

@ -392,6 +392,48 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Web // Web
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
} }
// Intra VAT
if (! empty($conf->global->MAIN_TVAINTRA_IN_SOURCE_ADDRESS))
{
if ($sourcecompany->tva_intra) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($sourcecompany->tva_intra);
}
// Professionnal Ids
if (! empty($conf->global->MAIN_PROFID1_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof1))
{
$tmp=$outputlangs->transcountrynoentities("ProfId1",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof1);
}
if (! empty($conf->global->MAIN_PROFID2_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof2))
{
$tmp=$outputlangs->transcountrynoentities("ProfId2",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof2);
}
if (! empty($conf->global->MAIN_PROFID3_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof3))
{
$tmp=$outputlangs->transcountrynoentities("ProfId3",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof3);
}
if (! empty($conf->global->MAIN_PROFID4_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof4))
{
$tmp=$outputlangs->transcountrynoentities("ProfId4",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof4);
}
if (! empty($conf->global->MAIN_PROFID5_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof5))
{
$tmp=$outputlangs->transcountrynoentities("ProfId5",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof5);
}
if (! empty($conf->global->MAIN_PROFID6_IN_SOURCE_ADDRESS) && ! empty($sourcecompany->idprof6))
{
$tmp=$outputlangs->transcountrynoentities("ProfId6",$sourcecompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
}
} }
if ($mode == 'target' || preg_match('/targetwithdetails/',$mode)) if ($mode == 'target' || preg_match('/targetwithdetails/',$mode))
@ -403,7 +445,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (!empty($targetcontact->address)) { if (!empty($targetcontact->address)) {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact)); $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
} else { } else {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany)); $companytouseforaddress = $targetcompany;
// Contact on a thirdparty that is a different thirdparty than the thirdparty of object
if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id)
{
$targetcontact->fetch_thirdparty();
$companytouseforaddress = $targetcontact->thirdparty;
}
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress));
} }
// Country // Country
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
@ -1325,7 +1376,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
if ($detail->eatby) $dte[]=$outputlangs->transnoentitiesnoconv('printEatby',dol_print_date($detail->eatby, $format, false, $outputlangs)); if ($detail->eatby) $dte[]=$outputlangs->transnoentitiesnoconv('printEatby',dol_print_date($detail->eatby, $format, false, $outputlangs));
if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs));
if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch);
$dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->qty);
$libelleproduitservice.= "__N__ ".implode(" - ", $dte); $libelleproduitservice.= "__N__ ".implode(" - ", $dte);
} }
} }

View File

@ -163,6 +163,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
return array(); return array();
} }
} }
if ($pu === '') $pu=0;
// pu_devise calculation from pu // pu_devise calculation from pu
if (empty($pu_devise) && !empty($multicurrency_tx)) { if (empty($pu_devise) && !empty($multicurrency_tx)) {
if (is_numeric($pu) && is_numeric($multicurrency_tx)) $pu_devise = $pu * $multicurrency_tx; if (is_numeric($pu) && is_numeric($multicurrency_tx)) $pu_devise = $pu * $multicurrency_tx;

View File

@ -866,7 +866,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
* @param string $projectsrole Array of roles user has on project * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others
* @param int $preselectedday Preselected day * @param int $preselectedday Preselected day
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break * @param int $oldprojectforbreak Old project id of last project break
@ -910,6 +910,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases
{
continue;
}
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {
@ -1151,7 +1156,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
* @param string $projectsrole Array of roles user has on project * @param string $projectsrole Array of roles user has on project
* @param string $tasksrole Array of roles user has on task * @param string $tasksrole Array of roles user has on task
* @param string $mine Show only task lines I am assigned to * @param string $mine Show only task lines I am assigned to
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others
* @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon
* @param int $oldprojectforbreak Old project id of last project break * @param int $oldprojectforbreak Old project id of last project break
* @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks
@ -1195,6 +1200,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
{ {
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases
{
continue;
}
// Break on a new project // Break on a new project
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
{ {

View File

@ -364,7 +364,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= $langs->trans("Batch").': '.$dbatch->batch;
$detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day");
$detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day");
$detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty;
$detail.= '<br>'; $detail.= '<br>';
} }
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);

View File

@ -172,7 +172,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products $sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products $sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture; $sql.= " ORDER BY d.rowid, d.".$fk_facture;
} }
else else
@ -213,7 +213,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products $sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products $sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; $sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
} }
@ -320,7 +320,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services $sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service $sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture; $sql.= " ORDER BY d.rowid, d.".$fk_facture;
} }
else else
@ -361,7 +361,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services $sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service $sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; $sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
} }
@ -465,7 +465,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = -1"; $sql.= " AND (d.product_type = -1";
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service $sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql.= " ORDER BY e.rowid"; $sql.= " ORDER BY e.rowid";
if (! $sql) if (! $sql)
@ -641,7 +641,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products $sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products $sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture; $sql.= " ORDER BY d.rowid, d.".$fk_facture;
} }
else else
@ -682,7 +682,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 0"; // Limit to products $sql.= " AND (d.product_type = 0"; // Limit to products
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products $sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; $sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
} }
@ -789,7 +789,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services $sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service $sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture; $sql.= " ORDER BY d.rowid, d.".$fk_facture;
} }
else else
@ -830,7 +830,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services $sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service $sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; $sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
} }
@ -934,7 +934,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = -1"; $sql.= " AND (d.product_type = -1";
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service $sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
$sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql.= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql.= " ORDER BY e.rowid"; $sql.= " ORDER BY e.rowid";
if (! $sql) if (! $sql)

View File

@ -63,10 +63,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&amp;leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 15, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&amp;leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 15, __ENTITY__);
-- Home - Menu users and groups -- Home - Menu users and groups
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/list.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/list.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&amp;action=create', 'NewUser', 2, 'users', '($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&amp;action=create', 'NewUser', 2, 'users', '($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/list.php?leftmenu=users', 'Groups', 1, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&amp;action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/hierarchy.php?leftmenu=users', 'HierarchicView', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 405__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/categories/index.php?leftmenu=users&type=7', 'UsersCategoriesShort', 1, 'categories', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 407__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/list.php?leftmenu=users', 'Groups', 1, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 408__+MAX_llx_menu__, 'home', '', 407__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&amp;action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
-- Third parties -- Third parties
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
@ -198,11 +204,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&amp;mainmenu=billing', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/list.php?leftmenu=donations&amp;mainmenu=billing', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__);
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&amp;mainmenu=billing', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?leftmenu=donations&amp;mainmenu=billing', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
-- Special expenses -- Special expenses
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=billing', 'Salaries', 1, 'salaries', '$user->rights->salaries->payment->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=billing', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->payment->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?leftmenu=tax_salary&amp;action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/stats/index.php?leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->payment->read', '', 0, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/stats/index.php?leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&amp;mainmenu=billing', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/index.php?leftmenu=tax_loan&amp;mainmenu=billing', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&amp;action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?leftmenu=tax_loan&amp;action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);

View File

@ -75,6 +75,21 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;'; if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;';
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname); $menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
// Members
$tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 18, $id, $idsel, $classname);
}
// Third parties // Third parties
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur'); $tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
@ -241,8 +256,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname); $menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
} }
// Tools // Tools
$tmpentry=array( $tmpentry=array(
'enabled'=>1, 'enabled'=>1,
@ -261,21 +274,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname); $menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname);
} }
// Members
$tmpentry=array('enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
}
// Show personalized menus // Show personalized menus
$menuArbo = new Menubase($db,'eldy'); $menuArbo = new Menubase($db,'eldy');
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries $newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries
@ -604,6 +602,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, ($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, ($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
$newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
if (! empty($conf->categorie->enabled))
{
$langs->load("categories");
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
$newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
@ -883,7 +886,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
global $mysoc; global $mysoc;
$permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)); $permtoshowmenu=((! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire));
$newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax'); $newmenu->add("/compta/charges/index.php?leftmenu=tax&amp;mainmenu=billing",$langs->trans("MenuSpecialExpenses"), 0, $permtoshowmenu, '', $mainmenu, 'tax');
// Social contributions // Social contributions
@ -931,10 +934,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->salaries->enabled)) if (! empty($conf->salaries->enabled))
{ {
$langs->load("salaries"); $langs->load("salaries");
$newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=billing",$langs->trans("Salaries"),1,$user->rights->salaries->payment->read, '', $mainmenu, 'tax_salary'); $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary&amp;mainmenu=billing",$langs->trans("Salaries"),1,$user->rights->salaries->read, '', $mainmenu, 'tax_salary');
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->payment->write); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create",$langs->trans("NewPayment"),2,$user->rights->salaries->write);
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->payment->read); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/index.php?leftmenu=tax_salary",$langs->trans("Payments"),2,$user->rights->salaries->read);
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"),2,$user->rights->salaries->payment->read); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i',$leftmenu)) $newmenu->add("/compta/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"),2,$user->rights->salaries->read);
} }
// Loan // Loan

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1322,11 +1323,11 @@ class DolibarrModules // Can not be abstract, because we need to insta
$unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:''; $unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:'';
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:''; $status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:''; $priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible $test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be enabled or not (so visible or not)
// Search if boxes def already present // Search if boxes def already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'"; if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'";
if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'"; if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'"; if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
@ -1352,7 +1353,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
if(is_int($status)){ $sql.= ' status,'; } if(is_int($status)){ $sql.= ' status,'; }
$sql.= " entity, test)"; $sql.= " entity, test)";
$sql.= " VALUES ("; $sql.= " VALUES (";
$sql.= "'".$this->db->escape($this->rights_class)."', "; $sql.= "'".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."', ";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= "'".$this->db->escape($label)."', "; $sql.= "'".$this->db->escape($label)."', ";
@ -1414,8 +1415,10 @@ class DolibarrModules // Can not be abstract, because we need to insta
if (is_array($this->cronjobs)) if (is_array($this->cronjobs))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " AND test = '1'"; // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed.
// For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module.
dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -1792,7 +1795,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$err=0; $err=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def";
$sql.= " WHERE module = '".$this->db->escape($this->rights_class)."'"; $sql.= " WHERE module = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG);
if (! $this->db->query($sql)) if (! $this->db->query($sql))
@ -1830,7 +1833,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$menu->menu_handler='all'; $menu->menu_handler='all';
//$menu->module=strtolower($this->name); TODO When right_class will be same than module name //$menu->module=strtolower($this->name); TODO When right_class will be same than module name
$menu->module=$this->rights_class; $menu->module=empty($this->rights_class)?strtolower($this->name):$this->rights_class;
if (! $this->menu[$key]['fk_menu']) if (! $this->menu[$key]['fk_menu'])
{ {
@ -1926,7 +1929,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
$err=0; $err=0;
//$module=strtolower($this->name); TODO When right_class will be same than module name //$module=strtolower($this->name); TODO When right_class will be same than module name
$module=$this->rights_class; $module=empty($this->rights_class)?strtolower($this->name):$this->rights_class;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
$sql.= " WHERE module = '".$this->db->escape($module)."'"; $sql.= " WHERE module = '".$this->db->escape($module)."'";

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -849,7 +850,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY($col1x, $tab2_top + 0); $pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0); $pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1);
@ -1412,4 +1413,3 @@ class pdf_einstein extends ModelePDFCommandes
} }
} }

View File

@ -8,6 +8,7 @@
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -1079,7 +1080,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col1x, $tab2_top + 0); $pdf->SetXY($col1x, $tab2_top + 0);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
$total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
$pdf->SetXY($col2x, $tab2_top + 0); $pdf->SetXY($col2x, $tab2_top + 0);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
@ -1304,7 +1305,6 @@ class pdf_crabe extends ModelePDFFactures
} }
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); $depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit; //print "x".$creditnoteamount."-".$depositsamount;exit;
@ -1812,4 +1812,3 @@ class pdf_crabe extends ModelePDFFactures
} }
} }

View File

@ -89,7 +89,7 @@ class modAgenda extends DolibarrModules
$resql = $this->db->query($sqlreadactions); $resql = $this->db->query($sqlreadactions);
if ($resql) if ($resql)
{ {
while ($obj = $this->db->fetch_object($sqlreadactions)) while ($obj = $this->db->fetch_object($resql))
{ {
//if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation).
if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default.
@ -113,7 +113,7 @@ class modAgenda extends DolibarrModules
// Cronjobs // Cronjobs
//------------ //------------
$this->cronjobs = array( $this->cronjobs = array(
0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'1'), 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'$conf->agenda->enabled'),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
); );

View File

@ -116,7 +116,7 @@ class modFacture extends DolibarrModules
// Cronjobs // Cronjobs
$this->cronjobs = array( $this->cronjobs = array(
0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>true), 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled'),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600) // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
); );

View File

@ -50,7 +50,9 @@ class modSalaries extends DolibarrModules
$this->db = $db; $this->db = $db;
$this->numero = 510; // Perms from 501..519 $this->numero = 510; // Perms from 501..519
$this->family = "hr"; // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "financial";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
@ -97,55 +99,32 @@ class modSalaries extends DolibarrModules
$r=0; $r=0;
$r++; $r++;
$this->rights[$r][0] = 501; $this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Read employee contracts/salaries'; $this->rights[$r][1] = 'Read payments of employee salaries';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++; $r++;
$this->rights[$r][0] = 502; $this->rights[$r][0] = 512;
$this->rights[$r][1] = 'Create/modify employee contracts/salaries'; $this->rights[$r][1] = 'Create/modify payments of empoyee salaries';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write'; $this->rights[$r][4] = 'write';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Read payment of salaries';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'payment';
$this->rights[$r][5] = 'read';
$r++;
$this->rights[$r][0] = 512;
$this->rights[$r][1] = 'Create/modify payment of salaries';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'payment';
$this->rights[$r][5] = 'write';
$r++; $r++;
$this->rights[$r][0] = 514; $this->rights[$r][0] = 514;
$this->rights[$r][1] = 'Delete contracts/salaries'; $this->rights[$r][1] = 'Delete payments of employee salary';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete'; $this->rights[$r][4] = 'delete';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$this->rights[$r][0] = 515;
$this->rights[$r][1] = 'Read all salaries';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'payment';
$this->rights[$r][5] = 'readall';
$r++; $r++;
$this->rights[$r][0] = 517; $this->rights[$r][0] = 517;
$this->rights[$r][1] = 'Export employee contracts and salaries payments'; $this->rights[$r][1] = 'Export payments of employee salaries';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';

View File

@ -314,7 +314,7 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) {
$subordinatesids = $user->getAllChildIds(); $subordinatesids = $user->getAllChildIds();
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; $this->export_sql_end[$r] .=count($subordinatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subordinatesids).')' : '';
} }
$this->export_sql_end[$r] .=')'; $this->export_sql_end[$r] .=')';
} }
@ -365,7 +365,7 @@ class modSociete extends DolibarrModules
$this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' ';
if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) { if (! empty($conf->global->SOCIETE_EXPORT_SUBORDINATES_CHILDS)) {
$subordinatesids = $user->getAllChildIds(); $subordinatesids = $user->getAllChildIds();
$this->export_sql_end[$r] .=count($subronidatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subronidatesids).')' : ''; $this->export_sql_end[$r] .=count($subordinatesids)>0 ? ' OR (sc.fk_user IN ('.implode(',',$subordinatesids).')' : '';
} }
$this->export_sql_end[$r] .=')'; $this->export_sql_end[$r] .=')';
} }

View File

@ -101,7 +101,7 @@ class modStripe extends DolibarrModules
'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'stripe', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>500, 'position'=>500,
'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->banque->consolidate', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'$user->rights->banque->modifier', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',
'user'=>2 'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both ); // 0=Menu for internal users, 1=external users, 2=both
@ -116,8 +116,8 @@ class modStripe extends DolibarrModules
'url' => '', 'url' => '',
'langs' => 'stripe', 'langs' => 'stripe',
'position' => 100, 'position' => 100,
'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 1', 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 1',
'perms' => '$user->rights->banque->configurer', 'perms' => '$user->rights->banque->lire',
'target' => '', 'target' => '',
'user' => 0 'user' => 0
); );
@ -131,7 +131,7 @@ class modStripe extends DolibarrModules
'langs' => 'stripe', 'langs' => 'stripe',
'position' => 102, 'position' => 102,
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
'perms' => '$user->rights->banque->configurer', 'perms' => '$user->rights->banque->lire',
'target' => '', 'target' => '',
'user' => 0 'user' => 0
); );
@ -145,7 +145,7 @@ class modStripe extends DolibarrModules
'langs' => 'stripe', 'langs' => 'stripe',
'position' => 102, 'position' => 102,
'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2',
'perms' => '$user->rights->banque->configurer', 'perms' => '$user->rights->banque->lire',
'target' => '', 'target' => '',
'user' => 0 'user' => 0
); );

View File

@ -82,7 +82,7 @@ class modSyslog extends DolibarrModules
// Cronjobs // Cronjobs
$this->cronjobs = array( $this->cronjobs = array(
0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true), 0=>array('label'=>'CompressSyslogs', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'compressSyslogs', 'parameters'=>'', 'comment'=>'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', 'frequency'=>1, 'unitfrequency'=> 3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>true),
); );
} }
} }

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