Merge branch 'develop' into 11.0_workboard

This commit is contained in:
Laurent Destailleur 2019-09-03 17:50:09 +02:00 committed by GitHub
commit 1055582a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
953 changed files with 18110 additions and 6665 deletions

View File

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

View File

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

View File

@ -18,7 +18,7 @@ Following changes may create regressions for some external modules, but were nec
* The function show_theme() hase been renamed into showSkins()
* 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 hook "moreFamily" must return payment into var "totalpayment" and no more "paiement" (english replace french).

View File

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

View File

@ -134,6 +134,13 @@ class BookKeeping extends CommonObject
public $journal_label;
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
*

View File

@ -533,7 +533,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$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
$bookkeeping->subledger_account = '';
@ -596,7 +596,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$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
$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->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->label_compte = '';
$bookkeeping->label_operation = $reflabel;
$bookkeeping->entity = $conf->entity;

View File

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

View File

@ -300,7 +300,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$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->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$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->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->address = trim(GETPOST("address", 'alpha'));
@ -468,7 +468,8 @@ if (empty($reshook))
$object->firstname = $firstname;
$object->lastname = $lastname;
$object->gender = $gender;
$object->societe = $societe;
$object->societe = $societe; // deprecated
$object->company = $societe;
$object->address = $address;
$object->zip = $zip;
$object->town = $town;
@ -946,7 +947,7 @@ else
print "</td>\n";
// 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
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1066,7 +1067,7 @@ else
{
print $object->showOptionals($extrafields, 'edit');
}
print '<tbody>';
print "</table>\n";
dol_fiche_end();
@ -1206,7 +1207,7 @@ else
print "</td></tr>";
// 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
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1370,7 +1371,7 @@ else
{
print $object->showOptionals($extrafields, 'edit');
}
print '</table>';
dol_fiche_end();
@ -1447,13 +1448,13 @@ else
if ($object->morphy == 'mor')
{
$companyname=$object->societe;
$companyname=$object->company;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe;
if (! empty($object->company)) $companyalias=$object->company;
}
// Create a form array
@ -1635,7 +1636,7 @@ else
print '</td></tr>';
// 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
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("Lastname").": ".$this->lastname."\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("Zip").": ".$this->zip."\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:''),
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):($this->lastname?$this->lastname:''),
'__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:''),
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):($this->zip?$this->zip:''),
'__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.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$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.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
@ -682,7 +682,7 @@ class Adherent extends CommonObject
$luser->lastname=$this->lastname;
$luser->gender=$this->gender;
$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;
@ -1608,13 +1608,13 @@ class Adherent extends CommonObject
if ($this->morphy == 'mor')
{
$companyname=$this->societe;
$companyname=$this->company;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$companyname=$fullname;
if (! empty($this->societe)) $companyalias=$this->societe;
if (! empty($this->company)) $companyalias=$this->company;
}
$result=$customer->create_from_member($this, $companyname, $companyalias);
@ -2297,7 +2297,7 @@ class Adherent extends CommonObject
// phpcs:enable
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();
@ -2398,7 +2398,7 @@ class Adherent extends CommonObject
$this->gender='man';
$this->login='dolibspec';
$this->pass='dolibspec';
$this->societe = 'Societe ABC';
$this->company = 'Societe ABC';
$this->address = '61 jump street';
$this->zip = '75000';
$this->town = 'Paris';
@ -2483,9 +2483,9 @@ class Adherent extends CommonObject
$this->fullname=$this->getFullName($langs);
// For avoid ldap error when firstname and lastname are empty
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->societe)) {
$this->fullname = $this->societe;
$this->lastname = $this->societe;
if ($this->morphy == 'mor' && (empty($this->fullname) || $this->fullname == $this->company)) {
$this->fullname = $this->company;
$this->lastname = $this->company;
}
// 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->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->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;
@ -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->code = 'AC_'.$actioncode;
$actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg;
$actioncomm->note_private= $actionmsg;
$actioncomm->fk_project = 0;
$actioncomm->datep = $now;
$actioncomm->datef = $now;

View File

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

View File

@ -235,7 +235,7 @@ class MembersTypes extends DolibarrApi
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');
}

View File

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

View File

@ -83,10 +83,10 @@ if ($action == 'dolibarr2ldap')
* View
*/
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$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);
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="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// 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))
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
@ -111,18 +111,11 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
print "</tr>\n";
}
// Password crypted
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED))
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
print '<td class="valeur">'.$object->pass_crypted.'</td>';
print "</tr>\n";
}
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n";
$langs->load("admin");
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// LDAP DN
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))
{
$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
{
@ -190,12 +183,12 @@ if ($result > 0)
//print_r($records);
// Affichage arbre
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
// Show tree
if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{
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
{
@ -204,7 +197,7 @@ if ($result > 0)
}
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)
);
// 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.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.= " 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
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
$parameters=array();
$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";
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
$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)";
@ -683,7 +686,7 @@ while ($i < min($num, $limit))
} else {
$companyname=$obj->company;
}
$memberstatic->societe = $companyname;
$memberstatic->company = $companyname;
print '<tr class="oddeven">';

View File

@ -80,7 +80,7 @@ if ($id)
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -99,7 +99,7 @@ if ($id)
print '</tr>';
// 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
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="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border centpercent tableforfield">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -494,7 +494,7 @@ if ($rowid > 0)
print '</tr>';
// 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
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')
{
$companyname=$object->societe;
$companyname=$object->company;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe;
if (! empty($object->company)) $companyalias=$object->company;
}
// Create a form array
@ -903,7 +903,7 @@ if ($rowid > 0)
print '<input type="hidden" name="action" value="subscription">';
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="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('');

View File

@ -106,11 +106,11 @@ if ($cancel) {
if ($action == 'add' && $user->rights->adherent->configurer) {
$object->label = trim($label);
$object->morphy = trim($morphy);
$object->statut = (int) $statut;
$object->subscription = (int) $subscription;
$object->statut = (int) $statut;
$object->subscription = (int) $subscription;
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = (boolean) trim($vote);
$object->vote = (int) $vote;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
@ -489,7 +489,7 @@ if ($rowid > 0)
$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.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.subscription";
@ -649,7 +649,7 @@ if ($rowid > 0)
// Lastname
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";
}
@ -812,21 +812,25 @@ if ($rowid > 0)
if (empty($reshook))
{
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
if (is_array($extrafields->attributes['adherent_type']['label']))
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $_POST["options_" . $key];
$value = $object->array_options["options_" . $key];
}
} else {
$value = $adht->array_options["options_" . $key];
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key, $value);
print "</td></tr>\n";
}
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key, $value);
print "</td></tr>\n";
}
print '</table><br><br>';
}

View File

@ -155,16 +155,17 @@ if ($result > 0)
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")";
$records = $ldap->getAttribute($dn, $search);
//print_r($records);
// Affichage arbre
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
// Show tree
if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{
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
{
@ -173,7 +174,7 @@ if ($result > 0)
}
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();

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/class/doleditor.class.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
$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);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$formaccounting = new FormAccounting($db);
$withentity='';
@ -1890,6 +1890,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td>';
$transfound=0;
$transkey='';
// Special case for labels
if ($tabname == MAIN_DB_PREFIX.'c_payment_term')
{

View File

@ -254,6 +254,7 @@ class PrestaShopWebservice
public function add($options)
{
$xml = '';
$url = '';
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'];
}
else
{
throw new PrestaShopWebserviceException('Bad parameters given');
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
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']);
}
// 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>';
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');

View File

@ -219,7 +219,7 @@ if (! $error && $xml)
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// 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
foreach ($scanfiles as $keyfile => $valfile)
{

View File

@ -169,9 +169,6 @@ class DolibarrApiAccess implements iAuthenticate
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
/**
* @return string string to be used with WWW-Authenticate header
* @example Basic
* @example Digest
* @example OAuth
*/
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 $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 $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)
* @return string
*

View File

@ -178,7 +178,7 @@ class Setup extends DolibarrApi
}
}
} 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;
@ -331,7 +331,7 @@ class Setup extends DolibarrApi
* @param string $module To filter on module events
* @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)"
* @return List of events types
* @return array List of events types
*
* @url GET dictionary/event_types
*
@ -394,7 +394,7 @@ class Setup extends DolibarrApi
* @param string $module To filter on module events
* @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)"
* @return List of events types
* @return array List of civility types
*
* @url GET dictionary/civilities
*
@ -456,7 +456,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero)
* @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)"
* @return List of events types
* @return array List of currencies
*
* @url GET dictionary/currencies
*
@ -477,7 +477,7 @@ class Setup extends DolibarrApi
$sql.= " AND m.entity IN (".getEntity('multicurrency').")";
if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)";
}
// Add sql filters
if ($sqlfilters)
{
@ -523,7 +523,7 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @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-%')"
* @return List of extra fields
* @return array List of extra fields
*
* @url GET extrafields
*
@ -602,7 +602,7 @@ class Setup extends DolibarrApi
* @param string $town To filter on city name
* @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)"
* @return List of towns
* @return array List of towns
*
* @url GET dictionary/towns
*
@ -717,7 +717,7 @@ class Setup extends DolibarrApi
return $list;
}
/**
* Get the list of shipping methods.
*
@ -788,7 +788,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero)
* @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)"
* @return List of events types
* @return array List of measuring unit
*
* @url GET dictionary/units
*
@ -848,7 +848,7 @@ class Setup extends DolibarrApi
* @param int $page Page number (starting from zero)
* @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)"
* @return List of events types
* @return array List of 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 $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)"
* @return List of events types
* @return array List of 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 $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)"
* @return List of events types
* @return array List of ticket types
*
* @url GET dictionary/ticket_types
*
@ -1026,7 +1026,7 @@ class Setup extends DolibarrApi
* 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.
* @return Result of file and setup integrity check
* @return array Result of file and setup integrity check
*
* @url GET checkintegrity
*
@ -1158,7 +1158,7 @@ class Setup extends DolibarrApi
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// 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
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']);
}
// 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');

View File

@ -55,7 +55,7 @@ function bomAdminPrepareHead()
//$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // 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;
}

View File

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

View File

@ -251,9 +251,6 @@ class ActionComm extends CommonObject
public function __construct(DoliDB $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);
}
//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;
$userdoneid=$this->userdoneid;
@ -678,7 +673,7 @@ class ActionComm extends CommonObject
$this->contactid = $obj->fk_contact; // To have fetch_contact 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->fk_element = $obj->elementid;
@ -889,8 +884,8 @@ class ActionComm extends CommonObject
return -1;
}
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
$contactid=($this->contactid?$this->contactid:0);
$socid=(($this->socid > 0)?$this->socid:0);
$contactid=(($this->contactid > 0)?$this->contactid:0);
$userownerid=($this->userownerid?$this->userownerid: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['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.note']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_note" value="'.$search_note.'"></td>';
if (! empty($arrayfields['a.datep']['checked'])) {
print '<td class="liste_titre nowraponall" align="center">';
print $form->selectDate($datestart, 'datestart', 0, 0, 1, '', 1, 0);

View File

@ -2500,7 +2500,7 @@ $formquestion = array_merge($formquestion, array(
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>';
} 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
@ -2538,7 +2538,14 @@ $formquestion = array_merge($formquestion, array(
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
{
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>';
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>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
}
}

View File

@ -92,7 +92,7 @@ class Proposals extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @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')"
* @return array Array of order objects
*/

View File

@ -168,18 +168,20 @@ $arrayfields=array(
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
// 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
*/
@ -276,19 +278,20 @@ $sql.= ' u.login';
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";
// 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
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql=preg_replace('/, $/', '', $sql);
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $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';
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 ($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';
@ -750,6 +753,8 @@ if ($resql)
$now = dol_now();
$i=0;
$totalarray=array();
$typenArray=null;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
@ -880,8 +885,9 @@ if ($resql)
// Type ent
if (! empty($arrayfields['typent.code']['checked']))
{
if (! is_array($typenArray) || empty($typenArray)) $typenArray = $formcompany->typent_array(1);
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -94,7 +94,7 @@ class Orders extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @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')"
* @return array Array of order objects
*

View File

@ -143,18 +143,21 @@ $arrayfields=array(
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
);
// 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;
while ($i < $num)
{
$paiement = '';
$ref = '';
$refcomp = '';
$totalpayment = '';
$obj = array_shift($tab_sqlobj);
@ -236,7 +236,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = -1*$facturefournstatic->getSommePaiement(); // Payment already done
$totalpayment = -1*$facturefournstatic->getSommePaiement(); // Payment already done
}
}
if ($obj->family == 'invoice')
@ -250,9 +250,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$societestatic->name = $obj->name;
$refcomp=$societestatic->getNomUrl(1, '', 24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
$totalpayment = $facturestatic->getSommePaiement(); // Payment already done
$totalpayment+= $facturestatic->getSumDepositsUsed();
$totalpayment+= $facturestatic->getSumCreditNotesUsed();
}
if ($obj->family == 'social_contribution')
{
@ -261,19 +261,19 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$socialcontribstatic->lib=$obj->type;
$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
if(empty($reshook)){
$ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref;
$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;
if ($paiement) $total_ttc = $obj->total_ttc - $paiement;
if ($totalpayment) $total_ttc = $obj->total_ttc - $totalpayment;
$solde += $total_ttc;
// 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 int $limit Limit for list
* @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 $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

View File

@ -210,12 +210,12 @@ class Facture extends CommonInvoice
* @var double percentage of retainage
*/
public $retained_warranty;
/**
* @var int timestamp of date limit of retainage
*/
public $retained_warranty_date_limit;
/**
* @var int Code in llx_c_paiement
*/
@ -459,7 +459,16 @@ class Facture extends CommonInvoice
}
// 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
$socid = $this->socid;
@ -514,7 +523,7 @@ class Facture extends CommonInvoice
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".$this->cond_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_counter?"'".$this->db->escape($this->situation_counter)."'":"null");
$sql.= ", ".($this->situation_final?$this->situation_final:0);
@ -526,7 +535,7 @@ class Facture extends CommonInvoice
$sql.= ", ".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty));
$sql.= ", ".(!empty($this->retained_warranty_date_limit)?"'".$this->db->idate($this->retained_warranty_date_limit)."'":'NULL');
$sql.= ", ".(int) $this->retained_warranty_fk_cond_reglement;
$sql.=")";
$resql=$this->db->query($sql);
@ -1430,7 +1439,7 @@ class Facture extends CommonInvoice
$this->retained_warranty = $obj->retained_warranty;
$this->retained_warranty_date_limit = $this->db->jdate($obj->retained_warranty_date_limit);
$this->retained_warranty_fk_cond_reglement = $obj->retained_warranty_fk_cond_reglement;
$this->extraparams = (array) json_decode($obj->extraparams, true);
//Incoterms
@ -1679,7 +1688,7 @@ class Facture extends CommonInvoice
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
if (isset($this->retained_warranty)) $this->retained_warranty = floatval($this->retained_warranty);
// Check parameters
// Put here code to add control on parameters values
@ -1695,7 +1704,7 @@ class Facture extends CommonInvoice
$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_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_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").",";
@ -4422,9 +4431,9 @@ class Facture extends CommonInvoice
if(empty($this->retained_warranty) ){
return -1;
}
$retainedWarrantyAmount = 0;
// Billed - retained warranty
if($this->type == Facture::TYPE_SITUATION)
{
@ -4438,18 +4447,18 @@ class Facture extends CommonInvoice
}
}
}
if($displayWarranty && !empty($this->situation_final))
{
$this->fetchPreviousNextSituationInvoice();
$TPreviousIncoice = $this->tab_previous_situation_invoice;
$total2BillWT = 0;
foreach ($TPreviousIncoice as &$fac){
$total2BillWT += $fac->total_ttc;
}
$total2BillWT += $this->total_ttc;
$retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100;
}
else{
@ -4461,10 +4470,10 @@ class Facture extends CommonInvoice
// Because one day retained warranty could be used on standard invoices
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
}
return $retainedWarrantyAmount;
}
/**
* Change the retained warranty
*
@ -4480,7 +4489,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.floatval($value);
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->retained_warranty = floatval($value);
@ -4500,8 +4509,8 @@ class Facture extends CommonInvoice
return -2;
}
}
/**
* Change the retained_warranty_date_limit
*
@ -4514,8 +4523,8 @@ class Facture extends CommonInvoice
if(!$timestamp && $dateYmd){
$timestamp = $this->db->jdate($dateYmd);
}
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')');
if ($this->statut >= 0)
{
@ -4523,7 +4532,7 @@ class Facture extends CommonInvoice
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.(strval($timestamp)!='' ? '\'' .$this->db->idate($timestamp).'\'' : 'null' );
$sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql))
{
$this->retained_warranty_date_limit = $timestamp;
@ -5168,13 +5177,16 @@ class FactureLigne extends CommonInvoiceLine
public function get_prev_progress($invoiceid, $include_credit_note = true)
{
// phpcs:enable
global $invoicecache;
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
return 0;
} else {
// If invoice is not a situation invoice, this->fk_prev_id is used for something else
$tmpinvoice=new Facture($this->db);
$tmpinvoice->fetch($invoiceid);
if ($tmpinvoice->type != Facture::TYPE_SITUATION) return 0;
if (!isset($invoicecache[$invoiceid])) {
$invoicecache[$invoiceid]=new Facture($this->db);
$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;
$resql = $this->db->query($sql);

View File

@ -133,13 +133,16 @@ $arrayfields=array(
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
);
// 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
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');
/*
@ -844,13 +847,13 @@ if ($resql)
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
print '</td>';
}
if(! empty($arrayfields['f.retained_warranty']['checked']))
{
print '<td class="liste_titre" align="right">';
print '</td>';
}
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print '<td class="liste_titre right">';

View File

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

View File

@ -80,12 +80,12 @@ if ($action == 'dolibarr2ldap')
* View
*/
$form = new Form($db);
$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');
$form = new Form($db);
$head = contact_prepare_head($object);
dol_fiche_head($head, 'ldap', $title, -1, 'contact');
@ -172,16 +172,17 @@ if ($result > 0)
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")";
$records = $ldap->getAttribute($dn, $search);
//var_dump($records);
// Affichage arbre
if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
// Show tree
if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
{
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
{
@ -190,7 +191,7 @@ if ($result > 0)
}
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();

View File

@ -95,7 +95,7 @@ class Contracts extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @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')"
* @return array Array of contract objects
*

View File

@ -130,13 +130,16 @@ $arrayfields=array(
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
// 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)
);
// 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

@ -57,12 +57,12 @@ class box_activity extends ModeleBoxes
{
global $conf, $user;
$this->db=$db;
$this->db = $db;
// FIXME: Pb into some status
$this->enabled=($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
$this->hidden= ! ((! empty($conf->facture->enabled) && $user->rights->facture->lire)
$this->hidden = ! ((! empty($conf->facture->enabled) && $user->rights->facture->lire)
|| (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|| (! empty($conf->propal->enabled) && $user->rights->propale->lire)
);

View File

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

View File

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

View File

@ -54,9 +54,9 @@ class box_bookmarks extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->bookmark->lire);
$this->hidden = ! ($user->rights->bookmark->lire);
}
/**

View File

@ -58,9 +58,9 @@ class box_commandes extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->commande->lire);
$this->hidden = ! ($user->rights->commande->lire);
}
/**

View File

@ -60,9 +60,9 @@ class box_contacts extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
$this->hidden = ! ($user->rights->societe->lire && $user->rights->societe->contact->lire);
}
/**

View File

@ -57,9 +57,9 @@ class box_contracts extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->contrat->lire);
$this->hidden = ! ($user->rights->contrat->lire);
}
/**

View File

@ -56,9 +56,9 @@ class box_factures extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->facture->lire);
$this->hidden = ! ($user->rights->facture->lire);
}
/**

View File

@ -57,9 +57,9 @@ class box_factures_fourn extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->fournisseur->facture->lire);
$this->hidden = ! ($user->rights->fournisseur->facture->lire);
}
/**

View File

@ -56,9 +56,9 @@ class box_factures_fourn_imp extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->fournisseur->facture->lire);
$this->hidden = ! ($user->rights->fournisseur->facture->lire);
}
/**

View File

@ -59,9 +59,9 @@ class box_factures_imp extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->facture->lire);
$this->hidden = ! ($user->rights->facture->lire);
}
/**

View File

@ -57,9 +57,9 @@ class box_ficheinter extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->ficheinter->lire);
$this->hidden = ! ($user->rights->ficheinter->lire);
}
/**

View File

@ -57,9 +57,9 @@ class box_fournisseurs extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
}
/**

View File

@ -52,9 +52,9 @@ class box_graph_propales_permonth extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->propale->lire);
$this->hidden = ! ($user->rights->propale->lire);
}
/**

View File

@ -65,7 +65,7 @@ class box_members extends ModeleBoxes
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
if (! in_array('adherent', $listofmodulesforexternal) && ! empty($user->societe_id)) $this->enabled=0; // disabled for external users
$this->hidden=! ($user->rights->adherent->lire);
$this->hidden = ! ($user->rights->adherent->lire);
}
/**

View File

@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry=array('enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), 'module'=>'product|service');
$showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden=($showmode != 1);
$this->hidden = ($showmode != 1);
}
/**

View File

@ -66,7 +66,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
$tmpentry=array('enabled'=>((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ! empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock');
$showmode=isVisibleToUserType(($user->societe_id > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal);
$this->hidden=($showmode != 1);
$this->hidden = ($showmode != 1);
}
/**

View File

@ -59,9 +59,9 @@ class box_project extends ModeleBoxes
$langs->loadLangs(array('boxes', 'projects'));
$this->db = $db;
$this->boxlabel="OpenedProjects";
$this->boxlabel = "OpenedProjects";
$this->hidden=! ($user->rights->projet->lire);
$this->hidden = ! ($user->rights->projet->lire);
}
/**

View File

@ -58,9 +58,9 @@ class box_propales extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->propale->lire);
$this->hidden = ! ($user->rights->propale->lire);
}
/**

View File

@ -65,7 +65,7 @@ class box_prospect extends ModeleBoxes
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
$this->hidden=! ($user->rights->societe->lire && empty($user->socid));
$this->hidden = ! ($user->rights->societe->lire && empty($user->socid));
}
/**

View File

@ -58,9 +58,9 @@ class box_services_contracts extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->service->lire && $user->rights->contrat->lire);
$this->hidden = ! ($user->rights->service->lire && $user->rights->contrat->lire);
}
/**

View File

@ -56,9 +56,9 @@ class box_services_expired extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->contrat->lire);
$this->hidden = ! ($user->rights->contrat->lire);
}
/**

View File

@ -56,9 +56,9 @@ class box_supplier_orders extends ModeleBoxes
{
global $user;
$this->db=$db;
$this->db = $db;
$this->hidden=! ($user->rights->fournisseur->commande->lire);
$this->hidden = ! ($user->rights->fournisseur->commande->lire);
}
/**

View File

@ -54,7 +54,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
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;

View File

@ -497,8 +497,16 @@ abstract class CommonDocGenerator
$resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);
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);
} else {
$resarray['object_total_discount']='';
$resarray['object_total_discount_locale']='';
}
}
@ -766,10 +774,20 @@ abstract class CommonDocGenerator
//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']));
}
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]];
}
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')
{
if (strlen($object->array_options['options_'.$key])>0)

View File

@ -177,6 +177,7 @@ class Conf
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 (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_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
if (isset($this->product)) $this->produit=$this->product;
if (isset($this->facture)) $this->invoice=$this->facture;

View File

@ -1903,6 +1903,15 @@ class Form
$price_level = (! empty($price_level) ? $price_level : 0);
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))
{
$placeholder='';

View File

@ -1381,7 +1381,7 @@ class FormFile
if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $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>";

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 $selected Selected value
* @param int $useempty 1=Add an empty value in list
* @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 = '')
{

View File

@ -944,7 +944,7 @@ class Ldap
// Only one entry should ever be returned
$entry = ldap_first_entry($this->connection, $search);
if (!$entry)
if (! $entry)
{
$this->ldapErrorCode = -1;
$this->ldapErrorText = "Couldn't find entry";
@ -952,7 +952,7 @@ class Ldap
}
// 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->ldapErrorText = ldap_error($this->connection);

View File

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

View File

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

View File

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

View File

@ -419,7 +419,11 @@ class DoliDBMssql extends DoliDB
}
//print "<!--".$query."-->";
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK')))
{
$SYSLOG_SQL_LIMIT = 10000; // limit log to 10kb per line to limit DOS attacks
dol_syslog('sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
}
if (! $this->database_name)
{

View File

@ -522,7 +522,11 @@ class DoliDBPgsql extends DoliDB
@pg_query($this->db, 'SAVEPOINT mysavepoint');
}
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK')))
{
$SYSLOG_SQL_LIMIT = 10000; // limit log to 10kb per line to limit DOS attacks
dol_syslog('sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
}
$ret = @pg_query($this->db, $query);
@ -603,7 +607,7 @@ class DoliDBPgsql extends DoliDB
/**
* 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
* @see affected_rows()
*/

View File

@ -453,7 +453,11 @@ class DoliDBSqlite3 extends DoliDB
}
//print "After convertSQLFromMysql:\n".$query."<br>\n";
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK')))
{
$SYSLOG_SQL_LIMIT = 10000; // limit log to 10kb per line to limit DOS attacks
dol_syslog('sql='.substr($query, 0, $SYSLOG_SQL_LIMIT), LOG_DEBUG);
}
if (empty($query)) return false; // Return false = error if empty request
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)

View File

@ -816,8 +816,10 @@ function dol_size($size, $type = '')
*/
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
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°');
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
// 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);
}
@ -942,11 +944,15 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
* @param string $stringtoescape String to escape
* @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 string $keepmoretags '' or 'common' or list of tags
* @return string Escaped string
* @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.
$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>'=>''));
@ -3861,6 +3867,8 @@ function dol_print_error($db = '', $error = '', $errors = null)
if (empty($dolibarr_main_prod)) print $out;
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("YouCanSetOptionDolibarrMainProdToZero");
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
* 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 function also remove last EOL or BR if $removelasteolbr=1 (default).
* 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
{
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>';
}

View File

@ -271,7 +271,7 @@ $list = array (
*/
function oauthadmin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf;
$h = 0;
$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 string $filterprogresscalc filter text
* @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)
{
@ -448,7 +448,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
$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->ref=$lines[$i]->ref;
@ -572,7 +572,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
{
// Time not billed
print '<td class="right">';
if ($lines[$i]->bill_time)
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->tobill, 'allhourmin');
$total_projectlinesa_tobill += $lines[$i]->tobill;
@ -585,7 +585,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Time billed
print '<td class="right">';
if ($lines[$i]->bill_time)
if ($lines[$i]->usage_bill_time)
{
print convertSecondToTime($lines[$i]->billed, 'allhourmin');
$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_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.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';
$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 "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print yn($lines[$i]->usage_bill_time);
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_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.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';
$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 "</td>\n";
}
if (! empty($arrayfields['p.bill_time']['checked']))
if (! empty($arrayfields['p.usage_bill_time']['checked']))
{
print '<td class="nowrap">';
print yn($lines[$i]->bill_time);
print yn($lines[$i]->usage_bill_time);
print "</td>\n";
}

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 $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 int $max Max number of answers
* @return string HTML content
@ -674,20 +675,21 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
}
$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.= " WHERE fk_website = ".$website->id;
if ($type) $sql.= " AND type_container = '".$db->escape($type)."'";
$sql.= " AND (";
$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 ':'')."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)."%'";
}
@ -706,16 +708,10 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
$tmpwebsitepage = new WebsitePage($db);
$tmpwebsitepage->fetch($obj->rowid);
if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage;
$found++;
}
$i++;
}
$arrayresult['code']='OK';
if (empty($arrayresult['list']))
{
$arrayresult['code']='KO';
$arrayresult['message']=$weblangs->trans("NoRecordFound");
}
}
else
{
@ -727,11 +723,63 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
$searchdone = 1;
}
if (! $searchdone)
if (! $error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
{
$error++;
$arrayresult['code']='KO';
$arrayresult['message']='No supported algorithm found';
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++;
$arrayresult['code']='KO';
$arrayresult['message']='No supported algorithm found';
}
}
return $arrayresult;

View File

@ -66,6 +66,7 @@ class mailing_thirdparties extends MailingTargets
$cibles = array();
$addDescription= "";
// Select the third parties from category
if (empty($_POST['filter']))
{
@ -77,6 +78,50 @@ class mailing_thirdparties extends MailingTargets
}
else
{
$addFilter ="";
if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1')
{
$addFilter.= " AND s.client=" . $_POST["filter_client"];
$addDescription= $langs->trans('ProspectCustomer')."=";
if ($_POST["filter_client"] == 0)
{
$addDescription.= $langs->trans('NorProspectNorCustomer');
}
elseif ($_POST["filter_client"] == 1)
{
$addDescription.= $langs->trans('Customer');
}
elseif ($_POST["filter_client"] == 2)
{
$addDescription.= $langs->trans('Prospect');
}
elseif ($_POST["filter_client"] == 3)
{
$addDescription.= $langs->trans('ProspectCustomer');
}
else
{
$addDescription.= "Unknown status ".$_POST["filter_client"];
}
}
if (isset($_POST["filter_status"]))
{
if (strlen($addDescription) > 0)
{
$addDescription.= ";";
}
$addDescription.= $langs->trans("Status")."=";
if ($_POST["filter_status"] == '1')
{
$addFilter.= " AND s.status=1";
$addDescription.= $langs->trans("Enabled");
}
else
{
$addFilter.= " AND s.status=0";
$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 <> ''";
@ -85,6 +130,7 @@ class mailing_thirdparties extends MailingTargets
$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";
@ -94,51 +140,7 @@ class mailing_thirdparties extends MailingTargets
$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')
{
$sql.= " AND s.client=" . $_POST["filter_client"];
$addDescription= $langs->trans('ProspectCustomer')."=";
if ($_POST["filter_client"] == 0)
{
$addDescription.= $langs->trans('NorProspectNorCustomer');
}
elseif ($_POST["filter_client"] == 1)
{
$addDescription.= $langs->trans('Customer');
}
elseif ($_POST["filter_client"] == 2)
{
$addDescription.= $langs->trans('Prospect');
}
elseif ($_POST["filter_client"] == 3)
{
$addDescription.= $langs->trans('ProspectCustomer');
}
else
{
$addDescription.= "Unknown status ".$_POST["filter_client"];
}
}
if (isset($_POST["filter_status"]))
{
if (strlen($addDescription) > 0)
{
$addDescription.= ";";
}
$addDescription.= $langs->trans("Status")."=";
if ($_POST["filter_status"] == '1')
{
$sql.= " AND s.status=1";
$addDescription.= $langs->trans("Enabled");
}
else
{
$sql.= " AND s.status=0";
$addDescription.= $langs->trans("Disabled");
}
$sql.= $addFilter;
}
$sql.= " ORDER BY email";

View File

@ -186,7 +186,13 @@ class modExpenseReport extends DolibarrModules
'u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate',
'ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref'
);
$this->export_entities_array[$r]=array(
$this->export_TypeFields_array[$r]=array(
'd.rowid'=>"Numeric",'d.ref'=>'Text','d.date_debut'=>'Date','d.date_fin'=>'Date','d.date_create'=>'Date','d.date_approve'=>'Date',
'd.total_ht'=>"Numeric",'d.total_tva'=>'Numeric','d.total_ttc'=>'Numeric','d.note_private'=>'Text','d.note_public'=>'Text',
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'ed.rowid'=>'Numeric','tf.code'=>'Code','ed.date'=>'Date','ed.tva_tx'=>'Numeric',
'ed.total_ht'=>'Numeric','ed.total_tva'=>'Numeric','ed.total_ttc'=>'Numeric','ed.comments'=>'Text','p.rowid'=>'Numeric','p.ref'=>'Text'
);
$this->export_entities_array[$r]=array(
'u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line',
'ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line',
'ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project'

View File

@ -111,6 +111,13 @@ class modFournisseur extends DolibarrModules
$this->const[$r][4] = 0;
$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
$this->boxes = array(
0=>array('file'=>'box_graph_invoices_supplier_permonth.php','enabledbydefaulton'=>'Home'),
@ -629,6 +636,24 @@ class modFournisseur extends DolibarrModules
$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(
"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.")",

View File

@ -206,6 +206,12 @@ class modHoliday extends DolibarrModules
'd.date_valid'=>'DateApprove','d.fk_validator'=>"UserForApprovalID",'ua.lastname'=>"UserForApprovalLastname",'ua.firstname'=>"UserForApprovalFirstname",
'ua.login'=>"UserForApprovalLogin",'d.description'=>'Description','d.statut'=>'Status'
);
$this->export_TypeFields_array[$r]=array(
'd.rowid'=>"Numeric",'t.code'=>'Text', 't.label'=>'Text','d.fk_user'=>'Numeric',
'u.lastname'=>'Text','u.firstname'=>'Text','u.login'=>"Text",'d.date_debut'=>'Date','d.date_fin'=>'Date',
'd.date_valid'=>'Date','d.fk_validator'=>"Numeric",'ua.lastname'=>"Text",'ua.firstname'=>"Text",
'ua.login'=>"Text",'d.description'=>'Text','d.statut'=>'Numeric'
);
$this->export_entities_array[$r]=array(
'u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ua.lastname'=>'user','ua.firstname'=>'user','ua.login'=>'user'
);

View File

@ -34,13 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'
*/
class mod_codeclient_elephant extends ModeleThirdPartyCode
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Elephant';
/**
* @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
*/
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Leopard';
/**
* @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
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Monkey';
/**
* @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
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Aquarium';
/**
* @var string model name
*/
@ -49,9 +42,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $prefixcustomeraccountancycode;
public $prefixcustomeraccountancycode;
public $prefixsupplieraccountancycode;
public $prefixsupplieraccountancycode;
public $position = 20;
/**
@ -93,11 +88,11 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
$texte.=$langs->trans("ModuleCompanyCodeCustomer".$this->name, $s2)."<br>\n";
$texte.=$langs->trans("ModuleCompanyCodeSupplier".$this->name, $s1)."<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_CLEAN_REGEX)) $texte.=$langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
$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.= '</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
{
/**
* @var string Nom du modele
* @deprecated
* @see name
*/
public $nom='Panicum';
/**
* @var string model name
*/
@ -48,6 +41,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
public $position = 10;
/**
* Constructor

View File

@ -83,18 +83,18 @@ abstract class ModeleThirdPartyCode
return $langs->trans("NoDescription");
}
/** Renvoi nom module
/** Return name of module
*
* @param Translate $langs Object langs
* @return string Nom du module
*/
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
* @return string Example
@ -261,8 +261,7 @@ abstract class ModeleThirdPartyCode
/**
* \class ModeleAccountancyCode
* \brief Parent class for third parties accountancy code generators
* Parent class for third parties accountancy code generators
*/
abstract class ModeleAccountancyCode
{
@ -340,7 +339,7 @@ abstract class ModeleAccountancyCode
$langs->load("admin");
$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>';
//$s.='<br>';
//$s.='<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

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