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

This commit is contained in:
Christophe Battarel 2019-09-05 15:45:23 +02:00
commit 9db9dd856e
959 changed files with 18382 additions and 7092 deletions

View File

@ -38,6 +38,7 @@ tools:
- doc/* - doc/*
- test/* - test/*
- htdocs/includes/* - htdocs/includes/*
- htdocs/core/class/lessc.class.php
paths: paths:
- htdocs/ - htdocs/
- scripts/ - scripts/

View File

@ -18,9 +18,7 @@ addons:
apt: apt:
sources: sources:
# To use the last version of pgloader, we add repo of postgresql # To use the last version of pgloader, we add repo of postgresql
- postgresql - pgdg-trusty
- sourceline: 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main'
- key_url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
packages: packages:
# We need a webserver to test the webservices # We need a webserver to test the webservices
# Let's install Apache with. # Let's install Apache with.
@ -112,34 +110,35 @@ install:
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
composer self-update composer self-update
# To have composer making parallel downloads
composer global require hirak/prestissimo
composer -n init composer -n init
composer -n config vendor-dir htdocs/includes composer -n config vendor-dir htdocs/includes
echo echo
- | - |
echo "Installing Parallel Lint" echo "Installing Composer dependencies (PHP Unit, Parallel Lint & PHP CodeSniffer"
composer -n require jakub-onderka/php-parallel-lint ^0
composer -n require jakub-onderka/php-console-highlighter ^0
echo
- |
echo "Installing PHP Unit"
if [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
composer -n require phpunit/phpunit ^4 composer -n require phpunit/phpunit ^4 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi fi
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \
composer -n require phpunit/phpunit ^5 [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ]; then
composer -n require phpunit/phpunit ^5 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi fi
if [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require phpunit/phpunit ^5 composer -n require --ignore-platform-reqs phpunit/phpunit ^5 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi fi
echo echo
- |
echo "Installing PHP CodeSniffer"
composer -n require squizlabs/php_codesniffer ^3
echo
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
@ -246,8 +245,6 @@ before_script:
- echo "Setting up Apache + FPM" - echo "Setting up Apache + FPM"
- sudo apt-get update
- sudo apt-get install apache2 libapache2-mod-fastcgi
# enable php-fpm # enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- | - |

View File

@ -18,8 +18,8 @@ Following changes may create regressions for some external modules, but were nec
* The function show_theme() hase been renamed into showSkins() * The function show_theme() hase been renamed into showSkins()
* Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency. * Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency.
* The deprecated method get_OutstandingBill has been removed. You can use getOutstandingBills() instead. * The deprecated method get_OutstandingBill has been removed. You can use getOutstandingBills() instead.
* The hook "moreFamily" must return payment into var "totalpayment" and no more "paiement" (english replace french).
* Removed deprecated method actioncomm->add(), use create() instead
***** ChangeLog for 10.0.1 compared to 10.0.0 ***** ***** ChangeLog for 10.0.1 compared to 10.0.0 *****

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 268 KiB

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

View File

@ -51,6 +51,11 @@ class AccountancySystem
public $pcg_type; public $pcg_type;
public $pcg_subtype; public $pcg_subtype;
/**
* @var string Accountancy System numero
*/
public $numero;
/** /**
* @var string Accountancy System label * @var string Accountancy System label
*/ */

View File

@ -134,6 +134,13 @@ class BookKeeping extends CommonObject
public $journal_label; public $journal_label;
public $piece_num; public $piece_num;
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'generic';
/** /**
* Constructor * Constructor
* *

View File

@ -533,7 +533,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
// No subledger_account value for the bank line but add a specific label_operation // No subledger_account value for the bank line but add a specific label_operation
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
@ -596,7 +596,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
@ -730,7 +730,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->label_compte = ''; $bookkeeping->label_compte = '';
$bookkeeping->label_operation = $reflabel; $bookkeeping->label_operation = $reflabel;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;

View File

@ -201,7 +201,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
@ -254,7 +254,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
@ -311,7 +311,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];

View File

@ -300,7 +300,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"]; $bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
@ -357,7 +357,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"]; $bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
@ -418,7 +418,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"]; $bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
@ -475,7 +475,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"]; $bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add

View File

@ -311,7 +311,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
@ -368,7 +368,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
@ -428,7 +428,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add

View File

@ -289,7 +289,7 @@ if (empty($reshook))
$object->login = trim(GETPOST("login", 'alpha')); $object->login = trim(GETPOST("login", 'alpha'));
$object->pass = trim(GETPOST("pass", 'alpha')); $object->pass = trim(GETPOST("pass", 'alpha'));
$object->societe = trim(GETPOST("societe", 'alpha')); $object->societe = trim(GETPOST("societe", 'alpha')); // deprecated
$object->company = trim(GETPOST("societe", 'alpha')); $object->company = trim(GETPOST("societe", 'alpha'));
$object->address = trim(GETPOST("address", 'alpha')); $object->address = trim(GETPOST("address", 'alpha'));
@ -468,7 +468,8 @@ if (empty($reshook))
$object->firstname = $firstname; $object->firstname = $firstname;
$object->lastname = $lastname; $object->lastname = $lastname;
$object->gender = $gender; $object->gender = $gender;
$object->societe = $societe; $object->societe = $societe; // deprecated
$object->company = $societe;
$object->address = $address; $object->address = $address;
$object->zip = $zip; $object->zip = $zip;
$object->town = $town; $object->town = $town;
@ -946,7 +947,7 @@ else
print "</td>\n"; print "</td>\n";
// Company // Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe', 'alpha')?GETPOST('societe', 'alpha'):$object->societe).'"></td></tr>'; print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe', 'alpha')?GETPOST('societe', 'alpha'):$object->company).'"></td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1206,7 +1207,7 @@ else
print "</td></tr>"; print "</td></tr>";
// Company // Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"])?GETPOST("societe", '', 2):$object->societe).'"></td></tr>'; print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"])?GETPOST("societe", '', 2):$object->company).'"></td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1447,13 +1448,13 @@ else
if ($object->morphy == 'mor') if ($object->morphy == 'mor')
{ {
$companyname=$object->societe; $companyname=$object->company;
if (! empty($fullname)) $companyalias=$fullname; if (! empty($fullname)) $companyalias=$fullname;
} }
else else
{ {
$companyname=$fullname; $companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe; if (! empty($object->company)) $companyalias=$object->company;
} }
// Create a form array // Create a form array
@ -1635,7 +1636,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';

View File

@ -324,7 +324,7 @@ class Adherent extends CommonObject
$infos.= $langs->transnoentities("id").": ".$this->id."\n"; $infos.= $langs->transnoentities("id").": ".$this->id."\n";
$infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n"; $infos.= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
$infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n"; $infos.= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
$infos.= $langs->transnoentities("Company").": ".$this->societe."\n"; $infos.= $langs->transnoentities("Company").": ".$this->company."\n";
$infos.= $langs->transnoentities("Address").": ".$this->address."\n"; $infos.= $langs->transnoentities("Address").": ".$this->address."\n";
$infos.= $langs->transnoentities("Zip").": ".$this->zip."\n"; $infos.= $langs->transnoentities("Zip").": ".$this->zip."\n";
$infos.= $langs->transnoentities("Town").": ".$this->town."\n"; $infos.= $langs->transnoentities("Town").": ".$this->town."\n";
@ -350,7 +350,7 @@ class Adherent extends CommonObject
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):($this->firstname?$this->firstname:''), '__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):($this->firstname?$this->firstname:''),
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):($this->lastname?$this->lastname:''), '__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):($this->lastname?$this->lastname:''),
'__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), '__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):($this->societe?$this->societe:''), '__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->company):($this->company?$this->company:''),
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):($this->address?$this->address:''), '__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):($this->address?$this->address:''),
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):($this->zip?$this->zip:''), '__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):($this->zip?$this->zip:''),
'__TOWN__'=>$msgishtml?dol_htmlentitiesbr($this->town):($this->town?$this->town:''), '__TOWN__'=>$msgishtml?dol_htmlentitiesbr($this->town):($this->town?$this->town:''),
@ -558,7 +558,7 @@ class Adherent extends CommonObject
$sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null"); $sql.= ", lastname = ".($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null"); $sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null"); $sql.= ", societe = ".($this->company?"'".$this->db->escape($this->company)."'":($this->societe?"'".$this->db->escape($this->societe)."'":"null"));
$sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null"); $sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null");
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
@ -682,7 +682,7 @@ class Adherent extends CommonObject
$luser->lastname=$this->lastname; $luser->lastname=$this->lastname;
$luser->gender=$this->gender; $luser->gender=$this->gender;
$luser->pass=$this->pass; $luser->pass=$this->pass;
$luser->societe_id=$this->societe; //$luser->socid=$this->fk_soc; // We do not enable this. This may transform a user into an external user.
$luser->birth=$this->birth; $luser->birth=$this->birth;
@ -1608,13 +1608,13 @@ class Adherent extends CommonObject
if ($this->morphy == 'mor') if ($this->morphy == 'mor')
{ {
$companyname=$this->societe; $companyname=$this->company;
if (! empty($fullname)) $companyalias=$fullname; if (! empty($fullname)) $companyalias=$fullname;
} }
else else
{ {
$companyname=$fullname; $companyname=$fullname;
if (! empty($this->societe)) $companyalias=$this->societe; if (! empty($this->company)) $companyalias=$this->company;
} }
$result=$customer->create_from_member($this, $companyname, $companyalias); $result=$customer->create_from_member($this, $companyname, $companyalias);
@ -2297,7 +2297,7 @@ class Adherent extends CommonObject
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
$now=dol_now(); $now=dol_now();
@ -2398,7 +2398,7 @@ class Adherent extends CommonObject
$this->gender='man'; $this->gender='man';
$this->login='dolibspec'; $this->login='dolibspec';
$this->pass='dolibspec'; $this->pass='dolibspec';
$this->societe = 'Societe ABC'; $this->company = 'Societe ABC';
$this->address = '61 jump street'; $this->address = '61 jump street';
$this->zip = '75000'; $this->zip = '75000';
$this->town = 'Paris'; $this->town = 'Paris';
@ -2483,9 +2483,9 @@ class Adherent extends CommonObject
$this->fullname=$this->getFullName($langs); $this->fullname=$this->getFullName($langs);
// For avoid ldap error when firstname and lastname are empty // For avoid ldap error when firstname and lastname are empty
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) { if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->company)) {
$this->fullname = $this->societe; $this->fullname = $this->company;
$this->lastname = $this->societe; $this->lastname = $this->company;
} }
// Possible LDAP KEY (constname => varname) // Possible LDAP KEY (constname => varname)
@ -2513,7 +2513,7 @@ class Adherent extends CommonObject
} }
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
if ($this->societe && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->societe; if ($this->company && ! empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->company;
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
@ -2885,7 +2885,7 @@ class Adherent extends CommonObject
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$actioncode; $actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $actionmsg2; $actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg; $actioncomm->note_private= $actionmsg;
$actioncomm->fk_project = 0; $actioncomm->fk_project = 0;
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;

View File

@ -37,6 +37,7 @@ class AdherentStats extends Stats
*/ */
public $table_element; public $table_element;
public $memberid;
public $socid; public $socid;
public $userid; public $userid;

View File

@ -235,7 +235,7 @@ class MembersTypes extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if (! $membertype->delete($membertype->id)) { if (! $membertype->delete()) {
throw new RestException(401, 'error when deleting member type'); throw new RestException(401, 'error when deleting member type');
} }

View File

@ -134,7 +134,7 @@ if ($id > 0)
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';

View File

@ -83,10 +83,10 @@ if ($action == 'dolibarr2ldap')
* View * View
*/ */
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$form = new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$head = member_prepare_head($object); $head = member_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
@ -98,12 +98,12 @@ dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Login // Login
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
// Password not crypted // If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
{ {
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>'; print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
@ -111,18 +111,11 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
print "</tr>\n"; print "</tr>\n";
} }
// Password crypted $adht = new AdherentType($db);
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $adht->fetch($object->typeid);
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
print '<td class="valeur">'.$object->pass_crypted.'</td>';
print "</tr>\n";
}
// Type // Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n"; print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
$langs->load("admin");
// LDAP DN // LDAP DN
print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n"; print '<tr><td>LDAP '.$langs->trans("LDAPMemberDn").'</td><td class="valeur">'.$conf->global->LDAP_MEMBER_DN."</td></tr>\n";
@ -182,7 +175,7 @@ if ($result > 0)
if (empty($dn)) if (empty($dn))
{ {
$langs->load("errors"); $langs->load("errors");
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
} }
else else
{ {
@ -190,12 +183,12 @@ if ($result > 0)
//print_r($records); //print_r($records);
// Affichage arbre // Show tree
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else else
{ {
@ -204,7 +197,7 @@ if ($result > 0)
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
} }

View File

@ -135,11 +135,12 @@ $arrayfields=array(
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000) 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
@ -252,15 +253,17 @@ $sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql.= " t.libelle as type, t.subscription,"; $sql.= " t.libelle as type, t.subscription,";
$sql.= " state.code_departement as state_code, state.nom as state_name"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); if (! empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
// Add fields from hooks // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=preg_replace('/^,/', '', $hookmanager->resPrint);
$sql =preg_replace('/, $/', '', $sql);
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
@ -683,7 +686,7 @@ while ($i < min($num, $limit))
} else { } else {
$companyname=$obj->company; $companyname=$obj->company;
} }
$memberstatic->societe = $companyname; $memberstatic->company = $companyname;
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -80,7 +80,7 @@ if ($id)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -99,7 +99,7 @@ if ($id)
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';

View File

@ -478,7 +478,7 @@ if ($rowid > 0)
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfield">';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -494,7 +494,7 @@ if ($rowid > 0)
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
@ -862,13 +862,13 @@ if ($rowid > 0)
if ($object->morphy == 'mor') if ($object->morphy == 'mor')
{ {
$companyname=$object->societe; $companyname=$object->company;
if (! empty($fullname)) $companyalias=$fullname; if (! empty($fullname)) $companyalias=$fullname;
} }
else else
{ {
$companyname=$fullname; $companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe; if (! empty($object->company)) $companyalias=$object->company;
} }
// Create a form array // Create a form array
@ -903,7 +903,7 @@ if ($rowid > 0)
print '<input type="hidden" name="action" value="subscription">'; print '<input type="hidden" name="action" value="subscription">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">'; print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">'; print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->company).'">';
dol_fiche_head(''); dol_fiche_head('');

View File

@ -110,7 +110,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->note = trim($comment); $object->note = trim($comment);
$object->mail_valid = trim($mail_valid); $object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote); $object->vote = (int) $vote;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@ -489,7 +489,7 @@ if ($rowid > 0)
$now=dol_now(); $now=dol_now();
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, "; $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,";
$sql.= " d.datefin,"; $sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.subscription"; $sql.= " t.libelle as type, t.subscription";
@ -649,7 +649,7 @@ if ($rowid > 0)
// Lastname // Lastname
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if ($objp->societe != '') if ($objp->company != '')
{ {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} }
@ -812,7 +812,9 @@ if ($rowid > 0)
if (empty($reshook)) if (empty($reshook))
{ {
print '<br><br><table class="border" width="100%">'; print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label) if (is_array($extrafields->attributes['adherent_type']['label']))
{
foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
{ {
if (isset($_POST["options_" . $key])) { if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) { if (is_array($_POST["options_" . $key])) {
@ -822,12 +824,14 @@ if ($rowid > 0)
$value = $_POST["options_" . $key]; $value = $_POST["options_" . $key];
} }
} else { } else {
$value = $adht->array_options["options_" . $key]; $value = $object->array_options["options_" . $key];
} }
print '<tr><td width="30%">'.$label.'</td><td>'; print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key, $value); print $extrafields->showInputField($key, $value);
print "</td></tr>\n"; print "</td></tr>\n";
} }
}
print '</table><br><br>'; print '</table><br><br>';
} }

View File

@ -155,16 +155,17 @@ if ($result > 0)
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1); $dn=$object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
$records = $ldap->getAttribute($dn, $search); $records = $ldap->getAttribute($dn, $search);
//print_r($records); //print_r($records);
// Affichage arbre // Show tree
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else else
{ {
@ -173,7 +174,7 @@ if ($result > 0)
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
$ldap->unbind(); $ldap->unbind();

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("errors","admin","main","companies","resource","holiday","accountancy","hrm","orders","contracts","projects","propal","bills","interventions")); $langs->loadLangs(array("errors","admin","main","companies","resource","holiday","accountancy","hrm","orders","contracts","projects","propal","bills","interventions"));
@ -1782,7 +1782,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$withentity=''; $withentity='';
@ -1890,6 +1890,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
elseif (in_array($fieldlist[$field], array('libelle_facture'))) { elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td>'; print '<td>';
$transfound=0; $transfound=0;
$transkey='';
// Special case for labels // Special case for labels
if ($tabname == MAIN_DB_PREFIX.'c_payment_term') if ($tabname == MAIN_DB_PREFIX.'c_payment_term')
{ {

View File

@ -254,6 +254,7 @@ class PrestaShopWebservice
public function add($options) public function add($options)
{ {
$xml = ''; $xml = '';
$url = '';
if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml'])) if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml']))
{ {
@ -265,7 +266,9 @@ class PrestaShopWebservice
$url .= '&id_group_shop='.$options['id_group_shop']; $url .= '&id_group_shop='.$options['id_group_shop'];
} }
else else
{
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); self::checkStatusCode($request['status_code']);

View File

@ -98,14 +98,16 @@ foreach($object->fields as $key => $val)
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']); if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');

View File

@ -115,7 +115,7 @@ llxHeader('', $langs->trans("PrintingSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup'); print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
$head=oauthadmin_prepare_head($mode); $head = oauthadmin_prepare_head();
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic'); dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');

View File

@ -219,7 +219,7 @@ if (! $error && $xml)
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude); $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// Fill file_list with files in signature, new files, modified files // Fill file_list with files in signature, new files, modified files
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat, $scanfiles); // Fill array $file_list $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
// Complete with list of new files // Complete with list of new files
foreach ($scanfiles as $keyfile => $valfile) foreach ($scanfiles as $keyfile => $valfile)
{ {

View File

@ -586,7 +586,7 @@ print "\n";
?> ?>
<br> <br>
<div class="center"><input type="submit" class="button" <div class="center"><input type="submit" class="button reposition"
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br> value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
<br> <br>
</div> </div>

View File

@ -112,21 +112,27 @@ $utils = new Utils($db);
if ($compression == 'zip') if ($compression == 'zip')
{ {
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression); $ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
if ($ret < 0) if ($ret < 0)
{ {
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputfile); $errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir);
} }
} }
elseif (in_array($compression, array('gz', 'bz'))) elseif (in_array($compression, array('gz', 'bz')))
{ {
$userlogin = ($user->login ? $user->login : 'unknown');
$outputfile = $conf->admin->dir_temp.'/export_files.'.$userlogin.'.out'; // File used with popen method
$file = substr($file, 0, strrpos($file, '.')); $file = substr($file, 0, strrpos($file, '.'));
$file .= '.tar'; $file .= '.tar';
$cmd = 'tar -cf '.$outputdir."/".$file." --exclude=documents/admin/documents -C ".DOL_DATA_ROOT." ".DOL_DATA_ROOT."/../documents/"; // We also exclude '/temp/' dir and 'documents/admin/documents'
exec($cmd, $out, $retval); $cmd = "tar -cf ".$outputdir."/".$file." --exclude-vcs --exclude 'temp' --exclude 'dolibarr.log' --exclude='documents/admin/documents' -C ".dirname(DOL_DATA_ROOT)." ".basename(DOL_DATA_ROOT);
//var_dump($cmd, DOL_DATA_ROOT);exit;
if ($retval != 0) $result = $utils->executeCLI($cmd, $outputfile);
$retval = $result['error'];
if ($result['result'] || ! empty($retval))
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog("Documents tar retval after exec=".$retval, LOG_ERR); dol_syslog("Documents tar retval after exec=".$retval, LOG_ERR);
@ -136,15 +142,17 @@ elseif (in_array($compression, array('gz', 'bz')))
{ {
if ($compression == 'gz') if ($compression == 'gz')
{ {
$cmd = "gzip " . $outputdir."/".$file; $cmd = "gzip -f " . $outputdir."/".$file;
} }
if ($compression == 'bz') if ($compression == 'bz')
{ {
$cmd = "bzip2 " . $outputdir."/".$file; $cmd = "bzip2 -f " . $outputdir."/".$file;
} }
exec($cmd, $out, $retval); $result = $utils->executeCLI($cmd, $outputfile);
if ($retval != 0)
$retval = $result['error'];
if ($result['result'] || ! empty($retval))
{ {
$errormsg = 'Error '.$compression.' generation return '.$retval; $errormsg = 'Error '.$compression.' generation return '.$retval;
unlink($outputdir."/".$file); unlink($outputdir."/".$file);

View File

@ -169,9 +169,6 @@ class DolibarrApiAccess implements iAuthenticate
// phpcs:disable PEAR.NamingConventions.ValidFunctionName // phpcs:disable PEAR.NamingConventions.ValidFunctionName
/** /**
* @return string string to be used with WWW-Authenticate header * @return string string to be used with WWW-Authenticate header
* @example Basic
* @example Digest
* @example OAuth
*/ */
public function __getWWWAuthenticateString() public function __getWWWAuthenticateString()
{ {

View File

@ -426,7 +426,7 @@ class Documents extends DolibarrApi
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it) * @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
* @param string $subdir Subdirectory (Only if ref not provided) * @param string $subdir Subdirectory (Only if ref not provided)
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'} * @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64)
* @param int $overwriteifexists Overwrite file if exists (1 by default) * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return string * @return string
* *

View File

@ -178,7 +178,7 @@ class Setup extends DolibarrApi
} }
} }
} else { } else {
throw new RestException(503, 'Error when retrieving list of countries : '.$country->error); throw new RestException(503, 'Error when retrieving list of countries');
} }
return $list; return $list;
@ -331,7 +331,7 @@ class Setup extends DolibarrApi
* @param string $module To filter on module events * @param string $module To filter on module events
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of events types
* *
* @url GET dictionary/event_types * @url GET dictionary/event_types
* *
@ -394,7 +394,7 @@ class Setup extends DolibarrApi
* @param string $module To filter on module events * @param string $module To filter on module events
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of civility types
* *
* @url GET dictionary/civilities * @url GET dictionary/civilities
* *
@ -456,7 +456,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero) * @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of currencies
* *
* @url GET dictionary/currencies * @url GET dictionary/currencies
* *
@ -523,7 +523,7 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param string $type Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...) * @param string $type Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...)
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'SO-%')"
* @return List of extra fields * @return array List of extra fields
* *
* @url GET extrafields * @url GET extrafields
* *
@ -602,7 +602,7 @@ class Setup extends DolibarrApi
* @param string $town To filter on city name * @param string $town To filter on city name
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of towns * @return array List of towns
* *
* @url GET dictionary/towns * @url GET dictionary/towns
* *
@ -788,7 +788,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero) * @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of measuring unit
* *
* @url GET dictionary/units * @url GET dictionary/units
* *
@ -848,7 +848,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero) * @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of ticket categories
* *
* @url GET dictionary/ticket_categories * @url GET dictionary/ticket_categories
* *
@ -908,7 +908,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero) * @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of ticket severities
* *
* @url GET dictionary/ticket_severities * @url GET dictionary/ticket_severities
* *
@ -968,7 +968,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero) * @param int $page Page number (starting from zero)
* @param int $active Payment term is active or not {@min 0} {@max 1} * @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return List of events types * @return array List of ticket types
* *
* @url GET dictionary/ticket_types * @url GET dictionary/ticket_types
* *
@ -1026,7 +1026,7 @@ class Setup extends DolibarrApi
* Do a test of integrity for files and setup. * Do a test of integrity for files and setup.
* *
* @param string $target Can be 'local' or 'default' or Url of the signatures file to use for the test. Must be reachable by the tested Dolibarr. * @param string $target Can be 'local' or 'default' or Url of the signatures file to use for the test. Must be reachable by the tested Dolibarr.
* @return Result of file and setup integrity check * @return array Result of file and setup integrity check
* *
* @url GET checkintegrity * @url GET checkintegrity
* *
@ -1158,7 +1158,7 @@ class Setup extends DolibarrApi
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude); $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// Fill file_list with files in signature, new files, modified files // Fill file_list with files in signature, new files, modified files
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat, $scanfiles); // Fill array $file_list $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
// Complete with list of new files // Complete with list of new files
foreach ($scanfiles as $keyfile => $valfile) foreach ($scanfiles as $keyfile => $valfile)
{ {

View File

@ -100,11 +100,12 @@ foreach($object->fields as $key => $val)
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');

View File

@ -55,7 +55,7 @@ function bomAdminPrepareHead()
//$this->tabs = array( //$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to remove a tab //); // to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom'); complete_head_from_modules($conf, $langs, null, $head, $h, 'bom');
return $head; return $head;
} }

View File

@ -188,10 +188,12 @@ class Categorie extends CommonObject
* @var string Color * @var string Color
*/ */
public $color; public $color;
/** /**
* @var ??? * @var int Id of thirdparty when CATEGORY_ASSIGNED_TO_A_CUSTOMER is set
*/ */
public $socid; public $socid;
/** /**
* @var string Category type * @var string Category type
* *

View File

@ -251,9 +251,6 @@ class ActionComm extends CommonObject
public function __construct(DoliDB $db) public function __construct(DoliDB $db)
{ {
$this->db = $db; $this->db = $db;
$this->societe = new stdClass(); // deprecated
$this->contact = new stdClass(); // deprecated
} }
/** /**
@ -307,8 +304,6 @@ class ActionComm extends CommonObject
$this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency); $this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency);
} }
//if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
$userownerid=$this->userownerid; $userownerid=$this->userownerid;
$userdoneid=$this->userdoneid; $userdoneid=$this->userdoneid;
@ -502,20 +497,6 @@ class ActionComm extends CommonObject
} }
} }
/**
* Add an action/event into database.
* $this->type_id OR $this->type_code must be set.
*
* @param User $user Object user making action
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Id of created event, < 0 if KO
* @deprecated Use create instead
*/
public function add(User $user, $notrigger = 0)
{
return $this->create($user, $notrigger);
}
/** /**
* Load an object from its id and create a new one in database * Load an object from its id and create a new one in database
* *
@ -678,7 +659,7 @@ class ActionComm extends CommonObject
$this->contactid = $obj->fk_contact; // To have fetch_contact method working $this->contactid = $obj->fk_contact; // To have fetch_contact method working
$this->fk_project = $obj->fk_project; // To have fetch_project method working $this->fk_project = $obj->fk_project; // To have fetch_project method working
$this->societe->id = $obj->fk_soc; // deprecated //$this->societe->id = $obj->fk_soc; // deprecated
//$this->contact->id = $obj->fk_contact; // deprecated //$this->contact->id = $obj->fk_contact; // deprecated
$this->fk_element = $obj->elementid; $this->fk_element = $obj->elementid;
@ -889,8 +870,8 @@ class ActionComm extends CommonObject
return -1; return -1;
} }
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0)); $socid=(($this->socid > 0)?$this->socid:0);
$contactid=($this->contactid?$this->contactid:0); $contactid=(($this->contactid > 0)?$this->contactid:0);
$userownerid=($this->userownerid?$this->userownerid:0); $userownerid=($this->userownerid?$this->userownerid:0);
$userdoneid=($this->userdoneid?$this->userdoneid:0); $userdoneid=($this->userdoneid?$this->userdoneid:0);

View File

@ -452,6 +452,7 @@ if ($resql)
if (! empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>'; if (! empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>'; if (! empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>'; if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
if (! empty($arrayfields['a.note']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
if (! empty($arrayfields['a.datep']['checked'])) { if (! empty($arrayfields['a.datep']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0); print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0);

View File

@ -2500,7 +2500,7 @@ $formquestion = array_merge($formquestion, array(
if ($usercansend) { if ($usercansend) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
} else } else
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans('SendMail') . '</a></div>';
} }
// Create an order // Create an order
@ -2537,9 +2537,16 @@ $formquestion = array_merge($formquestion, array(
$arrayofinvoiceforpropal = $object->getInvoiceArrayList(); $arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED)) if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
{
if ($usercanclose)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
} }
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
}
} }
// Set accepted/refused // Set accepted/refused

View File

@ -92,7 +92,7 @@ class Proposals extends DolibarrApi
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposals. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $thirdparty_ids Thirdparty ids to filter commercial proposals (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
*/ */

View File

@ -172,14 +172,16 @@ $arrayfields=array(
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
/* /*
* Actions * Actions
*/ */
@ -276,19 +278,20 @@ $sql.= ' u.login';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); if (! empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
// Add fields from hooks // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/', '', $sql);
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$sql.= ', '.MAIN_DB_PREFIX.'propal as p'; $sql.= ', '.MAIN_DB_PREFIX.'propal as p';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields as ef on (p.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
@ -750,6 +753,8 @@ if ($resql)
$now = dol_now(); $now = dol_now();
$i=0; $i=0;
$totalarray=array(); $totalarray=array();
$typenArray=null;
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -880,8 +885,9 @@ if ($resql)
// Type ent // Type ent
if (! empty($arrayfields['typent.code']['checked'])) if (! empty($arrayfields['typent.code']['checked']))
{ {
if (! is_array($typenArray) || empty($typenArray)) $typenArray = $formcompany->typent_array(1);
print '<td align="center">'; print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code]; print $typenArray[$obj->typent_code];
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;

View File

@ -94,7 +94,7 @@ class Orders extends DolibarrApi
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of order objects * @return array Array of order objects
* *

View File

@ -148,13 +148,16 @@ $arrayfields=array(
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) 'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');

View File

@ -213,9 +213,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$paiement = '';
$ref = ''; $ref = '';
$refcomp = ''; $refcomp = '';
$totalpayment = '';
$obj = array_shift($tab_sqlobj); $obj = array_shift($tab_sqlobj);
@ -236,7 +236,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name; $societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24); $refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = -1*$facturefournstatic->getSommePaiement(); // Payment already done $totalpayment = -1*$facturefournstatic->getSommePaiement(); // Payment already done
} }
} }
if ($obj->family == 'invoice') if ($obj->family == 'invoice')
@ -250,9 +250,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name; $societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24); $refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done $totalpayment = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed(); $totalpayment+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed(); $totalpayment+= $facturestatic->getSumCreditNotesUsed();
} }
if ($obj->family == 'social_contribution') if ($obj->family == 'social_contribution')
{ {
@ -261,19 +261,19 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$socialcontribstatic->lib=$obj->type; $socialcontribstatic->lib=$obj->type;
$ref = $socialcontribstatic->getNomUrl(1, 24); $ref = $socialcontribstatic->getNomUrl(1, 24);
$paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done $totalpayment = -1*$socialcontribstatic->getSommePaiement(); // Payment already done
} }
$parameters = array('obj' => $obj); $parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment);
$reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){ if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref; $ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
$refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp; $refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp;
$paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : $paiement; $totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment;
} }
$total_ttc = $obj->total_ttc; $total_ttc = $obj->total_ttc;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement; if ($totalpayment) $total_ttc = $obj->total_ttc - $totalpayment;
$solde += $total_ttc; $solde += $total_ttc;
// We discard lines with a remainder to pay to 0 // We discard lines with a remainder to pay to 0

View File

@ -98,7 +98,7 @@ class Invoices extends DolibarrApi
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $thirdparty_ids Thirdparty ids to filter orders of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $status Filter by invoice status : draft | unpaid | paid | cancelled * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of invoice objects * @return array Array of invoice objects

View File

@ -459,7 +459,16 @@ class Facture extends CommonInvoice
} }
// Define due date if not already defined // Define due date if not already defined
$datelim=(empty($forceduedate)?$this->calculate_date_lim_reglement():$forceduedate); if (empty($forceduedate)) {
$duedate = $this->calculate_date_lim_reglement();
/*if ($duedate < 0) { Regression, a date can be negative if before 1970.
dol_syslog(__METHOD__ . ' Error in calculate_date_lim_reglement. We got ' . $duedate, LOG_ERR);
return -1;
}*/
$this->date_lim_reglement = $duedate;
} else {
$this->date_lim_reglement = $forceduedate;
}
// Insert into database // Insert into database
$socid = $this->socid; $socid = $this->socid;
@ -514,7 +523,7 @@ class Facture extends CommonInvoice
$sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".$this->cond_reglement_id; $sql.= ", ".$this->cond_reglement_id;
$sql.= ", ".$this->mode_reglement_id; $sql.= ", ".$this->mode_reglement_id;
$sql.= ", '".$this->db->idate($datelim)."', '".$this->db->escape($this->modelpdf)."'"; $sql.= ", '".$this->db->idate($this->date_lim_reglement)."', '".$this->db->escape($this->modelpdf)."'";
$sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null"); $sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null");
$sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null"); $sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null");
$sql.= ", ".($this->situation_final?$this->situation_final:0); $sql.= ", ".($this->situation_final?$this->situation_final:0);
@ -1695,7 +1704,7 @@ class Facture extends CommonInvoice
$sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').","; $sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').",";
$sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').","; $sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
$sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; $sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
$sql.= " paye=".(isset($this->paye)?$this->db->escape($this->paye):"null").","; $sql.= " paye=".(isset($this->paye)?$this->db->escape($this->paye):0).",";
$sql.= " remise_percent=".(isset($this->remise_percent)?$this->db->escape($this->remise_percent):"null").","; $sql.= " remise_percent=".(isset($this->remise_percent)?$this->db->escape($this->remise_percent):"null").",";
$sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->db->escape($this->remise_absolue):"null").","; $sql.= " remise_absolue=".(isset($this->remise_absolue)?$this->db->escape($this->remise_absolue):"null").",";
$sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").","; $sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").",";
@ -5168,13 +5177,16 @@ class FactureLigne extends CommonInvoiceLine
public function get_prev_progress($invoiceid, $include_credit_note = true) public function get_prev_progress($invoiceid, $include_credit_note = true)
{ {
// phpcs:enable // phpcs:enable
global $invoicecache;
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
return 0; return 0;
} else { } else {
// If invoice is not a situation invoice, this->fk_prev_id is used for something else // If invoice is not a situation invoice, this->fk_prev_id is used for something else
$tmpinvoice=new Facture($this->db); if (!isset($invoicecache[$invoiceid])) {
$tmpinvoice->fetch($invoiceid); $invoicecache[$invoiceid]=new Facture($this->db);
if ($tmpinvoice->type != Facture::TYPE_SITUATION) return 0; $invoicecache[$invoiceid]->fetch($invoiceid);
}
if ($invoicecache[$invoiceid]->type != Facture::TYPE_SITUATION) return 0;
$sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id; $sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@ -133,13 +133,16 @@ $arrayfields=array(
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/* /*

View File

@ -189,13 +189,16 @@ if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/* /*

View File

@ -72,9 +72,8 @@ class Paiement extends CommonObject
public $amounts=array(); // Array of amounts public $amounts=array(); // Array of amounts
public $multicurrency_amounts=array(); // Array of amounts public $multicurrency_amounts=array(); // Array of amounts
public $author; public $author;
public $paiementid; // Type de paiement. Stocke dans fk_paiement public $paiementid; // Type of payment. Id saved into fields fk_paiement on llx_paiement
// de llx_paiement qui est lie aux types de public $paiementcode; // Code of payment.
//paiement de llx_c_paiement
/** /**
* @var string type libelle * @var string type libelle
@ -89,14 +88,14 @@ class Paiement extends CommonObject
/** /**
* @var string Numero du CHQ, VIR, etc... * @var string Numero du CHQ, VIR, etc...
* @deprecated * @deprecated
* @see num_payment * @see $num_payment
*/ */
public $numero; public $numero;
/** /**
* @var string Numero du CHQ, VIR, etc... * @var string Numero du CHQ, VIR, etc...
* @deprecated * @deprecated
* @see num_payment * @see $num_payment
*/ */
public $num_paiement; public $num_paiement;

View File

@ -87,21 +87,6 @@ class Contact extends CommonObject
public $zip; public $zip;
public $town; public $town;
/**
* @deprecated
* @see $state_id
*/
public $fk_departement;
/**
* @deprecated
* @see $state_code
*/
public $departement_code;
/**
* @deprecated
* @see $state
*/
public $departement;
public $state_id; // Id of department public $state_id; // Id of department
public $state_code; // Code of department public $state_code; // Code of department
public $state; // Label of department public $state; // Label of department
@ -1023,7 +1008,7 @@ class Contact extends CommonObject
// Removed extrafields // Removed extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) {
// For avoid conflicts if trigger used // For avoid conflicts if trigger used
$result=$this->deleteExtraFields($this); $result=$this->deleteExtraFields();
if ($result < 0) $error++; if ($result < 0) $error++;
} }

View File

@ -80,12 +80,12 @@ if ($action == 'dolibarr2ldap')
* View * View
*/ */
$form = new Form($db);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('', $title, 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('', $title, 'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db);
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
dol_fiche_head($head, 'ldap', $title, -1, 'contact'); dol_fiche_head($head, 'ldap', $title, -1, 'contact');
@ -172,16 +172,17 @@ if ($result > 0)
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1); $dn=$object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
$records = $ldap->getAttribute($dn, $search); $records = $ldap->getAttribute($dn, $search);
//var_dump($records); //var_dump($records);
// Affichage arbre // Show tree
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{ {
if (! is_array($records)) if (! is_array($records))
{ {
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else else
{ {
@ -190,7 +191,7 @@ if ($result > 0)
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
$ldap->unbind(); $ldap->unbind();

View File

@ -95,7 +95,7 @@ class Contracts extends DolibarrApi
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $thirdparty_ids Thirdparty ids to filter contracts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $thirdparty_ids Thirdparty ids to filter contracts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @return array Array of contract objects * @return array Array of contract objects
* *

View File

@ -130,13 +130,16 @@ $arrayfields=array(
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/* /*

View File

@ -132,13 +132,16 @@ $arrayfields=array(
'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500) 'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{ {
if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
} }
} }
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
@ -702,7 +705,7 @@ while ($i < min($num, $limit))
print '<td class="right">'; print '<td class="right">';
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
{ {
print $contractstatic->LibStatut(0, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)); print $contractstatic->LibStatut(0, 5);
} }
else else
{ {

View File

@ -56,7 +56,7 @@ class box_birthdays extends ModeleBoxes
*/ */
public function __construct($db, $param = '') public function __construct($db, $param = '')
{ {
global $conf, $user; global $user;
$this->db = $db; $this->db = $db;
@ -71,7 +71,7 @@ class box_birthdays extends ModeleBoxes
*/ */
public function loadBox($max = 20) public function loadBox($max = 20)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max; $this->max=$max;

View File

@ -56,7 +56,7 @@ class box_birthdays_members extends ModeleBoxes
*/ */
public function __construct($db, $param = '') public function __construct($db, $param = '')
{ {
global $conf, $user; global $user;
$this->db = $db; $this->db = $db;
@ -71,7 +71,7 @@ class box_birthdays_members extends ModeleBoxes
*/ */
public function loadBox($max = 20) public function loadBox($max = 20)
{ {
global $user, $langs, $db, $conf; global $user, $langs, $db;
$langs->load("boxes"); $langs->load("boxes");
$this->max=$max; $this->max=$max;

View File

@ -54,7 +54,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
public $enabled=1; public $enabled=1;
/** /**
* @var int Condition to have widget visible (in most cases, permissions) * @var boolean Condition to have widget visible (in most cases, permissions)
*/ */
public $hidden=0; public $hidden=0;

View File

@ -497,8 +497,16 @@ abstract class CommonDocGenerator
$resarray['object_total_up'] = $totalUp; $resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);
if (method_exists($object, 'getTotalDiscount')) { if (method_exists($object, 'getTotalDiscount')) {
$resarray['object_total_discount'] = round(100 / $totalUp * $object->getTotalDiscount(), 2); $totalDiscount=$object->getTotalDiscount();
} else {
$totalDiscount=0;
}
if (!empty($totalUp) && !empty($totalDiscount)) {
$resarray['object_total_discount'] = round(100 / $totalUp * $totalDiscount, 2);
$resarray['object_total_discount_locale'] = price($resarray['object_total_discount'], 0, $outputlangs); $resarray['object_total_discount_locale'] = price($resarray['object_total_discount'], 0, $outputlangs);
} else {
$resarray['object_total_discount']='';
$resarray['object_total_discount_locale']='';
} }
} }
@ -766,10 +774,20 @@ abstract class CommonDocGenerator
//Add value to store price with currency //Add value to store price with currency
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); $array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
} }
elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') elseif($extrafields->attribute_type[$key] == 'select')
{ {
$object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]];
} }
elseif($extrafields->attribute_type[$key] == 'checkbox') {
$valArray=explode(',', $object->array_options['options_'.$key]);
$output=array();
foreach($extrafields->attribute_param[$key]['options'] as $keyopt=>$valopt) {
if (in_array($keyopt, $valArray)) {
$output[]=$valopt;
}
}
$object->array_options['options_'.$key] = implode(', ', $output);
}
elseif($extrafields->attribute_type[$key] == 'date') elseif($extrafields->attribute_type[$key] == 'date')
{ {
if (strlen($object->array_options['options_'.$key])>0) if (strlen($object->array_options['options_'.$key])>0)

View File

@ -177,6 +177,7 @@ class Conf
if ($value && preg_match('/^MAIN_MODULE_/', $key)) if ($value && preg_match('/^MAIN_MODULE_/', $key))
{ {
$reg=array();
// If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs']. // If this is constant for a new tab page activated by a module. It initializes modules_parts['tabs'].
if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key)) if (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_TABS_/i', $key))
{ {
@ -674,6 +675,9 @@ class Conf
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com';
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567';
// If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined.
if (! isset($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $conf->global->MAIN_FEATURES_LEVEL >= 2) $conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1;
// For backward compatibility // For backward compatibility
if (isset($this->product)) $this->produit=$this->product; if (isset($this->product)) $this->produit=$this->product;
if (isset($this->facture)) $this->invoice=$this->facture; if (isset($this->facture)) $this->invoice=$this->facture;

View File

@ -1903,6 +1903,15 @@ class Form
$price_level = (! empty($price_level) ? $price_level : 0); $price_level = (! empty($price_level) ? $price_level : 0);
if (is_null($ajaxoptions)) $ajaxoptions=array(); if (is_null($ajaxoptions)) $ajaxoptions=array();
if(strval($filtertype) === '' && (!empty($conf->product->enabled) || !empty($conf->service->enabled))){
if(!empty($conf->product->enabled) && empty($conf->service->enabled)){
$filtertype = '0';
}
elseif(empty($conf->product->enabled) && !empty($conf->service->enabled)){
$filtertype = '1';
}
}
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
{ {
$placeholder=''; $placeholder='';

View File

@ -1381,7 +1381,7 @@ class FormFile
if (! empty($conf->dol_use_jmobile)) $useajax=0; if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $useajax=0; if (empty($conf->use_javascript_ajax)) $useajax=0;
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0; if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
print '<a href="'.((($useinecm && $useinecm != 6) && $useajax)?'#':($url.'?action=delete&urlfile='.urlencode($filepath).$param)).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>'; print '<a href="'.((($useinecm && $useinecm != 6) && $useajax)?'#':($url.'?action=delete&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
} }
print "</td>"; print "</td>";

View File

@ -162,13 +162,13 @@ class FormWebsite
/** /**
* Return a HTML select list of a dictionary * Return a HTML select list of type of containers
* *
* @param string $htmlname Name of select zone * @param string $htmlname Name of select zone
* @param string $selected Selected value * @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list * @param int $useempty 1=Add an empty value in list
* @param string $moreattrib More attributes on HTML select tag * @param string $moreattrib More attributes on HTML select tag
* @return void * @return string HTML select component with list of type of containers
*/ */
public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '') public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '')
{ {

View File

@ -952,7 +952,7 @@ class Ldap
} }
// Get values // Get values
if (! $values = ldap_get_attributes($this->connection, $entry)) if (! ($values = ldap_get_attributes($this->connection, $entry)))
{ {
$this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorCode = ldap_errno($this->connection);
$this->ldapErrorText = ldap_error($this->connection); $this->ldapErrorText = ldap_error($this->connection);

View File

@ -1033,6 +1033,7 @@ class Lessc {
return $this->lib_e($items[0]); return $this->lib_e($items[0]);
} }
$this->throwError("unrecognised input"); $this->throwError("unrecognised input");
return null;
case "string": case "string":
$arg[1] = ""; $arg[1] = "";
return $arg; return $arg;
@ -1050,6 +1051,7 @@ class Lessc {
$template = $this->compileValue($this->lib_e($string)); $template = $this->compileValue($this->lib_e($string));
$i = 0; $i = 0;
$m = array();
if (preg_match_all('/%[dsa]/', $template, $m)) { if (preg_match_all('/%[dsa]/', $template, $m)) {
foreach ($m[0] as $match) { foreach ($m[0] as $match) {
$val = isset($values[$i]) ? $val = isset($values[$i]) ?

View File

@ -355,22 +355,27 @@ class Link extends CommonObject
/** /**
* Delete a link from database * Delete a link from database
* *
* @param User $user Object suer
* @return int <0 if KO, 0 if nothing done, >0 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
public function delete() public function delete($user)
{ {
global $user, $langs, $conf; global $langs, $conf;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$error = 0; $error = 0;
$this->db->begin();
// Call trigger // Call trigger
$result=$this->call_trigger('LINK_DELETE', $user); $result=$this->call_trigger('LINK_DELETE', $user);
if ($result < 0) return -1; if ($result < 0)
{
$this->db->rollback();
return -1;
}
// End call triggers // End call triggers
$this->db->begin();
// Remove link // Remove link
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "links"; $sql = "DELETE FROM " . MAIN_DB_PREFIX . "links";
$sql.= " WHERE rowid = " . $this->id; $sql.= " WHERE rowid = " . $this->id;

View File

@ -299,7 +299,7 @@ class SimpleOpenID
* @param string $url URL * @param string $url URL
* @param string $method Method * @param string $method Method
* @param string $params Params * @param string $params Params
* @return boolean|unknown * @return boolean|void True if success, False if error
*/ */
public function FSOCK_Request($url, $method = "GET", $params = "") public function FSOCK_Request($url, $method = "GET", $params = "")
{ {

View File

@ -316,21 +316,22 @@ class Utils
// TODO Replace with executeCLI function // TODO Replace with executeCLI function
if ($execmethod == 1) if ($execmethod == 1)
{ {
exec($fullcommandclear, $readt, $retval); $output_arr = array(); $retval = null;
$result = $retval; exec($fullcommandclear, $output_arr, $retval);
if ($retval != 0) if ($retval != 0)
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog("Datadump retval after exec=".$retval, LOG_ERR); dol_syslog("Datadump retval after exec=".$retval, LOG_ERR);
$error = 'Error '.$retval; $errormsg = 'Error '.$retval;
$ok=0; $ok=0;
} }
else else
{ {
$i=0; $i=0;
if (!empty($readt)) if (!empty($output_arr))
foreach($readt as $key=>$read) {
foreach($output_arr as $key => $read)
{ {
$i++; // output line number $i++; // output line number
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
@ -340,6 +341,7 @@ class Utils
} }
} }
} }
}
if ($execmethod == 2) // With this method, there is no way to get the return code, only output if ($execmethod == 2) // With this method, there is no way to get the return code, only output
{ {
$handlein = popen($fullcommandclear, 'r'); $handlein = popen($fullcommandclear, 'r');
@ -534,6 +536,7 @@ class Utils
if ($execmethod == 1) if ($execmethod == 1)
{ {
$retval = null;
exec($command, $output_arr, $retval); exec($command, $output_arr, $retval);
$result = $retval; $result = $retval;
if ($retval != 0) if ($retval != 0)
@ -545,7 +548,6 @@ class Utils
} }
if ($execmethod == 2) // With this method, there is no way to get the return code, only output if ($execmethod == 2) // With this method, there is no way to get the return code, only output
{ {
$ok=0;
$handle = fopen($outputfile, 'w+b'); $handle = fopen($outputfile, 'w+b');
if ($handle) if ($handle)
{ {

View File

@ -223,7 +223,7 @@ interface Database
* @param string $name name of database (not used for mysql, used for pgsql) * @param string $name name of database (not used for mysql, used for pgsql)
* @param int $port Port of database server * @param int $port Port of database server
* @return resource Database access handler * @return resource Database access handler
* @see close * @see close()
*/ */
public function connect($host, $login, $passwd, $name, $port = 0); public function connect($host, $login, $passwd, $name, $port = 0);
@ -265,7 +265,7 @@ interface Database
* *
* @param resource $resultset Resulset of requests * @param resource $resultset Resulset of requests
* @return int Nb of lines * @return int Nb of lines
* @see affected_rows * @see affected_rows()
*/ */
public function num_rows($resultset); public function num_rows($resultset);
// phpcs:enable // phpcs:enable
@ -461,7 +461,7 @@ interface Database
* Close database connexion * Close database connexion
* *
* @return boolean True if disconnect successfull, false otherwise * @return boolean True if disconnect successfull, false otherwise
* @see connect * @see connect()
*/ */
public function close(); public function close();

View File

@ -607,7 +607,7 @@ class DoliDBPgsql extends DoliDB
/** /**
* Return number of lines for result of a SELECT * Return number of lines for result of a SELECT
* *
* @param resourse $resultset Resulset of requests * @param resource $resultset Resulset of requests
* @return int Nb of lines, -1 on error * @return int Nb of lines, -1 on error
* @see affected_rows() * @see affected_rows()
*/ */

View File

@ -549,15 +549,13 @@ function calendars_prepare_head($param)
$h++; $h++;
$object=new stdClass();
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda'); complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'agenda', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'agenda', 'remove');
return $head; return $head;
} }

View File

@ -48,7 +48,7 @@ function asset_admin_prepare_head()
//$this->tabs = array( //$this->tabs = array(
// 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__' // 'entity:-tabname:Title:@assets:/asset/mypage.php?id=__ID__'
//); // to remove a tab //); // to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin'); complete_head_from_modules($conf, $langs, null, $head, $h, 'assets_admin');
$head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php'; $head[$h][0] = DOL_URL_ROOT . '/asset/admin/assets_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
@ -60,7 +60,7 @@ function asset_admin_prepare_head()
$head[$h][2] = 'attributes_type'; $head[$h][2] = 'attributes_type';
$h++; $h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'assets_admin', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'assets_admin', 'remove');
return $head; return $head;
} }
@ -68,11 +68,12 @@ function asset_admin_prepare_head()
/** /**
* Prepare admin pages header * Prepare admin pages header
* *
* @param Contrat $object Object related to tabs
* @return array head array with tabs * @return array head array with tabs
*/ */
function asset_prepare_head() function asset_prepare_head(Asset $object)
{ {
global $langs, $conf; global $db, $langs, $conf;
$langs->load("assets"); $langs->load("assets");
@ -96,7 +97,7 @@ function asset_prepare_head()
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->assets->dir_output . '/' . get_exdir($filename, 2, 0, 1, $object, 'assets'). '/'. dol_sanitizeFileName($object->ref); $upload_dir = $conf->assets->dir_output . '/' . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id); $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id;

View File

@ -163,7 +163,6 @@ function bank_admin_prepare_head($object)
*/ */
function various_payment_prepare_head($object) function various_payment_prepare_head($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;
$h = 0; $h = 0;

View File

@ -101,7 +101,7 @@ function contract_prepare_head(Contrat $object)
*/ */
function contract_admin_prepare_head() function contract_admin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf;
$h = 0; $h = 0;
$head = array(); $head = array();
@ -127,8 +127,6 @@ function contract_admin_prepare_head()
$head[$h][2] = 'attributeslines'; $head[$h][2] = 'attributeslines';
$h++; $h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin', 'remove');
return $head; return $head;

View File

@ -80,7 +80,7 @@ function donation_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename, 2, 0, 1, $object, 'donation'). '/'. dol_sanitizeFileName($object->ref); $upload_dir = $conf->don->dir_output . '/' . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id); $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id;

View File

@ -1222,11 +1222,14 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
} }
} }
} }
else dol_syslog("Failed to remove file ".$filename, LOG_WARNING); else
{
dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
// TODO Failure to remove can be because file was already removed or because of permission // TODO Failure to remove can be because file was already removed or because of permission
// If error because it does not exists, we should return true, and we should return false if this is a permission problem // If error because it does not exists, we should return true, and we should return false if this is a permission problem
} }
} }
}
else dol_syslog("No files to delete found", LOG_DEBUG); else dol_syslog("No files to delete found", LOG_DEBUG);
} }
else else
@ -1881,14 +1884,16 @@ function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '', $page = ''
/** /**
* Compress a file * Compress a file.
* An error string may be returned into parameters.
* *
* @param string $inputfile Source file name * @param string $inputfile Source file name
* @param string $outputfile Target file name * @param string $outputfile Target file name
* @param string $mode 'gz' or 'bz' or 'zip' * @param string $mode 'gz' or 'bz' or 'zip'
* @param string $errorstring Error string
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function dol_compress_file($inputfile, $outputfile, $mode = "gz") function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring = null)
{ {
global $conf; global $conf;
@ -1913,8 +1918,12 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz")
$zip = new ZipArchive; $zip = new ZipArchive;
if ($zip->open($outputfile, ZipArchive::CREATE) !== true) { if ($zip->open($outputfile, ZipArchive::CREATE) !== true) {
$errormsg="Failed to open file ".$outputfile."\n"; $errorstring="dol_compress_file failure - Failed to open file ".$outputfile."\n";
dol_syslog("dol_compress_file failure - ".$errormsg, LOG_ERR); dol_syslog($errorstring, LOG_ERR);
global $errormsg;
$errormsg = $errorstring;
return -6; return -6;
} }
@ -1958,12 +1967,16 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz")
{ {
global $errormsg; global $errormsg;
$errormsg=$archive->errorInfo(true); $errormsg=$archive->errorInfo(true);
dol_syslog("dol_compress_file failure - ".$errormsg, LOG_ERR);
if ($archive->errorCode() == PCLZIP_ERR_WRITE_OPEN_FAIL) if ($archive->errorCode() == PCLZIP_ERR_WRITE_OPEN_FAIL)
{ {
dol_syslog("dol_compress_file error PCLZIP_ERR_WRITE_OPEN_FAIL", LOG_ERR); $errorstring = "PCLZIP_ERR_WRITE_OPEN_FAIL";
dol_syslog("dol_compress_file error - archive->errorCode() = PCLZIP_ERR_WRITE_OPEN_FAIL", LOG_ERR);
return -4; return -4;
} }
$errorstring = "dol_compress_file error archive->errorCode = ".$archive->errorCode()." errormsg=".$errormsg;
dol_syslog("dol_compress_file failure - ".$errormsg, LOG_ERR);
return -3; return -3;
} }
else else
@ -1983,7 +1996,11 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz")
} }
else else
{ {
dol_syslog("Try to zip with format ".$mode." with no handler for this format", LOG_ERR); $errorstring = "Try to zip with format ".$mode." with no handler for this format";
dol_syslog($errorstring, LOG_ERR);
global $errormsg;
$errormsg = $errorstring;
return -2; return -2;
} }
} }
@ -1991,8 +2008,10 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz")
{ {
global $langs, $errormsg; global $langs, $errormsg;
$langs->load("errors"); $langs->load("errors");
dol_syslog("Failed to open file ".$outputfile, LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir"); $errormsg=$langs->trans("ErrorFailedToWriteInDir");
$errorstring = "Failed to open file ".$outputfile;
dol_syslog($errorstring, LOG_ERR);
return -1; return -1;
} }
} }
@ -2063,13 +2082,14 @@ function dol_uncompress($inputfile, $outputdir)
* @param string $inputdir Source dir name * @param string $inputdir Source dir name
* @param string $outputfile Target file name (output directory must exists and be writable) * @param string $outputfile Target file name (output directory must exists and be writable)
* @param string $mode 'zip' * @param string $mode 'zip'
* @param string $excludefiles A regex pattern. For example: '/\.log$|\/temp\//'
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function dol_compress_dir($inputdir, $outputfile, $mode = "zip") function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '')
{ {
$foundhandler=0; $foundhandler=0;
dol_syslog("Try to zip dir ".$inputdir." into ".$outputdir." mode=".$mode); dol_syslog("Try to zip dir ".$inputdir." into ".$outputfile." mode=".$mode);
if (! dol_is_dir(dirname($outputfile)) || ! is_writable(dirname($outputfile))) if (! dol_is_dir(dirname($outputfile)) || ! is_writable(dirname($outputfile)))
{ {
@ -2096,6 +2116,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip")
return 1; return 1;
} }
else*/ else*/
//if (class_exists('ZipArchive') && ! empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS))
if (class_exists('ZipArchive')) if (class_exists('ZipArchive'))
{ {
$foundhandler=1; $foundhandler=1;
@ -2103,6 +2124,13 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip")
// Initialize archive object // Initialize archive object
$zip = new ZipArchive(); $zip = new ZipArchive();
$result = $zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE); $result = $zip->open($outputfile, ZipArchive::CREATE | ZipArchive::OVERWRITE);
if (! $result)
{
global $langs, $errormsg;
$langs->load("errors");
$errormsg=$langs->trans("ErrorFailedToWriteInFile", $outputfile);
return -4;
}
// Create recursive directory iterator // Create recursive directory iterator
/** @var SplFileInfo[] $files */ /** @var SplFileInfo[] $files */
@ -2119,11 +2147,13 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip")
// Get real and relative path for current file // Get real and relative path for current file
$filePath = $file->getRealPath(); $filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($inputdir) + 1); $relativePath = substr($filePath, strlen($inputdir) + 1);
if (empty($excludefiles) || ! preg_match($excludefiles, $filePath))
{
// Add current file to archive // Add current file to archive
$zip->addFile($filePath, $relativePath); $zip->addFile($filePath, $relativePath);
} }
} }
}
// Zip archive will be created only after closing object // Zip archive will be created only after closing object
$zip->close(); $zip->close();

View File

@ -816,8 +816,10 @@ function dol_size($size, $type = '')
*/ */
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
{ {
// List of special chars for filenames are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file // List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°'); // Char '>' '<' '|' '$' and ';' are special chars for shells.
// Char '/' and '\' are file delimiters.
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';');
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
} }
@ -942,11 +944,15 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
* @param string $stringtoescape String to escape * @param string $stringtoescape String to escape
* @param int $keepb 1=Preserve b tags (otherwise, remove them) * @param int $keepb 1=Preserve b tags (otherwise, remove them)
* @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value). Set to 1 when escaping for a <textarea>. * @param int $keepn 1=Preserve \r\n strings (otherwise, replace them with escaped value). Set to 1 when escaping for a <textarea>.
* @param string $keepmoretags '' or 'common' or list of tags
* @return string Escaped string * @return string Escaped string
* @see dol_string_nohtmltag(), dol_string_nospecial(), dol_string_unaccent() * @see dol_string_nohtmltag(), dol_string_nospecial(), dol_string_unaccent()
*/ */
function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0) function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $keepmoretags = '')
{ {
if ($keepmoretags == 'common') $keepmoretags = 'html,body,a,em,i,u,ul,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody';
// TODO Implement $keepmoretags
// escape quotes and backslashes, newlines, etc. // escape quotes and backslashes, newlines, etc.
$tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags $tmp=html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
if (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>'')); if (! $keepb) $tmp=strtr($tmp, array("<b>"=>'','</b>'=>''));
@ -3861,6 +3867,8 @@ function dol_print_error($db = '', $error = '', $errors = null)
if (empty($dolibarr_main_prod)) print $out; if (empty($dolibarr_main_prod)) print $out;
else else
{ {
print 'This website is currently temporarly offline. This may be due to a maintenance operation. Current status of operation are on next line...<br><br>'."\n";
$langs->load("errors");
print $langs->trans("DolibarrHasDetectedError").'. '; print $langs->trans("DolibarrHasDetectedError").'. ';
print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");
define("MAIN_CORE_ERROR", 1); define("MAIN_CORE_ERROR", 1);
@ -5564,7 +5572,7 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false)
/** /**
* This function is called to encode a string into a HTML string but differs from htmlentities because * This function is called to encode a string into a HTML string but differs from htmlentities because
* a detection is done before to see if text is already HTML or not. Also, all entities but &,<,> are converted. * a detection is done before to see if text is already HTML or not. Also, all entities but &,<,>," are converted.
* This permits to encode special chars to entities with no double encoding for already encoded HTML strings. * This permits to encode special chars to entities with no double encoding for already encoded HTML strings.
* This function also remove last EOL or BR if $removelasteolbr=1 (default). * This function also remove last EOL or BR if $removelasteolbr=1 (default).
* For PDF usage, you can show text by 2 ways: * For PDF usage, you can show text by 2 ways:

View File

@ -124,7 +124,7 @@ function show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass)
} }
else else
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action='.$testlabel.'">'.$butlabel.'</a>'; print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action='.$testlabel.'">'.$butlabel.'</a>';
} }
print '<br><br>'; print '<br><br>';
} }

View File

@ -40,7 +40,7 @@ function multicurrencyAdminPrepareHead()
$head[$h][2] = 'settings'; $head[$h][2] = 'settings';
$h++; $h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'multicurrency'); complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency');
return $head; return $head;
} }

View File

@ -271,7 +271,7 @@ $list = array (
*/ */
function oauthadmin_prepare_head() function oauthadmin_prepare_head()
{ {
global $langs, $conf, $user; global $langs, $conf;
$h = 0; $h = 0;
$head = array(); $head = array();

View File

@ -346,7 +346,7 @@ function project_admin_prepare_head()
* @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project)
* @param string $filterprogresscalc filter text * @param string $filterprogresscalc filter text
* @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled'
* @return void * @return int Nb of tasks shown
*/ */
function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0) function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0)
{ {
@ -448,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public; $projectstatic->public=$lines[$i]->public;
$projectstatic->title=$lines[$i]->projectlabel; $projectstatic->title=$lines[$i]->projectlabel;
$projectstatic->bill_time=$lines[$i]->bill_time; $projectstatic->usage_bill_time=$lines[$i]->usage_bill_time;
$taskstatic->id=$lines[$i]->id; $taskstatic->id=$lines[$i]->id;
$taskstatic->ref=$lines[$i]->ref; $taskstatic->ref=$lines[$i]->ref;
@ -572,7 +572,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
{ {
// Time not billed // Time not billed
print '<td class="right">'; print '<td class="right">';
if ($lines[$i]->bill_time) if ($lines[$i]->usage_bill_time)
{ {
print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill; $total_projectlinesa_tobill += $lines[$i]->tobill;
@ -585,7 +585,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Time billed // Time billed
print '<td class="right">'; print '<td class="right">';
if ($lines[$i]->bill_time) if ($lines[$i]->usage_bill_time)
{ {
print convertSecondToTime($lines[$i]->billed, 'allhourmin'); print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$total_projectlinesa_billed += $lines[$i]->billed; $total_projectlinesa_billed += $lines[$i]->billed;
@ -1047,7 +1047,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet'; $extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.'; $extrafieldsobjectprefix='efp.';
@ -1082,10 +1082,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n"; print "</td>\n";
} }
if (! empty($arrayfields['p.bill_time']['checked'])) if (! empty($arrayfields['p.usage_bill_time']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print yn($lines[$i]->bill_time); print yn($lines[$i]->usage_bill_time);
print "</td>\n"; print "</td>\n";
} }
@ -1427,7 +1427,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
$extrafieldsobjectkey='projet'; $extrafieldsobjectkey='projet';
$extrafieldsobjectprefix='efp.'; $extrafieldsobjectprefix='efp.';
@ -1462,10 +1462,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); print price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print "</td>\n"; print "</td>\n";
} }
if (! empty($arrayfields['p.bill_time']['checked'])) if (! empty($arrayfields['p.usage_bill_time']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';
print yn($lines[$i]->bill_time); print yn($lines[$i]->usage_bill_time);
print "</td>\n"; print "</td>\n";
} }

View File

@ -59,7 +59,7 @@ function ticketAdminPrepareHead()
//$this->tabs = array( //$this->tabs = array(
// 'entity:-tabname:Title:@ticket:/ticket/mypage.php?id=__ID__' // 'entity:-tabname:Title:@ticket:/ticket/mypage.php?id=__ID__'
//); // to remove a tab //); // to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'ticketadmin'); complete_head_from_modules($conf, $langs, null, $head, $h, 'ticketadmin');
return $head; return $head;
} }

View File

@ -636,10 +636,11 @@ function getStructuredData($type, $data = array())
} }
/** /**
* Return list of containers object that match a criteria * Return list of containers object that match a criteria.
* WARNING: This function can be used by websites.
* *
* @param string $type Type of container to search into (Example: 'page') * @param string $type Type of container to search into (Example: 'page')
* @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'metacontent') * @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination, ...)
* @param string $searchstring Search string * @param string $searchstring Search string
* @param int $max Max number of answers * @param int $max Max number of answers
* @return string HTML content * @return string HTML content
@ -674,20 +675,21 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
} }
$searchdone = 0; $searchdone = 0;
$found = 0;
if (! $error && in_array($algo, array('meta', 'metacontent', 'content'))) if (! $error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo)))
{ {
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page'; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page';
$sql.= " WHERE fk_website = ".$website->id; $sql.= " WHERE fk_website = ".$website->id;
if ($type) $sql.= " AND type_container = '".$db->escape($type)."'"; if ($type) $sql.= " AND type_container = '".$db->escape($type)."'";
$sql.= " AND ("; $sql.= " AND (";
$searchalgo = ''; $searchalgo = '';
if ($algo == 'meta' || $algo == 'metacontent') if (preg_match('/meta/', $algo))
{ {
$searchalgo.= ($searchalgo?' OR ':'')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'"; $searchalgo.= ($searchalgo?' OR ':'')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
$searchalgo.= ($searchalgo?' OR ':'')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords $searchalgo.= ($searchalgo?' OR ':'')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
} }
if ($algo == 'metacontent' || $algo == 'content') if (preg_match('/content/', $algo))
{ {
$searchalgo.= ($searchalgo?' OR ':'')."content LIKE '%".$db->escape($searchstring)."%'"; $searchalgo.= ($searchalgo?' OR ':'')."content LIKE '%".$db->escape($searchstring)."%'";
} }
@ -706,16 +708,10 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
$tmpwebsitepage = new WebsitePage($db); $tmpwebsitepage = new WebsitePage($db);
$tmpwebsitepage->fetch($obj->rowid); $tmpwebsitepage->fetch($obj->rowid);
if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage; if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage;
$found++;
} }
$i++; $i++;
} }
$arrayresult['code']='OK';
if (empty($arrayresult['list']))
{
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("NoRecordFound");
}
} }
else else
{ {
@ -727,12 +723,64 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
$searchdone = 1; $searchdone = 1;
} }
if (! $searchdone) if (! $error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
{
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$website->ref;
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
$filecss=$pathofwebsite.'/styles.css.php';
$filejs=$pathofwebsite.'/javascript.js.php';
$filerobot=$pathofwebsite.'/robots.txt';
$filehtaccess=$pathofwebsite.'/.htaccess';
$filemanifestjson=$pathofwebsite.'/manifest.json.php';
$filereadme=$pathofwebsite.'/README.md';
$filecontent = file_get_contents($filehtmlheader);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
$arrayresult['list'][]=array('type'=>'website_htmlheadercontent');
}
$filecontent = file_get_contents($filecss);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
$arrayresult['list'][]=array('type'=>'website_csscontent');
}
$filecontent = file_get_contents($filejs);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
$arrayresult['list'][]=array('type'=>'website_jscontent');
}
$filerobot = file_get_contents($filerobot);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
$arrayresult['list'][]=array('type'=>'website_robotcontent');
}
$searchdone = 1;
}
if (! $error)
{
if ($searchdone)
{
$arrayresult['code']='OK';
if (empty($arrayresult['list']))
{
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("NoRecordFound");
}
}
else
{ {
$error++; $error++;
$arrayresult['code']='KO'; $arrayresult['code']='KO';
$arrayresult['message']='No supported algorithm found'; $arrayresult['message']='No supported algorithm found';
} }
}
return $arrayresult; return $arrayresult;
} }

View File

@ -66,6 +66,7 @@ class mailing_thirdparties extends MailingTargets
$cibles = array(); $cibles = array();
$addDescription= "";
// Select the third parties from category // Select the third parties from category
if (empty($_POST['filter'])) if (empty($_POST['filter']))
{ {
@ -77,29 +78,10 @@ class mailing_thirdparties extends MailingTargets
} }
else else
{ {
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label"; $addFilter ="";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql.= " WHERE s.email <> ''";
$sql.= " AND s.entity IN (".getEntity('societe').")";
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
$sql.= " AND cs.fk_soc = s.rowid";
$sql.= " AND c.rowid = cs.fk_categorie";
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
$sql.= " UNION ";
$sql.= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_fournisseur as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql.= " WHERE s.email <> ''";
$sql.= " AND s.entity IN (".getEntity('societe').")";
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
$sql.= " AND cs.fk_soc = s.rowid";
$sql.= " AND c.rowid = cs.fk_categorie";
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
}
$addDescription= "";
if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1')
{ {
$sql.= " AND s.client=" . $_POST["filter_client"]; $addFilter.= " AND s.client=" . $_POST["filter_client"];
$addDescription= $langs->trans('ProspectCustomer')."="; $addDescription= $langs->trans('ProspectCustomer')."=";
if ($_POST["filter_client"] == 0) if ($_POST["filter_client"] == 0)
{ {
@ -131,14 +113,34 @@ class mailing_thirdparties extends MailingTargets
$addDescription.= $langs->trans("Status")."="; $addDescription.= $langs->trans("Status")."=";
if ($_POST["filter_status"] == '1') if ($_POST["filter_status"] == '1')
{ {
$sql.= " AND s.status=1"; $addFilter.= " AND s.status=1";
$addDescription.= $langs->trans("Enabled"); $addDescription.= $langs->trans("Enabled");
} }
else else
{ {
$sql.= " AND s.status=0"; $addFilter.= " AND s.status=0";
$addDescription.= $langs->trans("Disabled"); $addDescription.= $langs->trans("Disabled");
} }
}
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql.= " WHERE s.email <> ''";
$sql.= " AND s.entity IN (".getEntity('societe').")";
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
$sql.= " AND cs.fk_soc = s.rowid";
$sql.= " AND c.rowid = cs.fk_categorie";
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
$sql.= $addFilter;
$sql.= " UNION ";
$sql.= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_fournisseur as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql.= " WHERE s.email <> ''";
$sql.= " AND s.entity IN (".getEntity('societe').")";
$sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
$sql.= " AND cs.fk_soc = s.rowid";
$sql.= " AND c.rowid = cs.fk_categorie";
$sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'";
$sql.= $addFilter;
} }
$sql.= " ORDER BY email"; $sql.= " ORDER BY email";

View File

@ -16,7 +16,7 @@
*/ */
/** /**
* \defgroup debugbar Debug bar * \defgroup debugbar Module Debug bar
* \brief debugbar module descriptor. * \brief debugbar module descriptor.
* *
* \file htdocs/core/modules/modDebugBar.class.php * \file htdocs/core/modules/modDebugBar.class.php

View File

@ -111,6 +111,13 @@ class modFournisseur extends DolibarrModules
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "SUPPLIER_ORDER_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_orders";
$this->const[$r][3] = '';
$this->const[$r][4] = 0;
$r++;
// Boxes // Boxes
$this->boxes = array( $this->boxes = array(
0=>array('file'=>'box_graph_invoices_supplier_permonth.php','enabledbydefaulton'=>'Home'), 0=>array('file'=>'box_graph_invoices_supplier_permonth.php','enabledbydefaulton'=>'Home'),
@ -629,6 +636,24 @@ class modFournisseur extends DolibarrModules
$this->remove($options); $this->remove($options);
//ODT template
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_orders/template_supplier_order.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_orders';
$dest=$dirodt.'/template_supplier_order.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src, $dest, 0, 0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest);
return 0;
}
}
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order_supplier' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'order_supplier' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order_supplier',".$conf->entity.")", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','order_supplier',".$conf->entity.")",

View File

@ -19,6 +19,7 @@
/** /**
* \defgroup ticket Module Ticket * \defgroup ticket Module Ticket
* \brief Module for ticket and request management.
* \file core/modules/modTicket.class.php * \file core/modules/modTicket.class.php
* \ingroup ticket * \ingroup ticket
* \brief Description and activation file for module Ticket * \brief Description and activation file for module Ticket

View File

@ -34,13 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/ */
class mod_codeclient_elephant extends ModeleThirdPartyCode class mod_codeclient_elephant extends ModeleThirdPartyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Elephant';
/** /**
* @var string model name * @var string model name
*/ */

View File

@ -38,13 +38,6 @@ class mod_codeclient_leopard extends ModeleThirdPartyCode
* Le fonctionnement de celui-ci doit donc rester le plus ouvert possible * Le fonctionnement de celui-ci doit donc rester le plus ouvert possible
*/ */
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Leopard';
/** /**
* @var string model name * @var string model name
*/ */

View File

@ -32,13 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/ */
class mod_codeclient_monkey extends ModeleThirdPartyCode class mod_codeclient_monkey extends ModeleThirdPartyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Monkey';
/** /**
* @var string model name * @var string model name
*/ */

View File

@ -31,13 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/ */
class mod_codecompta_aquarium extends ModeleAccountancyCode class mod_codecompta_aquarium extends ModeleAccountancyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Aquarium';
/** /**
* @var string model name * @var string model name
*/ */
@ -53,6 +46,8 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
public $prefixsupplieraccountancycode; public $prefixsupplieraccountancycode;
public $position = 20;
/** /**
* Constructor * Constructor
@ -93,11 +88,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n";
$texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<br>\n"; $texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<br>\n";
$texte.="<br>\n"; $texte.="<br>\n";
if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_SPECIAL').' = '.yn(1)."<br>\n"; if (! isset($conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_AQUARIUM_REMOVE_SPECIAL)) $texte.=$langs->trans('RemoveSpecialChars').' = '.yn(1)."<br>\n";
//if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_ALPHA').' = '.yn($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)."<br>\n"; //if (! empty($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)) $texte.=$langs->trans('COMPANY_AQUARIUM_REMOVE_ALPHA').' = '.yn($conf->global->COMPANY_AQUARIUM_REMOVE_ALPHA)."<br>\n";
if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) $texte.=$langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n"; if (! empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) $texte.=$langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
$texte.= '</td>'; $texte.= '</td>';
$texte.= '<td class="left">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; $texte.= '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr></table>'; $texte.= '</tr></table>';
$texte.= '</form>'; $texte.= '</form>';

View File

@ -0,0 +1,267 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/societe/mod_codecompta_digitaria.php
* \ingroup societe
* \brief File of class to manage accountancy code of thirdparties with Digitaria rules
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
/**
* Class to manage accountancy code of thirdparties with Digitaria rules
*/
class mod_codecompta_digitaria extends ModeleAccountancyCode
{
/**
* @var string model name
*/
public $name='Digitaria';
/**
* Dolibarr version of the loaded document
* @var string
*/
public $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefixcustomeraccountancycode;
public $prefixsupplieraccountancycode;
public $position = 30;
/**
* Constructor
*/
public function __construct()
{
global $conf, $langs;
if (! isset($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER='411';
if (! isset($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER='401';
$this->prefixcustomeraccountancycode=$conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER;
$this->prefixsupplieraccountancycode=$conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER;
if (! isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER='5';
if (! isset($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) || trim($conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER) == '') $conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER='5';
$this->customeraccountancycodecharacternumber=$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER;
$this->supplieraccountancycodecharacternumber=$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER;
}
/**
* Return description of module
*
* @param Translate $langs Object langs
* @return string Description of module
*/
public function info($langs)
{
global $conf, $form;
$tooltip='';
$texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="COMPANY_DIGITARIA_MASK_SUPPLIER">';
$texte.= '<input type="hidden" name="param2" value="COMPANY_DIGITARIA_MASK_CUSTOMER">';
$texte.= '<input type="hidden" name="param3" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER">';
$texte.= '<input type="hidden" name="param4" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER">';
$texte.= '<table class="nobordernopadding" width="100%">';
$s1= $form->textwithpicto('<input type="text" class="flat" size="4" name="value1" value="'.$conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER.'">', $tooltip, 1, 1);
$s2= $form->textwithpicto('<input type="text" class="flat" size="4" name="value2" value="'.$conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER.'">', $tooltip, 1, 1);
$s3= $form->textwithpicto('<input type="text" class="flat" size="2" name="value3" value="'.$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER.'">', $tooltip, 1, 1);
$s4= $form->textwithpicto('<input type="text" class="flat" size="2" name="value4" value="'.$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER.'">', $tooltip, 1, 1);
$texte.= '<tr><td>';
$texte.= $langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2, $s4)."<br>\n";
$texte.= $langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1, $s3)."<br>\n";
$texte.= "<br>\n";
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || ! empty($conf->global->$conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $texte.= $langs->trans('RemoveSpecialChars').' = '.yn(1)."<br>\n";
// Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (! empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) $texte.= $langs->trans('COMPANY_DIGITARIA_CLEAN_REGEX').' = '.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX."<br>\n";
// Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || ! empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) $texte.= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."<br>\n";
$texte.= '</td>';
$texte.= '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
$texte.= '</tr></table>';
$texte.= '</form>';
return $texte;
}
/**
* Return an example of result returned by getNextValue
*
* @param Translate $langs Object langs
* @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect)
* @return string Example
*/
public function getExample($langs, $objsoc = 0, $type = -1)
{
global $mysoc;
$s= $langs->trans("ThirdPartyName").": ".$mysoc->name;
$s.="<br>\n";
if (! isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $thirdpartylabelexample = preg_replace('/([^a-z0-9])/i', '', $mysoc->name);
$s.="<br>\n";
$s.=$this->prefixcustomeraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->customeraccountancycodecharacternumber));
$s.="<br>\n";
$s.=$this->prefixsupplieraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, $this->supplieraccountancycodecharacternumber));
return $s;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set accountancy account code for a third party into this->code
*
* @param DoliDB $db Database handler
* @param Societe $societe Third party object
* @param int $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
public function get_code($db, $societe, $type = '')
{
// phpcs:enable
$i = 0;
$this->code='';
if (is_object($societe))
{
dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(! empty($societe->name)?$societe->name:''));
if ($type == 'supplier') {
$codetouse = $societe->name;
$prefix = $this->prefixsupplieraccountancycode;
$width = $this->supplieraccountancycodecharacternumber;
}
elseif ($type == 'customer')
{
$codetouse = $societe->name;
$prefix = $this->prefixcustomeraccountancycode;
$width = $this->customeraccountancycodecharacternumber;
}
else
{
$this->error = 'Bad value for parameter type';
return -1;
}
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || ! empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) $codetouse=preg_replace('/([^a-z0-9])/i', '', $codetouse);
// Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (! empty($conf->global->COMPANY_DIGITARIA_CLEAN_REGEX)) // Example: $conf->global->COMPANY_DIGITARIA_CLEAN_REGEX='^..(..)..';
{
$codetouse=preg_replace('/'.$conf->global->COMPANY_DIGITARIA_CLEAN_REGEX.'/', '\1\2\3', $codetouse);
}
$this->code = $prefix.strtoupper(substr($codetouse, 0, $width));
dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code);
// Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default)
if (! isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || ! empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE))
{
$disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type);
while ($disponibility <> 0 && $i < 100) {
$widthsupplier = $this->supplieraccountancycodecharacternumber;
$widthcustomer = $this->customeraccountancycodecharacternumber;
if ($i <= 9) {
$a = 1;
}
if ($i >= 10 && $i <= 99) {
$a = 2;
}
if ($type == 'supplier') {
$this->code = $prefix . strtoupper(substr($codetouse, 0, $widthsupplier - $a)) . $i;
} elseif ($type == 'customer') {
$this->code = $prefix . strtoupper(substr($codetouse, 0, $widthcustomer - $a)) . $i;
}
$disponibility = $this->checkIfAccountancyCodeIsAlreadyUsed($db, $this->code, $type);
$i++;
}
} else {
$disponibility == 0;
}
}
if ($disponibility == 0)
{
return 0; // return ok
}
else
{
return -1; // return ko
}
}
/**
* Check accountancy account code for a third party into this->code
*
* @param DoliDB $db Database handler
* @param string $code Code of third party
* @param int $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
public function checkIfAccountancyCodeIsAlreadyUsed($db, $code, $type = '')
{
if ($type == 'supplier')
{
$typethirdparty = 'code_compta_fournisseur';
}
elseif ($type == 'customer')
{
$typethirdparty = 'code_compta';
}
else
{
$this->error = 'Bad value for parameter type';
return -1;
}
$sql = "SELECT ".$typethirdparty." FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE ".$typethirdparty." = '".$code."'";
$resql=$db->query($sql);
if ($resql)
{
if ($db->num_rows($resql) == 0)
{
dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' available");
return 0; // Available
}
else
{
dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' not available");
return -1; // Not available
}
}
else
{
$this->error=$db->error()." sql=".$sql;
return -2; // Error
}
}
}

View File

@ -30,13 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/ */
class mod_codecompta_panicum extends ModeleAccountancyCode class mod_codecompta_panicum extends ModeleAccountancyCode
{ {
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Panicum';
/** /**
* @var string model name * @var string model name
*/ */
@ -48,6 +41,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
*/ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $position = 10;
/** /**
* Constructor * Constructor

View File

@ -83,18 +83,18 @@ abstract class ModeleThirdPartyCode
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** Renvoi nom module /** Return name of module
* *
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Nom du module * @return string Nom du module
*/ */
public function getNom($langs) public function getNom($langs)
{ {
return $this->nom; return $this->name;
} }
/** Renvoi un exemple de numerotation /** Return an example of numbering
* *
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @return string Example * @return string Example
@ -261,8 +261,7 @@ abstract class ModeleThirdPartyCode
/** /**
* \class ModeleAccountancyCode * Parent class for third parties accountancy code generators
* \brief Parent class for third parties accountancy code generators
*/ */
abstract class ModeleAccountancyCode abstract class ModeleAccountancyCode
{ {
@ -340,7 +339,7 @@ abstract class ModeleAccountancyCode
$langs->load("admin"); $langs->load("admin");
$s=''; $s='';
if ($type == -1) $s.=$langs->trans("Name").': <b>'.$this->nom.'</b><br>'; if ($type == -1) $s.=$langs->trans("Name").': <b>'.$this->name.'</b><br>';
if ($type == -1) $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>'; if ($type == -1) $s.=$langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
//$s.='<br>'; //$s.='<br>';
//$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>'; //$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@ -0,0 +1,517 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Tim Otte <otte@meuser.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/supplier_order/pdf/doc_generic_supplier_order_odt.modules.php
* \ingroup commande
* \brief File of class to build ODT documents for supplier orders
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
/**
* Class to build documents using ODF templates generator
*/
class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
{
/**
* Issuer
* @var Societe
*/
public $issuer;
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = array(5, 5);
/**
* @var string Dolibarr version of the loaded document
*/
public $version = 'dolibarr';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $conf, $langs, $mysoc;
// Load translation files required by the page
$langs->loadLangs(array("main","companies"));
$this->db = $db;
$this->name = "ODT templates";
$this->description = $langs->trans("DocumentModelOdt");
$this->scandir = 'SUPPLIER_ORDER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
// Dimension page pour format A4
$this->type = 'odt';
$this->page_largeur = 0;
$this->page_hauteur = 0;
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=0;
$this->marge_droite=0;
$this->marge_haute=0;
$this->marge_basse=0;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
// Recupere issuer
$this->issuer=$mysoc;
if (! $this->issuer->country_code) $this->issuer->country_code=substr($langs->defaultlang, -2); // By default if not defined
}
/**
* Return description of a module
*
* @param Translate $langs Lang object to use for output
* @return string Description
*/
public function info($langs)
{
global $conf,$langs;
// Load translation files required by the page
$langs->loadLangs(array("errors","companies"));
$form = new Form($this->db);
$texte = $this->description.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="SUPPLIER_ORDER_ADDON_PDF_ODT_PATH">';
$texte.= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte.= '<tr><td>';
$texttitle=$langs->trans("ListOfDirectories");
$listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH)));
$listoffiles=array();
foreach($listofdir as $key=>$tmpdir)
{
$tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
if (! $tmpdir) {
unset($listofdir[$key]); continue;
}
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
else
{
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
}
}
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
// Add list of substitution keys
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '<br></div></div>';
// Scan directories
$nbofiles=count($listoffiles);
if (! empty($conf->global->COMMANDE_ADDON_PDF_ODT_PATH))
{
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte.=count($listoffiles);
//$texte.=$nbofiles?'</a>':'';
$texte.='</b>';
}
if ($nbofiles)
{
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
foreach($listoffiles as $file)
{
$texte.=$file['name'].'<br>';
}
$texte.='<div id="div_'.get_class($this).'">';
}
$texte.= '</td>';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
$texte.= '</table>';
$texte.= '</form>';
return $texte;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1 if OK, <=0 if KO
*/
public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
{
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
return -1;
}
// Add odtgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->fournisseur->commande->dir_output)
{
$object->fetch_thirdparty();
if ($object->specimen)
{
$dir = $conf->fournisseur->commande->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
$dir = $conf->fournisseur->commande->dir_output . '/'. $objectref;
$file = $dir . "/" . $objectref . ".pdf";
if (! empty($conf->global->SUPPLIER_REF_IN_NAME)) $file = $dir . "/" . $objectref . ($objectrefsupplier?"_".$objectrefsupplier:"").".pdf";
}
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
if (file_exists($dir))
{
//print "srctemplatepath=".$srctemplatepath; // Src filename
$newfile=basename($srctemplatepath);
$newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp=preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp=preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp=$objectref.'_'.$newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
}
else
{
$filename=$newfiletmp.'.'.$newfileformat;
}
$file=$dir.'/'.$filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
dol_mkdir($conf->commande->dir_temp);
// If CUSTOMER contact defined on order, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('external', 'CUSTOMER');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
$contactobject=null;
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
else {
$socobject = $object->thirdparty;
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
$contactobject = $object->contact;
}
}
else
{
$socobject=$object->thirdparty;
}
// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $this->issuer->name,
'__FROM_EMAIL__' => $this->issuer->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Line of free text
$newfreetext='';
$paramfreetext='ORDER_FREE_TEXT';
if (! empty($conf->global->$paramfreetext))
{
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
}
// Open and load template
require_once ODTPHP_PATH.'odf.php';
try {
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->fournisseur->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
)
);
}
catch(Exception $e)
{
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
// After construction $odfHandler->contentXml contains content and
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
// [!-- BEGIN lines --]*[!-- END lines --]
//print html_entity_decode($odfHandler->__toString());
//print exit;
// Make substitutions into odt of freetext
try {
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
// Define substitution array
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_objet=$this->get_substitutionarray_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user, $outputlangs);
$array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs);
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
$tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key=>$value)
{
try {
if (preg_match('/logo$/', $key)) // Image
{
if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
else // Text
{
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Replace tags of lines
try
{
$foundtagforlines = 1;
try {
$listlines = $odfHandler->setSegment('lines');
}
catch(OdfException $e)
{
// We may arrive here if tags for lines not present into template
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines)
{
foreach ($object->lines as $line)
{
$tmparray=$this->get_substitutionarray_lines($line, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
// Call the ODTSubstitutionLine hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach($tmparray as $key => $val)
{
try
{
$listlines->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
catch(SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listlines->merge();
}
$odfHandler->mergeSegment($listlines);
}
}
catch(OdfException $e)
{
$this->error=$e->getMessage();
dol_syslog($this->error, LOG_WARNING);
return -1;
}
// Replace labels translated
$tmparray=$outputlangs->get_translations_for_substitutions();
foreach($tmparray as $key=>$value)
{
try {
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Call the beforeODTSave hook
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// Write new file
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
try {
$odfHandler->exportAsAttachedPDF($file);
}catch (Exception $e){
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
else {
try {
$odfHandler->saveToDisk($file);
} catch (Exception $e) {
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
return -1;
}
}

View File

@ -892,15 +892,13 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$action; $actioncomm->code = 'AC_'.$action;
$actioncomm->label = $object->actionmsg2; $actioncomm->label = $object->actionmsg2;
$actioncomm->note = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg) $actioncomm->note_private= $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
$actioncomm->fk_project = $projectid; $actioncomm->fk_project = $projectid;
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;
$actioncomm->durationp = 0; $actioncomm->durationp = 0;
$actioncomm->punctual = 1; $actioncomm->punctual = 1;
$actioncomm->percentage = -1; // Not applicable $actioncomm->percentage = -1; // Not applicable
$actioncomm->societe = $societeforaction;
$actioncomm->contact = $contactforaction;
$actioncomm->socid = $societeforaction->id; $actioncomm->socid = $societeforaction->id;
$actioncomm->contactid = $contactforaction->id; $actioncomm->contactid = $contactforaction->id;
$actioncomm->authorid = $user->id; // User saving action $actioncomm->authorid = $user->id; // User saving action

View File

@ -621,7 +621,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
} }
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[]="ErrorLDAP ".$ldap->error;
}
} }
} }
elseif ($action == 'MEMBER_NEW_PASSWORD') elseif ($action == 'MEMBER_NEW_PASSWORD')
@ -644,7 +647,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result=$ldap->update($dn, $info, $user, $olddn); $result=$ldap->update($dn, $info, $user, $olddn);
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }
} }
@ -668,7 +674,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result=$ldap->update($dn, $info, $user, $olddn); $result=$ldap->update($dn, $info, $user, $olddn);
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }
} }
@ -721,7 +730,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
} }
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }
@ -747,7 +759,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result=$ldap->add($dn, $info, $user); $result=$ldap->add($dn, $info, $user);
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }
elseif ($action == 'MEMBER_TYPE_MODIFY') elseif ($action == 'MEMBER_TYPE_MODIFY')
@ -788,7 +803,9 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result=$ldap->update($dn, $info, $user, $olddn); $result=$ldap->update($dn, $info, $user, $olddn);
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0) {
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }
elseif ($action == 'MEMBER_TYPE_DELETE') elseif ($action == 'MEMBER_TYPE_DELETE')
@ -807,7 +824,10 @@ class InterfaceLdapsynchro extends DolibarrTriggers
$result=$ldap->delete($dn); $result=$ldap->delete($dn);
} }
if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; if ($result <= 0)
{
$this->errors[] = "ErrorLDAP ".$ldap->error;
}
} }
} }

View File

@ -119,7 +119,7 @@ print '</form>';
print '<br><br><br>'; print '<br><br><br>';
print $langs->trans("UseMenuModuleToolsToAddCronJobs").'<br>'; print $langs->trans("UseMenuModuleToolsToAddCronJobs", dol_buildpath('/cron/list.php?leftmenu=admintools', 1)).'<br>';
if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)).'<br>'; if (! empty($conf->global->CRON_WARNING_DELAY_HOURS)) print info_admin($langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS)).'<br>';
print '<br>'; print '<br>';

View File

@ -325,7 +325,7 @@ if (($action=="create") || ($action=="edit"))
if ($action=="edit") dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron'); if ($action=="edit") dol_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron');
else dol_fiche_head(''); else dol_fiche_head('');
print '<table class="border" width="100%">'; print '<table class="border centpercent">';
print '<tr><td class="fieldrequired titlefieldcreate">'; print '<tr><td class="fieldrequired titlefieldcreate">';
print $langs->trans('CronLabel')."</td>"; print $langs->trans('CronLabel')."</td>";
@ -567,7 +567,7 @@ else
// box add_jobs_box // box add_jobs_box
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CronLabel')."</td>"; print $langs->trans('CronLabel')."</td>";
@ -638,7 +638,7 @@ else
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CronEvery')."</td>"; print $langs->trans('CronEvery')."</td>";
@ -697,7 +697,7 @@ else
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('CronDtLastLaunch')."</td><td>"; print $langs->trans('CronDtLastLaunch')."</td><td>";

View File

@ -48,7 +48,9 @@ function datapolicyAdminPrepareHead()
$h++; $h++;
} }
complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicy'); complete_head_from_modules($conf, $langs, null, $head, $h, 'datapolicy');
complete_head_from_modules($conf, $langs, null, $head, $h, 'datapolicy', 'remove');
return $head; return $head;
} }

View File

@ -63,9 +63,9 @@ function dav_admin_prepare_head()
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'admindav'); complete_head_from_modules($conf, $langs, null, $head, $h, 'admindav');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'admindav', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'admindav', 'remove');
return $head; return $head;
} }

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