Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW/add_real_payments_on_vat_objects

This commit is contained in:
Gauthier PC portable 024 2021-01-28 10:28:36 +01:00
commit 8a5588e518
965 changed files with 19425 additions and 16760 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ default.properties
.DS_Store
.idea
*.iml
*.orig
Thumbs.db
/dolibarr_genesis.mp4
# Log files

View File

@ -3,6 +3,24 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users:
----------
For developers:
---------------
WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup.
***** ChangeLog for 13.0.0 compared to 12.0.0 *****
For users:
@ -96,9 +114,6 @@ NEW: common behavior for monthly leave list view
NEW: convert all subscription in datetime
NEW: date shipment from order accepts hours
NEW: price level compatibility for variant
NEW: delayed payment in TakePOS
NEW: display date range if exist in TakePOS
NEW: display resiliate status in TakePOS for member
NEW: display stat for BOM on "object referent"/linked Object product tab
NEW: Email configuration - allow auto signed certificate when smtp ssl activated
NEW: enable free emails input with select2
@ -156,6 +171,9 @@ NEW: TakePOS add third order printer
NEW: TakePOS can change thirdparty with barcode scan
NEW: TakePOS can create a thirdparty customer from TakePOS frontend
NEW: TakePOS connector compatibility with RECEIPT PRINTERS module
NEW: TakePOS add delayed payment
NEW: TakePOS display date range if exist
NEW: TakePOS display resiliate status for members
NEW: TakePOS Gift Receipt
NEW: TakePOS multicurrency compatibility
NEW: TakePOS multicurrency total
@ -181,8 +199,7 @@ NEW: add option "If the feature to manage kits of module Stock is used, show det
For developers:
---------------
NEW: add substitution key __MEMBER_TYPE__
NEW: add substitution key __TYPE__
NEW: add __MEMBER_TYPE__ and __TYPE__ substitution key
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
NEW: add some fields to link website page to an other object
@ -194,12 +211,9 @@ NEW: can add event to log into blockedlog module with a constant
NEW: add property cssview when declaring fields of an object
NEW: can use dynamic code into the 'enabled' property of DAO fields
NEW: field ref_ext in llx_commandedet
NEW: field ref_ext for Attributes and Combinations
NEW: fields ref_ext for Attributes and Combinations
NEW: OAuth SCOPE for Admin SDK
NEW: retrieve discount from invoice from API
NEW: standardizes API thirdparties by email like other object
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
NEW: Triggers Attributes and Attributes values
NEW: add incoterms data into the substitution array
NEW: add send context for ticket
@ -216,11 +230,12 @@ NEW: API can update a payment
NEW: API get member by thirdparty
NEW: API get thirdparty by barcode
NEW: API get users by email / login
NEW: allow to edit field "demand reason" through API
NEW: fetch contact by email with REST API
NEW: get state by REST API
NEW: get state dictionary by REST API
NEW: improve Product API for product variants
NEW: get state dictionnary by REST API
NEW: improve Product API for variant products
NEW: retrieve discount from invoice from API
NEW: Thirdparty REST API: endpoint to set price level
NEW: use new category API for project list view
HOOKs
NEW: add hook on propal card
@ -238,7 +253,7 @@ Following changes may create regressions for some external modules, but were nec
* All properties ->titre have been renamed into ->title
* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id
* Property 'num_paiement' has been renamed 'num_payment' everywhere for better code consistency.
* The deprecated subsitution key __SIGNATURE__ has been removed. Use __USER_SIGNATURE__ if you used the old syntax in your email templates.
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace it with __USER_SIGNATURE__ if you used the old syntax in your email templates.
* The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday.
* If you build a class that implement CommonObject to use the incoterm properties or methods (->fk_incoterm, ->label_incoterm, ->location_incoterm),
you must now also include declaration of the Trait 'CommonIncoterm' in your class. All incoterm functions were moved into this Trait.
@ -251,6 +266,7 @@ Following changes may create regressions for some external modules, but were nec
* Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main"
* Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet)
* Databse transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code.
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
***** ChangeLog for 12.0.4 compared to 12.0.3 *****

View File

@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@ -49,7 +49,10 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('', $user->error); exit; }
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
$user->getrights();
@ -82,12 +85,12 @@ $obj->lines[]=$line1;
// Create invoice
$idobject=$obj->create($user);
if ($idobject > 0)
{
if ($idobject > 0) {
// Change status to validated
$result=$obj->validate($user);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else {
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
$error++;
dol_print_error($db, $obj->error);
}
@ -99,8 +102,7 @@ if ($idobject > 0)
// -------------------- END OF YOUR CODE --------------------
if (! $error)
{
if (! $error) {
$db->commit();
print '--- end ok'."\n";
} else {

View File

@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@ -49,7 +49,10 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('', $user->error); exit; }
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
$user->getrights();
@ -80,12 +83,12 @@ $com->lines[]=$orderline1;
// Create order
$idobject=$com->create($user);
if ($idobject > 0)
{
if ($idobject > 0) {
// Change status to validated
$result=$com->valid($user);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else {
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
$error++;
dol_print_error($db, $com->error);
}
@ -97,8 +100,7 @@ if ($idobject > 0)
// -------------------- END OF YOUR CODE --------------------
if (! $error)
{
if (! $error) {
$db->commit();
print '--- end ok'."\n";
} else {

View File

@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@ -49,7 +49,10 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('', $user->error); exit; }
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
$user->getrights();
@ -79,8 +82,7 @@ $myproduct->weight_units = 0;
// Create product in database
$idobject = $myproduct->create($user);
if ($idobject > 0)
{
if ($idobject > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
$error++;
@ -89,8 +91,7 @@ if ($idobject > 0)
// -------------------- END OF YOUR CODE --------------------
if (! $error)
{
if (! $error) {
$db->commit();
print '--- end ok'."\n";
} else {

View File

@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@ -49,7 +49,10 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('', $user->error); exit; }
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
$user->getrights();
@ -69,18 +72,17 @@ $obj->nom = 'ABCDEF';
// Create user
$idobject=$obj->create($user);
if ($idobject > 0)
{
if ($idobject > 0) {
// Change status to validated
$result=$obj->setStatut(1);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else {
if ($result > 0) {
print "OK Object created with id ".$idobject."\n";
} else {
$error++;
dol_print_error($db, $obj->error);
}
} elseif ($obj->error == 'ErrorLoginAlreadyExists')
{
print "User with login ".$obj->login." already exists\n";
} elseif ($obj->error == 'ErrorLoginAlreadyExists') {
print "User with login ".$obj->login." already exists\n";
} else {
$error++;
dol_print_error($db, $obj->error);
@ -89,8 +91,7 @@ if ($idobject > 0)
// -------------------- END OF YOUR CODE --------------------
if (! $error)
{
if (! $error) {
$db->commit();
print '--- end ok'."\n";
} else {

View File

@ -29,8 +29,8 @@ $path=dirname(__FILE__).'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
exit;
}
// Global variables
@ -49,14 +49,17 @@ $langs->load("main"); // To load language file for default language
// Load user and its permissions
$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
if (! $result > 0) { dol_print_error('', $user->error); exit; }
if (! $result > 0) {
dol_print_error('', $user->error);
exit;
}
$user->getrights();
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1])) { // Check parameters
print "Usage: ".$script_file." id_thirdparty ...\n";
exit;
print "Usage: ".$script_file." id_thirdparty ...\n";
exit;
}
print '--- start'."\n";
print 'Argument id_thirdparty='.$argv[1]."\n";

View File

@ -0,0 +1,49 @@
#!/bin/sh
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]
then
oIFS=$IFS
IFS='
'
SFILES="$1"
IFS=$oIFS
fi
SFILES=${SFILES:-$STAGED_FILES_CMD}
echo "Checking PHP Lint..."
for FILE in $SFILES
do
php -l -d display_errors=0 $PROJECT/$FILE
if [ $? != 0 ]
then
echo "Fix the error before commit."
exit 1
fi
FILES="$FILES $PROJECT/$FILE"
done
if [ "$FILES" != "" ]
then
echo "Running PHPCS Code Sniffer..."
#~/vendor/bin/phpcs --version
#phpcs --standard=PSR2 --encoding=utf-8 -n -p $FILES
# Check Dolibarr standard
~/vendor/bin/phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
# Check your own standard
#~/vendor/bin/phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
if [ $? != 0 ]
then
# fix standard errors
~/vendor/bin/phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
#~/vendor/bin/phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
echo "Fix the error before commit."
exit 1
fi
fi
exit $?

View File

@ -1,3 +1,7 @@
Barcode EAN 13
FR
==
Signification des chiffres.
- 2 chiffres pour le code pays ou code systeme
@ -9,6 +13,24 @@ Cette regle subit de nombreuses entorses pour ameliorer l'usage des chiffres dis
Voici la liste des codes pays ou systeme :
EN
==
Meaning of the numbers.
- 2 digits for the country code or system code
- 5 digits for the company identifier
- 5 digits for item identifier
- 1 digit for checksum
This rule has been twisted many times to improve the use of the available numbers.
Here is the list of country codes or system:
List
====
00 <20> 13 UCC (Etats-Unis et Canada)
20 <20> 29 Codification interne en magasin
30 <20> 37 GENCOD-EAN France
@ -104,4 +126,4 @@ Voici la liste des codes pays ou systeme :
978 - 979 Livres (ISBN)
980 Refus de remboursement
981 - 982 Coupons (monnaie courante)
99 Coupons
99 Coupons

View File

@ -1,5 +1,6 @@
* Page with license compatibility
https://www.gnu.org/licenses/quick-guide-gplv3.fr.html
[EN] https://www.gnu.org/licenses/quick-guide-gplv3.en.html
[FR] https://www.gnu.org/licenses/quick-guide-gplv3.fr.html
* FAQ on GPL license
https://www.fsf.org/licensing/licenses/gpl-faq.html

View File

@ -5,13 +5,13 @@ server {
root /path/to/your/htdocs;
# Optionnal
# Optional
error_log /path/to/your/log/directory/nginx.error.log;
access_log /path/to/your/log/directory/nginx.access.log;
index index.php index.html index.htm;
# Optionnal
# Optional
server_name your-fqdn.tld;
location / {
@ -23,6 +23,6 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 600;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass unix:/var/run/php5-fpm.sock; // /var/run/php/php7.0-fpm.sock
}
}

View File

@ -444,9 +444,6 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused = 0;
$var = false;
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
@ -481,7 +478,6 @@ if ($id)
}
print '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
print '<td>';
@ -612,7 +608,7 @@ if ($id)
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;

View File

@ -76,7 +76,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
$action = 'create';
} else {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS);
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);

View File

@ -438,8 +438,6 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused = 0;
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
@ -496,7 +494,6 @@ if ($id)
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
print '<td>';

View File

@ -100,7 +100,7 @@ if ($action == 'update') {
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -114,9 +114,10 @@ if ($action == 'setlistsorttodo') {
if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -127,9 +128,10 @@ if ($action == 'setlistsortdone') {
if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -140,9 +142,10 @@ if ($action == 'setmanagezero') {
if ($action == 'setdisabledirectinput') {
$setdisabledirectinput = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -153,9 +156,10 @@ if ($action == 'setdisabledirectinput') {
if ($action == 'setenabledraftexport') {
$setenabledraftexport = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -166,9 +170,10 @@ if ($action == 'setenabledraftexport') {
if ($action == 'setenablesubsidiarylist') {
$setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -179,9 +184,10 @@ if ($action == 'setenablesubsidiarylist') {
if ($action == 'setdisablebindingonsales') {
$setdisablebindingonsales = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -192,9 +198,10 @@ if ($action == 'setdisablebindingonsales') {
if ($action == 'setdisablebindingonpurchases') {
$setdisablebindingonpurchases = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -205,9 +212,10 @@ if ($action == 'setdisablebindingonpurchases') {
if ($action == 'setdisablebindingonexpensereports') {
$setdisablebindingonexpensereports = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -215,9 +223,11 @@ if ($action == 'setdisablebindingonexpensereports') {
}
}
/*
* View
*/
$form = new Form($db);
$title = $langs->trans('ConfigAccountingExpert');

View File

@ -407,8 +407,6 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused = 0;
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
@ -437,7 +435,6 @@ if ($id)
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
print '<td>';

View File

@ -16,7 +16,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/**
@ -307,7 +306,7 @@ if ($action != 'export_csv')
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 0, '', 0, -1, 0, 'accountcard');
} else {
$accounting_account = length_accountg($line->numero_compte);
}
@ -322,10 +321,19 @@ if ($action != 'export_csv')
$root_account_description = $tmparrayforrootaccount['label'];
$root_account_number = $tmparrayforrootaccount['account_number'];
//var_dump($tmparrayforrootaccount);
//var_dump($accounting_account);
//var_dump($accountingaccountstatic);
if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) {
$link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
} elseif ($accounting_account == 'NotDefined') {
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} elseif (empty($tmparrayforrootaccount['label'])) {
// $tmparrayforrootaccount['label'] not defined = the account has not parent with a parent.
// This is useless, we should not create a new account when an account has no parent, we must edit it to fix its parent.
// BUG 1: Accounts on level root or level 1 must not have a parent 2 level higher, so shoule not show a link to create another account.
// BUG 2: Adding a link to create a new accounting account here is useless because it is not add as parent of the orphelin.
//$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
}
if (!empty($show_subgroup))
@ -363,8 +371,22 @@ if ($action != 'export_csv')
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>';
print '<td class="nowraponall right">'.price($line->credit).'</td>';
$urlzoom = '';
if ($line->numero_compte) {
$urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte);
if (GETPOSTISSET('date_startmonth')) {
$urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int');
}
if (GETPOSTISSET('date_endmonth')) {
$urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int');
}
}
// Debit
print '<td class="nowraponall right"><a href="'.$urlzoom.'">'.price($line->debit).'</a></td>';
// Credit
print '<td class="nowraponall right"><a href="'.$urlzoom.'">'.price($line->credit).'</a></td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE)) {
print '<td class="nowraponall right">'.price(price2num($opening_balance + $line->debit - $line->credit, 'MT')).'</td>';
} else {

View File

@ -63,9 +63,11 @@ $accountingjournal->fetch(null, $journal_code);
$journal_label = $accountingjournal->label;
$subledger_account = GETPOST('subledger_account', 'alphanohtml');
if ($subledger_account == - 1) {
if ($subledger_account == -1) {
$subledger_account = null;
}
$subledger_label = GETPOST('subledger_label', 'alphanohtml');
$label_operation = GETPOST('label_operation', 'alphanohtml');
$debit = price2num(GETPOST('debit', 'alpha'));
$credit = price2num(GETPOST('credit', 'alpha'));
@ -108,6 +110,7 @@ if ($action == "confirm_update") {
} else {
$object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account;
$object->subledger_label = $subledger_label;
$object->label_compte = $accountingaccount_label;
$object->label_operation = $label_operation;
$object->debit = $debit;
@ -160,6 +163,7 @@ if ($action == "confirm_update") {
$object->numero_compte = $accountingaccount_number;
$object->subledger_account = $subledger_account;
$object->subledger_label = $subledger_label;
$object->label_compte = $accountingaccount_label;
$object->label_operation = $label_operation;
$object->debit = $debit;
@ -578,7 +582,7 @@ if ($action == 'create')
print '<br>';
$result = $object->fetchAllPerMvt($piece_num, $mode);
$result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
@ -630,9 +634,10 @@ if ($action == 'create')
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">';
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
}
// TODO Add also the label
// Add also input for subledger label
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="'.(GETPOSTISSET("subledger_label") ? GETPOST("subledger_label", "alpha") : $line->subledger_label).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET("label_operation") ? GETPOST("label_operation", "alpha") : $line->label_operation).'"></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value="'.(GETPOSTISSET("debit") ? GETPOST("debit", "alpha") : price($line->debit)).'"></td>';
@ -644,20 +649,24 @@ if ($action == 'create')
} else {
$accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>';
print '<td>'.length_accounta($line->subledger_account).'</td>';
print '<td>'.length_accounta($line->subledger_account);
if ($line->subledger_label) {
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
}
print '</td>';
print '<td>'.$line->label_operation.'</td>';
print '<td class="nowrap right">'.price($line->debit).'</td>';
print '<td class="nowrap right">'.price($line->credit).'</td>';
print '<td class="center">';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">';
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">';
print img_edit('', 0, 'class="marginrightonly"');
print '</a> &nbsp;';
$actiontodelete = 'delete';
if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete = 'confirm_delete';
print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">';
print img_delete();
print '</a>';
@ -688,9 +697,9 @@ if ($action == 'create')
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $formaccounting->select_auxaccount('', 'subledger_account', 1);
} else {
print '<input type="text" class="maxwidth150" name="subledger_account" value="">';
print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">';
}
// TODO Add also the label
print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">';
print '</td>';
print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';

View File

@ -87,7 +87,7 @@ $search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
@ -784,7 +784,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}

View File

@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
@ -516,7 +516,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Date export

View File

@ -74,7 +74,7 @@ $search_ledger_code = GETPOST('search_ledger_code', 'array');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
@ -544,7 +544,7 @@ if (!empty($arrayfields['t.credit']['checked'])) {
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Date export

View File

@ -57,8 +57,8 @@ class AccountancyExport
public static $EXPORT_TYPE_OPENCONCERTO = 100;
public static $EXPORT_TYPE_LDCOMPTA = 110;
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_GESTINUMV3 = 130;
public static $EXPORT_TYPE_GESTINUMV5 = 135;
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
@ -119,8 +119,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
self::$EXPORT_TYPE_GESTINUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
self::$EXPORT_TYPE_GESTINUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'),
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
);
@ -154,8 +154,8 @@ class AccountancyExport
self::$EXPORT_TYPE_CHARLEMAGNE => 'charlemagne',
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10',
self::$EXPORT_TYPE_GESTINUMV3 => 'gestinumv3',
self::$EXPORT_TYPE_GESTINUMV5 => 'gestinumv5',
self::$EXPORT_TYPE_GESTIMUMV3 => 'gestimumv3',
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
);
@ -227,11 +227,13 @@ class AccountancyExport
self::$EXPORT_TYPE_LDCOMPTA10 => array(
'label' => $langs->trans('Modelcsv_LDCompta10'),
),
self::$EXPORT_TYPE_GESTINUMV3 => array(
self::$EXPORT_TYPE_GESTIMUMV3 => array(
'label' => $langs->trans('Modelcsv_Gestinumv3'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_GESTINUMV5 => array(
self::$EXPORT_TYPE_GESTIMUMV5 => array(
'label' => $langs->trans('Modelcsv_Gestinumv5'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'),
@ -320,10 +322,10 @@ class AccountancyExport
case self::$EXPORT_TYPE_LDCOMPTA10 :
$this->exportLDCompta10($TData);
break;
case self::$EXPORT_TYPE_GESTINUMV3 :
case self::$EXPORT_TYPE_GESTIMUMV3 :
$this->exportGestimumV3($TData);
break;
case self::$EXPORT_TYPE_GESTINUMV5 :
case self::$EXPORT_TYPE_GESTIMUMV5 :
$this->exportGestimumV5($TData);
break;
case self::$EXPORT_TYPE_FEC :
@ -1638,81 +1640,85 @@ class AccountancyExport
$invoices_infos = array();
$supplier_invoices_infos = array();
foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
$invoice_ref = $line->doc_ref;
$company_name = "";
if (($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice') && $line->fk_doc > 0) {
if (($line->doc_type == 'customer_invoice' && !isset($invoices_infos[$line->fk_doc])) ||
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
} else {
// Get new supplier invoice ref and company name
$sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid';
$sql .= ' WHERE ff.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$supplier_invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
}
} elseif ($line->doc_type == 'customer_invoice') {
// Retrieve invoice infos
$invoice_ref = $invoices_infos[$line->fk_doc]['ref'];
$company_name = $invoices_infos[$line->fk_doc]['company_name'];
} else {
// Retrieve invoice infos
$invoice_ref = $supplier_invoices_infos[$line->fk_doc]['ref'];
$company_name = $supplier_invoices_infos[$line->fk_doc]['company_name'];
}
}
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
$invoice_ref = $line->doc_ref;
$company_name = "";
if (($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice') && $line->fk_doc > 0) {
if (($line->doc_type == 'customer_invoice' && !isset($invoices_infos[$line->fk_doc])) ||
($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) {
if ($line->doc_type == 'customer_invoice') {
// Get new customer invoice ref and company name
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
} else {
// Get new supplier invoice ref and company name
$sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid';
$sql .= ' WHERE ff.rowid = ' . $line->fk_doc;
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
// Save invoice infos
$supplier_invoices_infos[$line->fk_doc] = array('ref' => $obj->ref, 'company_name' => $obj->nom);
$invoice_ref = $obj->ref;
$company_name = $obj->nom;
}
}
}
} elseif ($line->doc_type == 'customer_invoice') {
// Retrieve invoice infos
$invoice_ref = $invoices_infos[$line->fk_doc]['ref'];
$company_name = $invoices_infos[$line->fk_doc]['company_name'];
} else {
// Retrieve invoice infos
$invoice_ref = $supplier_invoices_infos[$line->fk_doc]['ref'];
$company_name = $supplier_invoices_infos[$line->fk_doc]['company_name'];
}
}
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
}
//Libellé Auto
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
//Libellé manuel
print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator;
//Numéro de pièce
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
//Devise
print 'EUR' . $this->separator;
//Montant
print price2num(abs($line->montant)) . $this->separator;
//Sens
print $line->sens . $this->separator;
//Code lettrage
print $this->separator;
//Date Echéance
print $date;
print $this->end_line;
}
//Libellé Auto
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
//Libellé manuel
print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator;
//Numéro de pièce
print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator;
//Devise
print 'EUR' . $this->separator;
//Montant
print price2num(abs($line->montant)) . $this->separator;
//Sens
print $line->sens . $this->separator;
//Code lettrage
print $this->separator;
//Date Echéance
print $date;
print $this->end_line;
}
}
@ -1729,27 +1735,31 @@ class AccountancyExport
$this->separator = ',';
foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
if ($line->debit == 0 && $line->credit == 0) {
unset($array[$line]);
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print substr($line->code_journal, 0, 4) . $this->separator;
if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) {
print length_accountg($line->subledger_account) . $this->separator;
} else {
print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator;
}
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator;
print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator;
print price2num($line->montant) . $this->separator;
print $line->sens . $this->separator;
print $date . $this->separator;
print $this->separator;
print $this->separator;
print 'EUR';
print $this->end_line;
}
print $this->separator;
//print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator;
print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"' . $this->separator;
print '"'.dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).'"'.$this->separator;
print price2num($line->montant).$this->separator;
print $line->sens.$this->separator;
print $date . $this->separator;
print $this->separator;
print $this->separator;
print 'EUR';
print $this->end_line;
}
}

View File

@ -1914,25 +1914,24 @@ class BookKeeping extends CommonObject
/**
* Return id and description of a root accounting account.
* This function takes the parent of parent to get the root account !
* FIXME: This function takes the parent of parent to get the root account !
*
* @param string $account Accounting account
* @return string Root account
* @return array Array with root account information (max 2 upper level)
*/
public function getRootAccount($account = null)
{
global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT root.rowid, root.account_number, root.label as label";
$sql = "SELECT root.rowid, root.account_number, root.label as label,";
$sql .= " parent.rowid as parent_rowid, parent.account_number as parent_account_number, parent.label as parent_label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $pcgver);
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
$sql .= " AND parent.active = 1";
$sql .= " AND root.active = 1";
$sql .= " AND aa.entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG);
@ -1943,7 +1942,8 @@ class BookKeeping extends CommonObject
$obj = $this->db->fetch_object($resql);
}
return array('id'=>$obj->rowid, 'account_number'=>$obj->account_number, 'label'=>$obj->label);
$result = array('id'=>$obj->rowid, 'account_number'=>$obj->account_number, 'label'=>$obj->label);
return $result;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(__METHOD__." ".$this->error, LOG_ERR);

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "compta", "accountancy", "productbatch"));
$langs->loadLangs(array("bills", "compta", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -339,7 +339,7 @@ if ($result) {
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -150,7 +150,7 @@ $userstatic = new User($db);
$bankaccountstatic = new Account($db);
$chargestatic = new ChargeSociales($db);
$paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db);
$paymentvatstatic = new Tva($db);
$paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db);

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch"));
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "productbatch", "products"));
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -334,16 +334,16 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch"));
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "productbatch", "products"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');

View File

@ -136,7 +136,7 @@ if ($action == 'update' || $action == 'add') {
$constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -92,7 +92,7 @@ if ($action == 'update' || $action == 'add') {
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -63,7 +63,7 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -97,7 +97,7 @@ if ($action == "save" && empty($cancel))
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $keyparam))
{
$res = dolibarr_set_const($db, $keyparam, (GETPOST($keyparam, 'alpha') ?GETPOST($keyparam, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
}

View File

@ -82,15 +82,15 @@ if ($actionsave)
//print '-name='.$name.'-color='.$color;
$res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_SRC'.$i, $src, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_OFFSETTZ'.$i, $offsettz, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'AGENDA_EXT_ENABLED'.$i, $enabled, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$i++;
}
@ -98,7 +98,7 @@ if ($actionsave)
if (!$error)
{
$res = dolibarr_set_const($db, 'AGENDA_EXT_NB', trim(GETPOST('AGENDA_EXT_NB', 'int')), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
$MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
}

View File

@ -51,6 +51,7 @@ $type = 'action';
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{
$code = $reg[1];

View File

@ -112,7 +112,7 @@ if ($actionsave)
if ($color == '-1') $color = '';
$res = dolibarr_set_const($db, 'BANK_COLORIZE_MOVEMENT_COLOR'.$i, $color, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$i++;
}

View File

@ -52,7 +52,7 @@ if ($action == 'updateMask')
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -141,7 +141,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST("BOM_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -155,7 +155,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -55,7 +55,7 @@ if ($action == 'updateMask')
$maskchequereceipts = GETPOST('maskchequereceipts', 'alpha');
if ($maskconstchequereceipts) $res = dolibarr_set_const($db, $maskconstchequereceipts, $maskchequereceipts, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -76,7 +76,7 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -61,7 +61,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -146,7 +146,7 @@ elseif ($action == 'setdoc') {
$draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -160,7 +160,7 @@ elseif ($action == 'setdoc') {
$res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -172,7 +172,7 @@ elseif ($action == 'setdoc') {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -186,7 +186,7 @@ elseif ($action == 'setdoc') {
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -201,7 +201,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
{
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -216,7 +216,7 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -57,7 +57,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskcontract', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -58,7 +58,7 @@ if ($action == 'updateMask')
$maskdelivery = GETPOST('maskdelivery', 'alpha');
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -73,7 +73,7 @@ if ($action == 'set_DELIVERY_FREE_TEXT')
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -236,7 +236,7 @@ $tabsqlsort[3] = "country ASC, code ASC";
$tabsqlsort[4] = "code ASC";
$tabsqlsort[5] = "label ASC";
$tabsqlsort[6] = "a.type ASC, a.module ASC, a.position ASC, a.code ASC";
$tabsqlsort[7] = "country ASC, code ASC, a.libelle ASC";
$tabsqlsort[7] = "c.label ASC, a.code ASC, a.libelle ASC";
$tabsqlsort[8] = "country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '')." libelle ASC";
$tabsqlsort[9] = "label ASC";
$tabsqlsort[10] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
@ -1069,6 +1069,7 @@ if ($id)
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
elseif ($search_code != '' && $id == 7) $sql .= natural_search("a.code", $search_code);
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
if ($sortfield)
@ -1107,7 +1108,6 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused = 0;
$withentity = null;
$fieldlist = explode(',', $tabfield[$id]);
@ -1214,7 +1214,6 @@ if ($id)
else $tdsoffields .= $valuetoshow;
$tdsoffields .= '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
if ($id == 4) $tdsoffields .= '<td></td>';

View File

@ -61,7 +61,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}

View File

@ -66,7 +66,7 @@ if ($action == 'updateMask')
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -156,7 +156,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -170,7 +170,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -184,7 +184,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -198,7 +198,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -217,7 +217,7 @@ elseif ($action == 'setdoc')
foreach ($invoicetypemodels as $type => $value)
{
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (!$error)

View File

@ -58,7 +58,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -147,7 +147,7 @@ elseif ($action == 'setdoc')
$freetext = GETPOST('FICHINTER_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -160,7 +160,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -173,7 +173,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -185,7 +185,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -198,7 +198,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -211,7 +211,7 @@ elseif ($action == 'setdoc')
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}

View File

@ -59,7 +59,7 @@ if ($action == 'updateMask')
$maskvalue = GETPOST('maskholiday', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09');
$form = new Form($db);
/*
* Actions
*/
@ -52,21 +53,20 @@ if ($action == 'setvalue')
$contactbulkdefault = GETPOST('MAILING_CONTACT_DEFAULT_BULK_STATUS', 'int');
$res = dolibarr_set_const($db, "MAILING_EMAIL_FROM", $mailfrom, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO", $mailerror, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_DELAY", $mailingdelay, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "MAILING_CONTACT_DEFAULT_BULK_STATUS", $contactbulkdefault, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
// Create temporary encryption key if nedded
$res = dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY", $checkread_key, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -77,7 +77,7 @@ if ($action == 'setvalue')
if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
$setonsearchandlistgooncustomerorsuppliercard = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -59,7 +59,7 @@ if ($action == 'update' || $action == 'add')
$constnote = $_POST["constnote"][$key];
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (!$error)

View File

@ -532,6 +532,7 @@ if ($action == 'edit')
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -552,10 +553,12 @@ if ($action == 'edit')
}
print '</table>';
print '</div>';
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td></td></tr>';
@ -663,6 +666,7 @@ if ($action == 'edit')
}
print '</table>';
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning');
@ -670,13 +674,15 @@ if ($action == 'edit')
print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && !isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("Mandatory"));
elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Default from type
@ -746,6 +752,7 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'</td></tr>';
print '</table>';
print '</div>';
}
print dol_get_fiche_end();

View File

@ -53,7 +53,7 @@ if ($action == 'updateMask')
if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -142,7 +142,7 @@ elseif ($action == 'setdoc')
$draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -156,7 +156,7 @@ elseif ($action == 'setdoc')
$res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -51,7 +51,7 @@ if ($action == 'updateMask')
$maskpayment = GETPOST('maskpayment', 'alpha');
if ($maskconstpayment) $res = dolibarr_set_const($db, $maskconstpayment, $maskpayment, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -70,10 +70,10 @@ if ($action == 'setparams')
{
$freetext = GETPOST('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS', 'restricthtml'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, "PAYMENTS_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if ($error)
{

View File

@ -50,10 +50,9 @@ if ($action == "set")
$id = GETPOST('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 'int');
$account = new Account($db);
if ($account->fetch($id) > 0)
{
if ($account->fetch($id) > 0) {
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
/*
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -70,32 +69,35 @@ if ($action == "set")
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
*/
} else $error++;
} else {
$error++;
}
/* Moved to account
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
*/
if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0)
{
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
/*
if (GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") || GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END") == "")
{
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_END_TO_END", GETPOST("PAYMENTBYBANKTRANSFER_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (GETPOST("PAYMENTBYBANKTRANSFER_USTRD") || GETPOST("PAYMENTBYBANKTRANSFER_USTRD") == "")
{
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USTRD", GETPOST("PAYMENTBYBANKTRANSFER_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
*/
if (GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") || GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS") == "")
{
$res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ADDDAYS", GETPOST("PAYMENTBYBANKTRANSFER_ADDDAYS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
} elseif (!$error)
{
$db->commit();

View File

@ -55,7 +55,7 @@ if ($action == "set")
if ($account->fetch($id) > 0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
/*
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -75,21 +75,20 @@ if ($action == "set")
} else $error++;
/* Moved to account
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
*/
if (GETPOST("PRELEVEMENT_USER") > 0) {
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END") == "") {
$res = dolibarr_set_const($db, "PRELEVEMENT_END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD") == "") {
$res = dolibarr_set_const($db, "PRELEVEMENT_USTRD", GETPOST("PRELEVEMENT_USTRD"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
$res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"), 'chaine', 0, '', $conf->entity);

View File

@ -57,7 +57,7 @@ if ($action == 'updateMask') {
$maskpropal = GETPOST('maskpropal', 'alpha');
if ($maskconstpropal) $res = dolibarr_set_const($db, $maskconstpropal, $maskpropal, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -109,7 +109,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -121,7 +121,7 @@ if ($action == 'updateMask') {
$draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "PROPALE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -134,7 +134,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -145,7 +145,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'setdefaultduration') {
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -156,7 +156,7 @@ if ($action == 'updateMask') {
} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');

View File

@ -67,7 +67,7 @@ if ($action == 'update' || $action == 'add')
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (!$error)

View File

@ -96,7 +96,7 @@ if ($action == 'warehouse')
if ($value == -1 || empty($value) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
$res = dolibarr_del_const($db, "MAIN_DEFAULT_WAREHOUSE", $conf->entity);
}
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if ($action == 'specimen')

View File

@ -65,7 +65,7 @@ if ($action == 'updateMask')
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++;
if (!$error)
{
@ -170,7 +170,7 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
$res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -63,7 +63,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -194,7 +194,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER')
{
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -52,7 +52,7 @@ if ($action == 'updateMask')
$masksupplierpayment = GETPOST('masksupplierpayment', 'alpha');
if ($maskconstsupplierpayment) $res = dolibarr_set_const($db, $maskconstsupplierpayment, $masksupplierpayment, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -136,7 +136,7 @@ elseif ($action == 'setdoc')
} elseif ($action == 'setparams')
{
$res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if ($error)
{

View File

@ -55,7 +55,7 @@ if ($action == 'updateMask')
$masksupplier_proposal = GETPOST('masksupplier_proposal', 'alpha');
if ($maskconstsupplier_proposal) $res = dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -111,7 +111,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
$draft = GETPOST('SUPPLIER_PROPOSAL_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -127,7 +127,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -141,7 +141,7 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
{
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -138,7 +138,7 @@ if ($action == 'setlevel')
$res = dolibarr_set_const($db, "SYSLOG_LEVEL", $level, 'chaine', 0, '', 0);
dol_syslog("admin/syslog: level ".$level);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{
@ -146,7 +146,7 @@ if ($action == 'setlevel')
$res = dolibarr_set_const($db, "SYSLOG_FILE_SAVES", $file_saves, 'chaine', 0, '', 0);
dol_syslog("admin/syslog: file saves ".$file_saves);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
if (!$error)

View File

@ -65,7 +65,7 @@ if ($action == 'update') {
$db->begin();
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
switch ($tax_mode)
{
@ -90,13 +90,13 @@ if ($action == 'update') {
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', $valuesellproduct, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', $valuebuyproduct, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $valuesellservice, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $valuebuyservice, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva", 'alpha'), 'chaine', 0, '', $conf->entity);

View File

@ -59,7 +59,7 @@ if ($action == 'updateMask') {
$res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -113,7 +113,7 @@ elseif ($action == 'setmod') {
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -124,7 +124,7 @@ elseif ($action == 'setmod') {
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -134,7 +134,7 @@ elseif ($action == 'setmod') {
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -144,7 +144,7 @@ elseif ($action == 'setmod') {
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}
@ -152,13 +152,13 @@ elseif ($action == 'setmod') {
if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -166,7 +166,7 @@ if ($action == 'setvarother') {
{
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}
@ -175,20 +175,20 @@ if ($action == 'setvarother') {
{
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}

View File

@ -63,7 +63,7 @@ if ($action == 'setvar') {
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -73,7 +73,7 @@ if ($action == 'setvar') {
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -83,7 +83,7 @@ if ($action == 'setvar') {
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -93,7 +93,7 @@ if ($action == 'setvar') {
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -103,13 +103,13 @@ if ($action == 'setvar') {
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}
@ -117,25 +117,25 @@ if ($action == 'setvar') {
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
$param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
@ -143,7 +143,7 @@ if ($action == 'setvarother') {
{
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}
}

View File

@ -435,9 +435,6 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused = 0;
$var = false;
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
@ -461,7 +458,6 @@ if ($id)
} else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
print '<td colspan="4">';
@ -469,7 +465,7 @@ if ($id)
print '</tr>';
// Line to enter new values
print "<tr ".$bcnd[$var].">";
print '<tr class="oddeven">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
@ -570,7 +566,7 @@ if ($id)
print '&nbsp;<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;

View File

@ -67,7 +67,7 @@ if ($action == 'updateMask')
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -38,7 +38,7 @@ if ($action == 'setvalue') {
$showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha');
$res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
if (!($res > 0)) {
$error++;
}

View File

@ -62,7 +62,7 @@ if (GETPOST('action', 'alpha') == 'set')
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
if (!$error)
{

View File

@ -114,7 +114,7 @@ if ($action == 'delete')
if ($res > 0)
{
$res = $objectpage->delete($user);
if (!$res > 0)
if (!($res > 0))
{
$error++;
setEventMessages($objectpage->error, $objectpage->errors, 'errors');

View File

@ -97,6 +97,14 @@ if ($object->id > 0) {
$now = dol_now();
if ($id > 0 && empty($object->id))
{
// Load data of third party
$res = $object->fetch($id);
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
}
/*
* Actions
@ -226,6 +234,12 @@ if (empty($reshook))
}
if ($error) $action = 'edit_extras';
}
// warehouse
if ($action == 'setwarehouse' && $user->rights->societe->creer)
{
$result = $object->setWarehouse(GETPOST('fk_warehouse', 'int'));
}
}
@ -238,13 +252,6 @@ $userstatic = new User($db);
$form = new Form($db);
$formcompany = new FormCompany($db);
if ($id > 0 && empty($object->id))
{
// Load data of third party
$res = $object->fetch($id);
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
}
$title = $langs->trans("CustomerCard");
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name;
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
@ -480,7 +487,24 @@ if ($object->id > 0)
print "</td>";
print '</tr>';
}
// Warehouse
if (!empty($conf->stock->enabled))
{
$langs->load('stocks');
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->rights->societe->creer);
print '</td><td>';
if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
} else {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
}
print '</td>';
print '</tr>';
}
// Preferred shipping Method
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
print '<tr><td class="nowrap">';
@ -507,11 +531,12 @@ if ($object->id > 0)
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('IntracommReportTransportMode');
print '<td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'edittransportmode')
{
if ($action == 'edittransportmode') {
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1);
}
else {
@ -538,8 +563,7 @@ if ($object->id > 0)
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent
if (!empty($conf->adherent->enabled))
{
if (!empty($conf->adherent->enabled)) {
$langs->load("members");
$langs->load("users");
@ -547,10 +571,9 @@ if ($object->id > 0)
print '<td>';
$adh = new Adherent($db);
$result = $adh->fetch('', '', $object->id);
if ($result > 0)
{
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
print $adh->getNomUrl(1);
print $adh->getNomUrl(-1);
} else {
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
}

View File

@ -129,9 +129,6 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
//if ($thirdparty->fk_warehouse > 0) $object->warehouse_id = $thirdparty->fk_warehouse;
/*
* Actions
*/
@ -1495,6 +1492,7 @@ if ($action == 'create')
}
//Warehouse default if null
if ($soc->fk_warehouse > 0) $warehouse_id = $soc->fk_warehouse;
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;

View File

@ -1259,15 +1259,13 @@ if ($resql)
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val)
{
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
@ -1275,11 +1273,16 @@ if ($resql)
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}

View File

@ -70,7 +70,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes')
$remid = (GETPOST("remid", 'int') ? GETPOST("remid", 'int') : 0);
$discount = new DiscountAbsolute($db);
$res = $discount->fetch($remid);
if (!$res > 0)
if (!($res > 0))
{
$error++;
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');

View File

@ -1534,6 +1534,7 @@ if ($action == 'create' && $usercancreate)
}
//Warehouse default if null
if ($soc->fk_warehouse > 0) $warehouse_id = $soc->fk_warehouse;
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;

View File

@ -283,7 +283,7 @@ if ($mode == 'customer')
if ($mode == 'supplier')
{
$cat_type = Categorie::TYPE_SUPPLIER;
$cat_label = $langs->trans("Supplier").' '.lcfirst($langs->trans("Customer"));
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
}
print '<tr><td>'.$cat_label.'</td><td>';
print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);

View File

@ -289,8 +289,9 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$cat1 = GETPOST("cat1", 'alpha');
$bankaccountid = $id;
if (GETPOST('add_account', 'int') > 0) $bankaccountid = GETPOST('add_account', 'int');
if (GETPOST('add_account', 'int') > 0) {
$bankaccountid = GETPOST('add_account', 'int');
}
if (!$dateop) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
@ -307,8 +308,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
}
if (!$bankaccountid > 0)
{
if (!$bankaccountid > 0) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors');
}
@ -318,8 +318,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
$error++;
}*/
if (!$error && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT))
{
if (!$error && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
$objecttmp = new Account($db);
$objecttmp->fetch($bankaccountid);
$insertid = $objecttmp->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user, '', '', $search_accountancy_code);

View File

@ -199,7 +199,7 @@ $chargestatic = new ChargeSociales($db);
$memberstatic = new Adherent($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$paymentvatstatic = new TVA($db);
$paymentvatstatic = new Tva($db);
$bankstatic = new Account($db);
$banklinestatic = new AccountLine($db);
$remisestatic = new RemiseCheque($db);

View File

@ -265,10 +265,8 @@ print '</td></tr>';
// Bank account
if (!empty($conf->banque->enabled))
{
if ($object->fk_account > 0)
{
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0)
{
if ($object->fk_account > 0) {
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0) {
dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php');
$bordereau = new RemiseCheque($db);
$bordereau->fetch($bankline->fk_bordereau);
@ -285,7 +283,12 @@ if (!empty($conf->banque->enabled))
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td>';
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
if ($object->fk_account > 0) {
print $bankline->getNomUrl(1, 0, 'showconciliatedandaccounted');
} else {
$langs->load("admin");
print '<span class="opacitymedium">'.$langs->trans("NoRecordFoundIBankcAccount", $langs->transnoentitiesnoconv("Module85Name")).'</span>';
}
print '</td>';
print '</tr>';
}

View File

@ -223,7 +223,7 @@ if ($action == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
$datepaye = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : 0;
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (GETPOSTISSET("remonth") ? $datepaye : -1) : '';
print $form->selectDate($datepayment, '', '', '', 0, "add_payment", 1, 1, 0, '', '', $charge->date_ech, '', 1, $langs->trans("DateOfSocialContribution"));
print "</td>";
print '</tr>';
@ -236,7 +236,7 @@ if ($action == 'create')
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
print '<td>';
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid") : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list
print '</td></tr>';
// Number

View File

@ -54,6 +54,8 @@ $mesg = ''; $error = 0; $errors = array();
$action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view');
$confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
@ -311,9 +313,9 @@ if (empty($reshook))
}
}
if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact->creer)
if ($action == 'update' && empty($cancel) && $user->rights->societe->contact->creer)
{
if (empty(GETPOST("lastname", 'alpha')))
if (!GETPOST("lastname", 'alpha'))
{
$error++; $errors = array($langs->trans("ErrorFieldRequired", $langs->transnoentities("Name").' / '.$langs->transnoentities("Label")));
$action = 'edit';
@ -337,6 +339,7 @@ if (empty($reshook))
{
$contactid = GETPOST("contactid", 'int');
$object->fetch($contactid);
$object->fetchRoles($contactid);
// Photo save
$dir = $conf->societe->multidir_output[$object->entity]."/contact/".$object->id."/photos";
@ -425,7 +428,8 @@ if (empty($reshook))
$object->priv = (string) GETPOST("priv", 'int');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->roles = GETPOST("roles", 'array');
$object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
@ -661,8 +665,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code');
print '</td></tr>';
// Job position
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("poste", 'alpha') ?GETPOST("poste", 'alpha') : $object->poste).'"></td>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="255" value="'.dol_escape_htmltag(GETPOSTISSET("poste") ?GETPOST("poste", 'alphanohtml') : $object->poste).'"></td>';
$colspan = 3;
if ($conf->use_javascript_ajax && $socid > 0) $colspan = 2;
@ -964,8 +969,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", "aZ09") : $object->civility_code, 'civility_code');
print '</td></tr>';
// Job position
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="80" value="'.(GETPOSTISSET("poste") ? GETPOST("poste") : $object->poste).'"></td></tr>';
print '<td colspan="3"><input name="poste" id="title" type="text" class="minwidth100" maxlength="255" value="'.dol_escape_htmltag(GETPOSTISSET("poste") ? GETPOST("poste", 'alphanohtml') : $object->poste).'"></td></tr>';
// Address
print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>';

View File

@ -145,14 +145,32 @@ class Contact extends CommonObject
*/
public $town;
public $state_id; // Id of department
public $state_code; // Code of department
public $state; // Label of department
/**
* @var int // Id of department
*/
public $state_id;
/**
* @var string // Code of department
*/
public $state_code;
/**
* @var string // Label of department
*/
public $state;
public $poste; // Position
public $socid; // fk_soc
public $statut; // 0=inactif, 1=actif
/**
* @var int Thirdparty ID
*/
public $socid;
/**
* @var int 0=inactive, 1=active
*/
public $statut;
public $code;
@ -247,7 +265,14 @@ class Contact extends CommonObject
public $ref_commande; // Nb de reference commande pour lequel il est contact
public $ref_propal; // Nb de reference propal pour lequel il est contact
/**
* @var int user ID
*/
public $user_id;
/**
* @var string user login
*/
public $user_login;
// END MODULEBUILDER PROPERTIES
@ -259,12 +284,19 @@ class Contact extends CommonObject
*/
public $oldcopy; // To contains a clone of this when we need to save old properties of object
public $roles = array();
/**
* @var array roles
*/
public $roles;
public $cacheprospectstatus = array();
public $fk_prospectlevel;
public $stcomm_id;
public $statut_commercial;
/**
* @var string picto
*/
public $stcomm_picto;
/**
@ -335,8 +367,7 @@ class Contact extends CommonObject
$sql = "SELECT count(sp.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
if (!$user->rights->societe->client->voir && !$user->socid)
{
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
@ -344,13 +375,13 @@ class Contact extends CommonObject
}
$sql .= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
$sql .= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
if ($user->socid > 0) $sql .= " AND sp.fk_soc = ".$user->socid;
if ($user->socid > 0) {
$sql .= " AND sp.fk_soc = ".$user->socid;
}
$resql = $this->db->query($sql);
if ($resql)
{
while ($obj = $this->db->fetch_object($resql))
{
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$this->nb["contacts"] = $obj->nb;
}
$this->db->free($resql);
@ -402,8 +433,11 @@ class Contact extends CommonObject
$sql .= ", import_key";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."',";
if ($this->socid > 0) $sql .= " ".$this->db->escape($this->socid).",";
else $sql .= "null,";
if ($this->socid > 0) {
$sql .= " ".$this->db->escape($this->socid).",";
} else {
$sql .= "null,";
}
$sql .= "'".$this->db->escape($this->lastname)."',";
$sql .= "'".$this->db->escape($this->firstname)."',";
$sql .= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "null").",";
@ -721,8 +755,7 @@ class Contact extends CommonObject
if ($this->firstname && !empty($conf->global->LDAP_CONTACT_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname;
if ($this->poste) $info["title"] = $this->poste;
if ($this->socid > 0)
{
if ($this->socid > 0) {
$soc = new Societe($this->db);
$soc->fetch($this->socid);
@ -757,8 +790,7 @@ class Contact extends CommonObject
$info["phpgwContactCatId"] = 0;
$info["phpgwContactAccess"] = "public";
if (dol_strlen($this->egroupware_id) == 0)
{
if (dol_strlen($this->egroupware_id) == 0) {
$this->egroupware_id = 1;
}
@ -856,7 +888,7 @@ class Contact extends CommonObject
* @param User $user Load also alerts of this user (subscribing to alerts) that want alerts about this contact
* @param string $ref_ext External reference, not given by Dolibarr
* @param string $email Email
* @param int $loadalsoroles Load also roles
* @param int $loadalsoroles Load also roles. Try to always 0 here and load roles with a separate call of fetchRoles().
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
*/
public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoroles = 0)
@ -1615,10 +1647,11 @@ class Contact extends CommonObject
}
/**
* Fetch Roles for a contact
* Fetch roles (default contact of some companies) for the current contact.
* This load the array ->roles.
*
* @return float|int
* @throws Exception
* @return int <0 if KO, Nb of roles found if OK
* @see updateRoles()
*/
public function fetchRoles()
{
@ -1626,25 +1659,23 @@ class Contact extends CommonObject
$error = 0;
$num = 0;
$sql = "SELECT tc.rowid, tc.element, tc.source, tc.code, tc.libelle, sc.rowid as contactroleid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql .= " ON tc.rowid = sc.fk_c_type_contact";
$sql .= " AND sc.fk_socpeople = ".$this->id;
$sql = "SELECT tc.rowid, tc.element, tc.source, tc.code, tc.libelle as label, sc.rowid as contactroleid, sc.fk_soc as socid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc, ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql .= " WHERE tc.rowid = sc.fk_c_type_contact";
$sql .= " AND tc.source = 'external' AND tc.active=1";
$sql .= " AND sc.fk_socpeople = ".$this->id;
$sql .= " AND sc.entity IN (".getEntity('societe').')';
dol_syslog(__METHOD__, LOG_DEBUG);
$this->roles = array();
$resql = $this->db->query($sql);
if ($resql) {
$this->roles = array();
$num = $this->db->num_rows($resql);
if ($num > 0) {
while ($obj = $this->db->fetch_object($resql)) {
$transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
$libelle_element = $langs->trans('ContactDefault_'.$obj->element);
$this->roles[$obj->contactroleid] = array('id'=>$obj->rowid, 'element'=>$obj->element, 'source'=>$obj->source, 'code'=>$obj->code, 'label'=>$libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle));
$this->roles[$obj->contactroleid] = array('id'=>$obj->rowid, 'socid'=>$obj->socid, 'element'=>$obj->element, 'source'=>$obj->source, 'code'=>$obj->code, 'label'=>$libelle_element.' - '.($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->label));
}
}
} else {
@ -1706,10 +1737,11 @@ class Contact extends CommonObject
}
/**
* Updates Roles
* Updates all roles (default contact for companies) according to values inside the ->roles array.
* This is called by update of contact.
*
* @return float|int
* @throws Exception
* @see fetchRoles()
*/
public function updateRoles()
{
@ -1717,11 +1749,12 @@ class Contact extends CommonObject
$error = 0;
if (!isset($this->roles)) return; // Avoid to loose roles when property not set
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid." AND fk_socpeople=".$this->id; ;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".$this->id." AND entity IN (".getEntity("societe_contact").")";
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = $this->db->lasterror().' sql='.$sql;
@ -1729,25 +1762,40 @@ class Contact extends CommonObject
} else {
if (count($this->roles) > 0) {
foreach ($this->roles as $keyRoles => $valRoles) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_contacts";
$sql .= " (entity,";
$sql .= "date_creation,";
$sql .= "fk_soc,";
$sql .= "fk_c_type_contact,";
$sql .= "fk_socpeople) ";
$sql .= " VALUES (".$conf->entity.",";
$sql .= "'".$this->db->idate(dol_now())."',";
$sql .= $this->socid.", ";
$sql .= $valRoles." , ";
$sql .= $this->id;
$sql .= ")";
dol_syslog(__METHOD__, LOG_DEBUG);
$idrole = 0;
if (is_array($valRoles)) {
$idrole = $valRoles['id'];
} else {
$idrole = $valRoles;
}
$result = $this->db->query($sql);
if (!$result)
{
$this->errors[] = $this->db->lasterror().' sql='.$sql;
$error++;
$socid = 0;
if (is_array($valRoles)) {
$socid = $valRoles['socid'];
} else {
$socid = $this->socid;
}
if ($socid > 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_contacts";
$sql .= " (entity,";
$sql .= "date_creation,";
$sql .= "fk_soc,";
$sql .= "fk_c_type_contact,";
$sql .= "fk_socpeople) ";
$sql .= " VALUES (".$conf->entity.",";
$sql .= "'".$this->db->idate(dol_now())."',";
$sql .= $socid.", ";
$sql .= $idrole." , ";
$sql .= $this->id;
$sql .= ")";
$result = $this->db->query($sql);
if (!$result)
{
$this->errors[] = $this->db->lasterror().' sql='.$sql;
$error++;
}
}
}
}
@ -1971,8 +2019,7 @@ class Contact extends CommonObject
{
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($this->email)."'";
$resql = $this->db->query($sql);
if ($resql)
{
if ($resql) {
$obj = $this->db->fetch_object($resql);
$this->no_email = $obj->nb;
return 1;

View File

@ -716,15 +716,13 @@ while ($i < min($num, $limit))
$listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) {
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0)
{
} elseif ($nbofsalesrepresentative > 0) {
$userstatic = new User($db);
$j = 0;
foreach ($listsalesrepresentatives as $val)
{
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
@ -732,11 +730,17 @@ while ($i < min($num, $limit))
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->phone = $val['phone'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
print ($nbofsalesrepresentative < 3) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}

View File

@ -590,7 +590,8 @@ if (!$error && $massaction == 'confirm_presend')
}
}
if ($massaction == 'confirm_createbills') // Create bills from orders
// TODO Move this action into commande/list.php if called only by this page.
if ($massaction == 'confirm_createbills') // Create bills from orders.
{
$orders = GETPOST('toselect', 'array');
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
@ -600,6 +601,8 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
$TFactThird = array();
$nb_bills_created = 0;
$lastid= 0;
$lastref = '';
$db->begin();
@ -609,8 +612,9 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
if ($cmd->fetch($id_order) <= 0) continue;
$objecttmp = new Facture($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
else {
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
$objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
} else {
// Load extrafields of order
$cmd->fetch_optionals();
@ -636,7 +640,11 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
$res = $objecttmp->create($user);
if ($res > 0) $nb_bills_created++;
if ($res > 0) {
$nb_bills_created++;
$lastref = $objecttmp->ref;
$lastid = $objecttmp->id;
}
}
if ($objecttmp->id > 0)
@ -818,7 +826,14 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
if (!$error)
{
$db->commit();
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
if ($nb_bills_created == 1) {
$texttoshow = $langs->trans('BillXCreated', '{s1}');
$texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode($lastid).'">'.$lastref.'</a>', $texttoshow);
setEventMessages($texttoshow, null, 'mesgs');
} else {
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
}
// Make a redirect to avoid to bill twice if we make a refresh or back
$param = '';

View File

@ -21,7 +21,7 @@
* \brief Code for actions on setting notes of object page
*/
// $error must have been initialized to 0
// $action must be defined
// $arrayofparameters must be set for action 'update'
// $nomessageinupdate can be set to 1
@ -31,7 +31,6 @@ if ($action == 'update' && is_array($arrayofparameters))
{
$db->begin();
$ok = true;
foreach ($arrayofparameters as $key => $val)
{
// Modify constant only if key was posted (avoid resetting key to the null value)
@ -40,7 +39,7 @@ if ($action == 'update' && is_array($arrayofparameters))
$result = dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result < 0)
{
$ok = false;
$error++;
break;
}
}
@ -74,7 +73,7 @@ if ($action == 'setModuleOptions')
if ($param)
{
$res = dolibarr_set_const($db, $param, $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!($res > 0)) $error++;
}
}
}
@ -93,7 +92,11 @@ if ($action == 'setModuleOptions')
if (!$tmpdir) {
unset($listofdir[$key]); continue;
}
if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
if (!is_dir($tmpdir)) {
if (empty($nomessageinsetmoduleoptions)) {
setEventMessages($langs->trans("ErrorDirNotFound", $tmpdir), null, 'warnings');
}
}
else {
$upload_dir = $tmpdir;
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -79,7 +79,7 @@ class box_clients extends ModeleBoxes
$this->max = $max;
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
$thirdpartystatic = new Client($this->db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max));

File diff suppressed because it is too large Load Diff

View File

@ -3669,7 +3669,7 @@ abstract class CommonObject
* @param string $field_select name of field we need to get a list
* @param string $field_where name of field of object we need to get linked items
* @param string $table_element name of association table
* @return array
* @return array Array of record
*/
static public function getAllItemsLinkedByObjectID($fk_object_where, $field_select, $field_where, $table_element)
{
@ -3679,7 +3679,7 @@ abstract class CommonObject
global $db;
$sql = 'SELECT '.$field_select.' FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.$fk_object_where;
$sql = 'SELECT '.$field_select.' FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.((int) $fk_object_where);
$resql = $db->query($sql);
$TRes = array();
@ -3698,7 +3698,7 @@ abstract class CommonObject
* @param int $fk_object_where id of object we need to remove linked items
* @param string $field_where name of field of object we need to delete linked items
* @param string $table_element name of association table
* @return int
* @return int <0 if KO, 0 if nothing done, >0 if OK and something done
*/
static public function deleteAllItemsLinkedByObjectID($fk_object_where, $field_where, $table_element)
{
@ -6005,8 +6005,14 @@ abstract class CommonObject
} elseif (preg_match('/^(integer|link):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3] => 'N');
$type = 'link';
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
} elseif (preg_match('/^(sellist):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N');
$type = 'sellist';
} elseif (preg_match('/^(sellist):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type = 'sellist';
} elseif (preg_match('/^(sellist):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[2].':'.$reg[3] => 'N');
$type = 'sellist';
} elseif (preg_match('/varchar\((\d+)\)/', $val['type'], $reg)) {
$param['options'] = array();
@ -6037,8 +6043,7 @@ abstract class CommonObject
$objectid = $this->id;
if ($computed)
{
if ($computed) {
if (!preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
else return '';
}
@ -6047,26 +6052,20 @@ abstract class CommonObject
if (empty($morecss) && !empty($val['css'])) {
$morecss = $val['css'];
} elseif (empty($morecss)) {
if ($type == 'date')
{
if ($type == 'date') {
$morecss = 'minwidth100imp';
} elseif ($type == 'datetime' || $type == 'link') // link means an foreign key to another primary id
{
} elseif ($type == 'datetime' || $type == 'link') { // link means an foreign key to another primary id
$morecss = 'minwidth200imp';
} elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type))
{
} elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) {
$morecss = 'maxwidth75';
} elseif ($type == 'url') {
$morecss = 'minwidth400';
} elseif ($type == 'boolean')
{
} elseif ($type == 'boolean') {
$morecss = '';
} else {
if (round($size) < 12)
{
if (round($size) < 12) {
$morecss = 'minwidth100';
} elseif (round($size) <= 48)
{
} elseif (round($size) <= 48) {
$morecss = 'minwidth200';
} else {
$morecss = 'minwidth400';
@ -6173,24 +6172,20 @@ abstract class CommonObject
$keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid');
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4]))
{
if (strpos($InfoFieldList[4], 'extra.') !== false)
{
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$keyList = 'main.'.$InfoFieldList[2].' as rowid';
} else {
$keyList = $InfoFieldList[2].' as rowid';
}
}
if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3]))
{
if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) {
list($parentName, $parentField) = explode('|', $InfoFieldList[3]);
$keyList .= ', '.$parentField;
}
$fields_label = explode('|', $InfoFieldList[1]);
if (is_array($fields_label))
{
if (is_array($fields_label)) {
$keyList .= ', ';
$keyList .= implode(', ', $fields_label);
}
@ -6467,13 +6462,13 @@ abstract class CommonObject
if (!preg_match('/search_/', $keyprefix)) {
if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button
if ($this->fields[$key]['picto']) {
if (!empty($this->fields[$key]['picto'])) {
$morecss .= ' widthcentpercentminusxx';
} else {
$morecss .= ' widthcentpercentminusx';
}
} else {
if ($this->fields[$key]['picto']) {
if (!empty($this->fields[$key]['picto'])) {
$morecss .= ' widthcentpercentminusx';
}
}
@ -6585,13 +6580,18 @@ abstract class CommonObject
$param['options'] = array();
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
{
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
$type = 'link';
$param['options'] = array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2] => 'N');
$type = 'sellist';
}
$langfile = $val['langfile'];
@ -6682,8 +6682,7 @@ abstract class CommonObject
$selectkey = "rowid";
$keyList = 'rowid';
if (count($InfoFieldList) >= 3)
{
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
$selectkey = $InfoFieldList[2];
$keyList = $InfoFieldList[2].' as rowid';
}
@ -7113,7 +7112,17 @@ abstract class CommonObject
{
var val = $("select[name=\""+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
if(typeof val == "string"){
if(val != "") {
var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone();
$("select[name=\""+child_list+"\"] option[parent]").remove();
$("select[name=\""+child_list+"\"]").append(options);
} else {
var options = orig_select.find("option[parent]").clone();
$("select[name=\""+child_list+"\"] option[parent]").remove();
$("select[name=\""+child_list+"\"]").append(options);
}
} else if(val > 0) {
var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone();
$("select[name=\""+child_list+"\"] option[parent]").remove();
$("select[name=\""+child_list+"\"]").append(options);
@ -7131,12 +7140,36 @@ abstract class CommonObject
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
//Hide daughters lists
if ($("#"+child_list).val() == 0 && $("#"+parent_list).val() == 0){
$("#"+child_list).hide();
//Show mother lists
} else if ($("#"+parent_list).val() != 0){
$("#"+parent_list).show();
}
//Show the child list if the parent list value is selected
$("select[name=\""+parent_list+"\"]").click(function() {
if ($(this).val() != 0){
$("#"+child_list).show()
}
});
//When we change parent list
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
//Select the value 0 on child list after a change on the parent list
$("#"+child_list).val(0).trigger("change");
//Hide child lists if the parent value is set to 0
if ($(this).val() == 0){
$("#"+child_list).hide();
}
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
});
});
}
setListDependencies();
});
</script>'."\n";

View File

@ -4052,8 +4052,7 @@ class Form
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected)))
{
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
$out .= '<option value="'.$obj->rowid.'" selected>';
} else {
$out .= '<option value="'.$obj->rowid.'">';

View File

@ -1174,7 +1174,9 @@ class FormFile
print_liste_field_titre('Size', $url, "size", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('Date', $url, "date", "", $param, '', $sortfield, $sortorder, 'center ');
if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) print_liste_field_titre('', $url, "", "", $param, '', $sortfield, $sortorder, 'center '); // Preview
// Shared or not - Hash of file
print_liste_field_titre('');
// Action button
print_liste_field_titre('');
if (!$disablemove) print_liste_field_titre('');
print "</tr>\n";
@ -1285,12 +1287,10 @@ class FormFile
print '</td>';
}
// Hash of file (only if we are in a mode where a scan of dir were done and we have id of file in ECM table)
// Shared or not - Hash of file
print '<td class="center">';
if ($relativedir && $filearray[$key]['rowid'] > 0)
{
if ($editline)
{
if ($relativedir && $filearray[$key]['rowid'] > 0) { // only if we are in a mode where a scan of dir were done and we have id of file in ECM table
if ($editline) {
print $langs->trans("FileSharedViaALink").' ';
print '<input class="inline-block" type="checkbox" name="shareenabled"'.($file['share'] ? ' checked="checked"' : '').' /> ';
} else {
@ -1318,7 +1318,7 @@ class FormFile
}
print '</td>';
// Actions buttons
// Actions buttons (1 column or 2 if !disablemove)
if (!$editline)
{
// Delete or view link
@ -1406,6 +1406,7 @@ class FormFile
else print $textifempty;
print '</td></tr>';
}
print "</table>";
print '</div>';
@ -1479,7 +1480,7 @@ class FormFile
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre center">';
print '<td class="liste_titre right">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
@ -1493,7 +1494,7 @@ class FormFile
print_liste_field_titre("Documents2", $url, "name", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Size", $url, "size", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Date", $url, "date", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('', '', '');
print_liste_field_titre("Shared", $url, 'share', '', $param, '', $sortfield, $sortorder, 'right ');
print '</tr>'."\n";
// To show ref or specific information according to view to show (defined by $module)
@ -1582,7 +1583,7 @@ class FormFile
//var_dump($sortfield.' - '.$sortorder);
if ($sortfield && $sortorder) // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
{
$filearray = dol_sort_array($filearray, $sortfield, $sortorder);
$filearray = dol_sort_array($filearray, $sortfield, $sortorder, 1);
}
}
@ -1714,7 +1715,7 @@ class FormFile
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
print img_picto($langs->trans("FileSharedViaALink"), 'globe').' ';
print '<input type="text" class="quatrevingtpercent width100" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
print '<input type="text" class="quatrevingtpercent width100 nopadding" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
}
//if (! empty($useinecm) && $useinecm != 6) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
//if ($forcedownload) print '&attachment=1';
@ -1722,7 +1723,9 @@ class FormFile
//print img_view().'</a> &nbsp; ';
//if ($permissiontodelete) print '<a href="'.$url.'?id='.$object->id.'&section='.$_REQUEST["section"].'&action=delete&token='.newToken().'&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
//else print '&nbsp;';
print "</td></tr>\n";
print "</td>";
print "</tr>\n";
}
}

View File

@ -1139,7 +1139,7 @@ class FormMail extends Form
}
/**
* get Html For Asking for Deliveriy Receipt
* get Html For Asking for Delivery Receipt
*
* @return string html
*/
@ -1452,7 +1452,9 @@ class FormMail extends Form
// Create dynamic tags for __PRODUCT_EXTRAFIELD_FIELD__
if (!empty($line->fk_product)) {
if (!is_object($extrafields)) $extrafields = new ExtraFields($this->db);
if (!is_object($extrafields)) {
$extrafields = new ExtraFields($this->db);
}
$extrafields->fetch_name_optionals_label('product', true);
$product = new Product($this->db);
$product->fetch($line->fk_product, '', '', 1);
@ -1553,7 +1555,9 @@ class FormMail extends Form
}
foreach ($tmparray as $key => $val) {
if (empty($val)) $tmparray[$key] = $key;
if (empty($val)) {
$tmparray[$key] = $key;
}
}
return $tmparray;

View File

@ -352,7 +352,7 @@ class FormProjets
if (empty($option_only) && !empty($conf->use_javascript_ajax))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
$out .= $comboenhancement;
$morecss = 'minwidth200 maxwidth500';
}
@ -388,7 +388,7 @@ class FormProjets
continue;
}
$labeltoshow = '';
$labeltoshow = ''; $titletoshow = '';
$disabled = 0;
if ($obj->fk_statut == Project::STATUS_DRAFT)
@ -408,32 +408,39 @@ class FormProjets
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow .= ' '.dol_trunc($obj->title, $maxlength);
$titletoshow = $labeltoshow;
if ($obj->name) $labeltoshow .= ' ('.$obj->name.')';
if ($obj->name) {
$labeltoshow .= ' ('.$obj->name.')';
$titletoshow .= ' <span class="opacitymedium">('.$obj->name.')</span>';
}
$disabled = 0;
if ($obj->fk_statut == Project::STATUS_DRAFT)
{
if ($obj->fk_statut == Project::STATUS_DRAFT) {
$disabled = 1;
$labeltoshow .= ' - '.$langs->trans("Draft");
} elseif ($obj->fk_statut == Project::STATUS_CLOSED)
{
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Draft").'</span>';
} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
if ($discard_closed == 2) $disabled = 1;
$labeltoshow .= ' - '.$langs->trans("Closed");
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("Closed").'</span>';
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
$disabled = 1;
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
$titletoshow .= ' - <span class="opacitymedium">'.$langs->trans("LinkedToAnotherCompany").'</span>';
}
$labeltoshow .= ' - ';
$titletoshow .= ' - ';
}
// Label for task
$labeltoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
$titletoshow .= $obj->tref.' '.dol_trunc($obj->tlabel, $maxlength);
if (!empty($selected) && $selected == $obj->rowid)
{
$out .= '<option value="'.$obj->rowid.'" selected';
$out .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
$out .= '>'.$labeltoshow.'</option>';
} else {
@ -445,6 +452,7 @@ class FormProjets
if ($disabled) $resultat .= ' disabled';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat .= ' data-html="'.dol_escape_htmltag($titletoshow).'"';
$resultat .= '>';
$resultat .= $labeltoshow;
$resultat .= '</option>';

View File

@ -408,7 +408,7 @@ class FormTicket
{
$formproject = new FormProjets($this->db);
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>';
}

View File

@ -37,8 +37,7 @@ class InfoBox
{
global $conf;
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2)
{
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
return array(
0 => 'Home',
27 => 'AccountancyHome'
@ -95,20 +94,22 @@ class InfoBox
$boxes = array();
$confuserzone = 'MAIN_BOXES_'.$zone;
if ($mode == 'activated') // activated
{
if ($mode == 'activated') { // activated
$sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,";
$sql .= " d.rowid as box_id, d.file, d.note, d.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
$sql .= " WHERE b.box_id = d.rowid";
$sql .= " AND b.entity IN (0,".$conf->entity.")";
if ($zone >= 0) $sql .= " AND b.position = ".$zone;
if (is_object($user)) $sql .= " AND b.fk_user IN (0,".$user->id.")";
else $sql .= " AND b.fk_user = 0";
if ($zone >= 0) {
$sql .= " AND b.position = ".$zone;
}
if (is_object($user)) {
$sql .= " AND b.fk_user IN (0,".$user->id.")";
} else {
$sql .= " AND b.fk_user = 0";
}
$sql .= " ORDER BY b.box_order";
}
else // available
{
} else { // available
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
$sql .= " WHERE d.entity IN (0,".$conf->entity.")";
@ -116,19 +117,15 @@ class InfoBox
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
if ($resql) {
$num = $db->num_rows($resql);
$j = 0;
while ($j < $num)
{
while ($j < $num) {
$obj = $db->fetch_object($resql);
if (!in_array($obj->box_id, $excludelist))
{
if (!in_array($obj->box_id, $excludelist)) {
$regs = array();
if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs))
{
if (preg_match('/^([^@]+)@([^@]+)$/i', $obj->file, $regs)) {
$boxname = preg_replace('/\.php$/i', '', $regs[1]);
$module = $regs[2];
$relsourcefile = "/".$module."/core/boxes/".$boxname.".php";
@ -143,8 +140,7 @@ class InfoBox
// the "enabled" condition for modules forbidden for external users and the depends condition can be done.
// Goal is to avoid making a "new" done for each boxes returned by select.
dol_include_once($relsourcefile);
if (class_exists($boxname))
{
if (class_exists($boxname)) {
$box = new $boxname($db, $obj->note); // Constructor may set properties like box->enabled. obj->note is note into box def, not user params.
//$box=new stdClass();
@ -159,8 +155,7 @@ class InfoBox
if ($mode == 'activated' && !is_object($user)) // List of activated box was not yet personalized into database
{
if (is_numeric($box->box_order))
{
if (is_numeric($box->box_order)) {
if ($box->box_order % 2 == 1) $box->box_order = 'A'.$box->box_order;
elseif ($box->box_order % 2 == 0) $box->box_order = 'B'.$box->box_order;
}
@ -172,14 +167,11 @@ class InfoBox
// Filter on box->enabled (used for example by box_comptes)
// Filter also on box->depends. Example: array("product|service") or array("contrat", "service")
$enabled = $box->enabled;
if (isset($box->depends) && count($box->depends) > 0)
{
foreach ($box->depends as $moduleelem)
{
if (isset($box->depends) && count($box->depends) > 0) {
foreach ($box->depends as $moduleelem) {
$arrayelem = explode('|', $moduleelem);
$tmpenabled = 0; // $tmpenabled is used for the '|' test (OR)
foreach ($arrayelem as $module)
{
foreach ($arrayelem as $module) {
$tmpmodule = preg_replace('/@[^@]+/', '', $module);
if (!empty($conf->$tmpmodule->enabled)) $tmpenabled = 1;
//print $boxname.'-'.$module.'-module enabled='.(empty($conf->$tmpmodule->enabled)?0:1).'<br>';
@ -241,8 +233,7 @@ class InfoBox
$tab = array();
$confuserzone = 'MAIN_BOXES_'.$zone;
$tab[$confuserzone] = 1;
if (dol_set_user_param($db, $conf, $user, $tab) < 0)
{
if (dol_set_user_param($db, $conf, $user, $tab) < 0) {
$error = $db->lasterror();
$db->rollback();
return -3;
@ -288,8 +279,7 @@ class InfoBox
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
$result = $db->query($sql);
if ($result < 0)
{
if ($result < 0) {
$error++;
break;
}

View File

@ -290,7 +290,7 @@ class Utils
if (!empty($dolibarr_main_db_pass))
{
$paramcrypted .= ' -p"'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'"';
$paramclear .= ' -p"'.str_replace(array('"', '`'), array('\"', '\`'), $dolibarr_main_db_pass).'"';
$paramclear .= ' -p"'.str_replace(array('"', '`', '$'), array('\"', '\`', '\$'), $dolibarr_main_db_pass).'"';
}
$handle = '';

View File

@ -37,20 +37,26 @@ class DoliDBPgsql extends DoliDB
{
//! Database type
public $type = 'pgsql'; // Name of manager
//! Database label
const LABEL = 'PostgreSQL'; // Label of manager
//! Charset
public $forcecharset = 'UTF8'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
public $forcecollate = ''; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN = '9.0.0'; // Version min database
/** @var resource Resultset of last query */
/** @var resource|boolean Resultset of last query */
private $_results;
public $unescapeslashquot;
public $standard_conforming_strings;
/**
* Constructor.
* This create an opened connexion to a database server and eventually to a database

View File

@ -1870,11 +1870,6 @@ function email_admin_prepare_head()
}
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates';
$h++;
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
$head[$h][1] = $langs->trans("EmailSenderProfiles");
@ -1882,6 +1877,11 @@ function email_admin_prepare_head()
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("EMailTemplates");
$head[$h][2] = 'templates';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'email_admin', 'remove');
return $head;

View File

@ -687,7 +687,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
$out = dol_string_nohtmltag($out, 0);
}
break;
case 'alphawithlgt': // No " and no ../ but we keep < > tags. Can be used for email string like "Name <email>"
case 'alphawithlgt': // No " and no ../ but we keep balanced < > tags with no special chars inside. Can be used for email string like "Name <email>"
if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
@ -3269,7 +3269,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'intervention', 'label', 'language', 'link', 'list', 'listlight', 'lot',
'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label',
@ -3280,7 +3280,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement',
'off', 'on', 'order',
'paiment', 'play', 'pdf', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
@ -3317,7 +3317,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group',
'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'group'=>'users',
'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
@ -3406,7 +3406,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944',
'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999',
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'uparrow'=>'#555', 'globe-americas'=>'#aaa',
@ -5763,7 +5763,7 @@ function picto_required()
* @param string $stringtoclean String to clean
* @param integer $removelinefeed 1=Replace all new lines by 1 space, 0=Only ending new lines are removed others are replaced with \n, 2=Ending new lines are removed but others are kept with a same number of \n than nb of <br> when there is both "...<br>\n..."
* @param string $pagecodeto Encoding of input/output string
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag)
* @param integer $strip_tags 0=Use internal strip, 1=Use strip_tags() php function (bugged when text contains a < char that is not for a html tag or when tags is not closed like '<img onload=aaa')
* @param integer $removedoublespaces Replace double space into one space
* @return string String cleaned
*
@ -5784,10 +5784,10 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
} else {
$pattern = "/<[^<>]+>/";
// Example of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
$temp = preg_replace($pattern, "", $temp); // pass 1
// $temp after pass 1: <a href="/myurl" title="A title">0000-021
$temp = preg_replace($pattern, "", $temp); // pass 2
// $temp after pass 2: 0000-021
$temp = preg_replace($pattern, "", $temp); // pass 1 - $temp after pass 1: <a href="/myurl" title="A title">0000-021
$temp = preg_replace($pattern, "", $temp); // pass 2 - $temp after pass 2: 0000-021
// removed '<' into non closing html tags like '<a'
$temp = preg_replace('/<(\w+)/', '\1', $temp);
}
$temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto);
@ -7145,7 +7145,7 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* @param array $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects)
* @param string $index Key in array to use for sorting criteria
* @param int $order Sort order ('asc' or 'desc')
* @param int $natsort 1=use "natural" sort (natsort), 0=use "standard" sort (asort)
* @param int $natsort 1=use "natural" sort (natsort) for a search criteria thats is strings or unknown, 0=use "standard" sort (asort) for numbers
* @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
* @param int $keepindex If 0 and index key of array to sort is a numeric, than index will be rewrote. If 1 or index key is not numeric, key for index is kept after sorting.
* @return array Sorted array
@ -7171,9 +7171,17 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
}
if (!$natsort) {
($order == 'asc') ? asort($temp) : arsort($temp);
if ($order == 'asc') {
asort($temp);
} else {
arsort($temp);
}
} else {
($case_sensitive) ? natsort($temp) : natcasesort($temp);
if ($case_sensitive) {
natsort($temp);
} else {
natcasesort($temp); // natecasesort is not sensible to case
}
if ($order != 'asc') $temp = array_reverse($temp, true);
}

View File

@ -476,6 +476,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$projectstatic->public = $lines[$i]->public;
$projectstatic->title = $lines[$i]->projectlabel;
$projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
$projectstatic->status = $lines[$i]->projectstatus;
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = $lines[$i]->ref;
@ -881,6 +882,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
$projectstatic->ref = $lines[$i]->project_ref;
$projectstatic->title = $lines[$i]->project_label;
$projectstatic->public = $lines[$i]->public;
$projectstatic->status = $lines[$i]->project_status;
$taskstatic->id = $lines[$i]->task_id;
$taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
@ -1116,6 +1118,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
$projectstatic->ref = $lines[$i]->projectref;
$projectstatic->title = $lines[$i]->projectlabel;
$projectstatic->public = $lines[$i]->public;
$projectstatic->status = $lines[$i]->projectstatus;
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
@ -1489,6 +1492,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
$projectstatic->title = $lines[$i]->projectlabel;
$projectstatic->public = $lines[$i]->public;
$projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
$projectstatic->status = $lines[$i]->projectstatus;
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
@ -1843,6 +1847,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
$projectstatic->title = $lines[$i]->projectlabel;
$projectstatic->public = $lines[$i]->public;
$projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
$projectstatic->status = $lines[$i]->projectstatus;
$taskstatic->id = $lines[$i]->id;
$taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);

View File

@ -52,8 +52,8 @@ function dolSaveMasterFile($filemaster)
}
/**
* Save content of a page on disk.
* It can save file into root directory or into language subdirectory.
* Save an alias page on disk (A page that include the reference page).
* It saves file into the root directory but also into language subdirectory.
*
* @param string $filealias Full path of filename to generate
* @param Website $object Object website
@ -82,11 +82,11 @@ function dolSavePageAlias($filealias, $object, $objectpage)
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
// Save also alias into language subdirectory if we have to
// Save also alias into language subdirectory if it is not a main language
if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) {
$dirname = dirname($filealias);
$filename = basename($filealias);
$filealias = $dirname.'/'.$objectpage->lang.'/'.$filename;
$filealiassub = $dirname.'/'.$objectpage->lang.'/'.$filename;
$aliascontent = '<?php'."\n";
$aliascontent .= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
@ -94,12 +94,36 @@ function dolSavePageAlias($filealias, $object, $objectpage)
$aliascontent .= 'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent .= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent);
$result = file_put_contents($filealiassub, $aliascontent);
if ($result === false) {
dol_syslog("Failed to write file ".$filealias, LOG_WARNING);
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
}
// Save also alias into all language subdirectories if it is a main language
elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) {
$dirname = dirname($filealias);
$filename = basename($filealias);
foreach (explode(',', $object->otherlang) as $sublang) {
$filealiassub = $dirname.'/'.$sublang.'/'.$filename;
$aliascontent = '<?php'."\n";
$aliascontent .= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
$aliascontent .= 'global $dolibarr_main_data_root;'."\n";
$aliascontent .= 'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.'.tpl.php\'; ';
$aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent .= '?>'."\n";
$result = file_put_contents($filealiassub, $aliascontent);
if ($result === false) {
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
}
}
}
@ -108,8 +132,8 @@ function dolSavePageAlias($filealias, $object, $objectpage)
/**
* Save content of a page on disk.
* Page contents are always saved into root directory.
* Save content of a page on disk (page name is generally ID_of_page.php).
* Page contents are always saved into "root" directory. Only aliases pages saved with dolSavePageAlias() can be in root or language subdir.
*
* @param string $filetpl Full path of filename to generate
* @param Website $object Object website
@ -230,10 +254,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (!empty($conf->global->MAIN_UMASK))
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
}
return $result;
return $result;
}

View File

@ -99,9 +99,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("BarCode"), $langs->transnoentities("BarCode"));
$tooltip .= $langs->trans("GenericMaskCodes3");
$tooltip .= '<strong>'.$langs->trans("Example").':</strong><br>';
$tooltip .= '020{000000000} (for internal use)<br>';
$tooltip .= '9771234{00000} (example of ISSN code with prefix 1234)<br>';
$tooltip .= '9791234{00000} (example of ISMN code with prefix 1234)<br>';
$tooltip .= '020{000000000}? (for internal use)<br>';
$tooltip .= '9771234{00000}? (example of ISSN code with prefix 1234)<br>';
$tooltip .= '9791234{00000}? (example of ISMN code with prefix 1234)<br>';
//$tooltip.=$langs->trans("GenericMaskCodes5");
// Mask parameter
@ -140,7 +140,37 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
return $examplebarcode;
}
/**
* Return literal barcode type code from numerical rowid type of barcode
*
* @param Database $db Database
* @param int $type Type of barcode (EAN, ISBN, ...) as rowid
* @return string
*/
public function literalBarcodeType($db, $type = '')
{
global $conf;
$out = '';
$sql = "SELECT rowid, code, libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE rowid = '".$db->escape($type)."'";
$sql .= " AND entity = ".((int) $conf->entity);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
if ($num > 0) {
$obj = $db->fetch_object($result);
$out .= $obj->label; //take the label corresponding to the type rowid in the database
}
}
else {
dol_print_error($db);
}
return $out;
}
/**
* Return next value
*
@ -153,6 +183,11 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
global $db, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // to be able to call function barcode_gen_ean_sum($ean)
if (empty($type)) {
$type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
} //get barcode type configuration for products if $type not set
// TODO
@ -171,7 +206,28 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
$now = dol_now();
$numFinal = get_next_value($db, $mask, 'product', $field, $where, '', $now);
//Begin barcode with key: for barcode with key (EAN13...) calculate and substitute the last character (* or ?) used in the mask by the key
if ((substr($numFinal, -1)=='*') or (substr($numFinal, -1)=='?')) // if last mask character is * or ? a joker, probably we have to calculate a key as last character (EAN13...)
{
$literaltype = '';
$literaltype = $this->literalBarcodeType($db, $type);//get literal_Barcode_Type
switch ($literaltype)
{
case 'EAN13': //EAN13 rowid = 2
if (strlen($numFinal)==13)// be sure that the mask length is correct for EAN13
{
$ean = substr($numFinal, 0, 12); //take first 12 digits
$eansum = barcode_gen_ean_sum($ean);
$ean .= $eansum; //substitute the las character by the key
$numFinal = $ean;
}
break;
// Other barcode cases with key could be written here
default:
break;
}
}
//End barcode with key
return $numFinal;
}

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