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

This commit is contained in:
florian HENRY 2019-09-02 09:48:08 +02:00
commit cab4b2db5b
808 changed files with 15514 additions and 7584 deletions

5
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,5 @@
# These are supported funding model platforms
open_collective: dolibarr
custom: https://wiki.dolibarr.org/index.php/Subscribe
# github: [eldy]

View File

@ -1,8 +1,16 @@
---
name: Bug report
about: Create a report to help us fix something that is broken
title: ''
labels: Bug
assignees: ''
---
# Instructions
*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*
*Please:*
- *only keep the "Bug" or "Feature Request" section*
- *replace the bracket enclosed texts with meaningful informations*
- *replace the bracket enclosed texts with meaningful information*
- *remove any unused sub-section*
@ -25,17 +33,3 @@
## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)
[*Files*]
# Feature Request
[*Short description*]
## Use case
[*Verbose description*]
## Suggested implementation
[*Verbose description*]
## Suggested steps
[*List of tasks to achieve goal*]

View File

@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest a new idea for this project
title: ''
labels: Feature request
assignees: ''
---
# Instructions
*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*
*Please:*
- *replace the bracket enclosed texts with meaningful information*
- *remove any unused sub-section*
# Feature Request
[*Short description*]
## Use case
[*Verbose description*]
## Suggested implementation
[*Verbose description*]
## Suggested steps
[*List of tasks to achieve goal*]

View File

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

10
.stickler.yml Normal file
View File

@ -0,0 +1,10 @@
---
linters:
phpcs:
standard: 'dev/setup/codesniffer/ruleset.xml'
extensions: 'php'
tab_width: 4
fixer: true
fixers:
enable: true

View File

@ -288,17 +288,17 @@ script:
# Ensure we catch errors
set -e
#parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e
echo
- |
echo "Checking coding style"
echo "Checking coding style (excluding Pull Requests builds)"
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
set +e
echo

View File

@ -37,7 +37,7 @@ TCPDF 6.2.25 LGPL-3+ Yes
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
jQuery 3.3.1 MIT License Yes JS library
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)

View File

@ -16,6 +16,10 @@ Following changes may create regressions for some external modules, but were nec
* Properties ->libelle_incoterms were renamed into ->label_incoterms
* Removed the method liste_array() of project class. It was not used by core code.
* 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.
***** ChangeLog for 10.0.1 compared to 10.0.0 *****

View File

@ -1,7 +1,6 @@
# DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|7|8|9|10|develop|
|----------|----------|----------|----------|----------|
@ -138,7 +137,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Multi-company by adding of an external module.
- Very user friendly and easy to use.
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- Works with PHP 5.3+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
- APIs.
- An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture)

View File

@ -3,8 +3,7 @@ README (English)
Building packages
##################################################
All sub-directories of "build" directory contains files required to build
automatically Dolibarr packages.
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
There are several tools:

View File

@ -0,0 +1,4 @@
Test to migrate Dolibarr to namespace "Dolibarr".
Script bbb.php is a script of an external module with current code writing.
It must works after migration.

View File

@ -0,0 +1,23 @@
<?php
namespace Dolibarr;
global $globalaaa;
$globalaaa = 'globalaaa';
function faaa()
{
return 'faaa';
}
class Aaa
{
const AAA='aaa';
public function do()
{
echo 'doaaa'."\n";
}
}

View File

@ -0,0 +1,25 @@
<?php
global $globalbbb;
$globalbbb = 'globalbbb';
function fbbb()
{
return 'fbbb';
}
class Bbb
{
const BBB='bbb';
public function do()
{
global $globalaaa, $globalbbb;
echo 'dobbb'."\n";
$globalaaa.='+bbb';
$globalbbb.='+bbb';
}
}

31
dev/namespacemig/bbb.php Executable file
View File

@ -0,0 +1,31 @@
<?php
//use \Aaa as Aaa;
use Dolibarr\Aaa as Aaa;
use function Dolibarr\faaa as faaa; // Need php 5.6+
//use const Dolibarr\AAA;
//use Bbb as Bbb;
require './main.inc.php';
require './aaa.class.php';
require './bbb.class.php';
$bbb = new Bbb();
$bbb->do();
$aaa = new Aaa();
$aaa->do();
echo $aaa::AAA."\n";
echo $bbb::BBB."\n";
echo Aaa::AAA."\n";
echo Bbb::BBB."\n";
echo faaa()."\n";
echo fbbb()."\n";
echo "globalaaa=$globalaaa\n";
echo "globalbbb=$globalbbb\n";

View File

@ -0,0 +1,7 @@
<?php
/*spl_autoload_register(function ($class_name) {
var_dump('class='.$class_name);
require $class_name;
});
*/

View File

@ -5,6 +5,7 @@
<exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern>
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
<exclude-pattern type="relative">documents</exclude-pattern>
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 98 KiB

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

@ -121,10 +121,12 @@ class AdherentType extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
$sql.= "libelle";
$sql.= " morphy";
$sql.= ", libelle";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= "'".$this->db->escape($this->label)."'";
$sql.= "'".$this->db->escape($this->morphy)."'";
$sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", ".$conf->entity;
$sql.= ")";

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

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

@ -35,7 +35,10 @@ if (!$user->admin)
$action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters=array(
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
@ -68,7 +71,6 @@ $head=dav_admin_prepare_head();
dol_fiche_head($head, 'webdav', '', -1, 'action');
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -76,14 +78,17 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
if (isset($val['enabled']) && empty($val['enabled'])) continue;
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
$label = $langs->trans($key);
if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP");
print $form->textwithpicto($label, $tooltiphelp);
print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
@ -112,12 +117,13 @@ if ($action == 'edit')
else
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach($arrayofparameters as $key => $val)
{
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{
@ -177,6 +183,13 @@ if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
}
print $message;
print '<br><br><br>';
require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php';
$version = Sabre\DAV\Version::VERSION;
print '<span class="opacitymedium">'.$langs->trans("BaseOnSabeDavVersion").' : '.$version.'</span>';
// End of page
llxFooter();
$db->close();

View File

@ -262,7 +262,7 @@ else
print '<br>';
// Show logo for weather
print $langs->trans("DescWeather").'<br>';
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
if($action == 'edit') {
@ -319,7 +319,7 @@ if ($action == 'edit') {
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options);
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '&lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>';

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

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.org>
/* Copyright (C) 2009-2019 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -36,9 +36,11 @@ $langs->loadLangs(array("admin","errors"));
$action = GETPOST('action', 'aZ09');
/*
* Actions
*/
if ($action == 'set')
{
$error=0;
@ -53,8 +55,11 @@ if ($action == 'set')
if (! $error)
{
$res = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
if (! $res1 > 0) $error++;
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
if (! $res2 > 0) $error++;
if (! $error)
{
@ -67,6 +72,8 @@ if ($action == 'set')
}
}
if (! isset($conf->global->GEOIP_VERSION)) $conf->global->GEOIP_VERSION = '2';
/*
* View
@ -85,13 +92,6 @@ $geoip='';
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
{
$geoip=new DolGeoIP('country', $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
//if ($geoip->error) print dol_htmloutput_errors($geoip->errorlabel,'',1);
if ($geoip->gi == 'NOGI') $geointernal=true;
else $geointernal=false;
}
else
{
if (function_exists('geoip_country_code_by_name')) $geointernal=true;
}
// Mode
@ -105,16 +105,30 @@ print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
// Lib version
print '<tr class="oddeven"><td width="50%">'.$langs->trans("GeoIPLibVersion").'</td>';
print '<td colspan="2">';
$arrayofvalues = array('php' => 'Native PHP functions', '1' => 'Embedded GeoIP v1', '2' => 'Embedded GeoIP v2');
print $form->selectarray('geoipversion', $arrayofvalues, (isset($conf->global->GEOIP_VERSION) ? $conf->global->GEOIP_VERSION : '2'));
if ($conf->global->GEOIP_VERSION == 'php')
{
if ($geoip) $version=$geoip->getVersion();
if ($version)
{
print '<br>'.$langs->trans("Version").': '.$version;
}
}
print '</td></tr>';
// Path to database file
print '<tr class="oddeven"><td>'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
print '<td colspan="2">';
if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'<br>';
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
if ($geoip) $version=$geoip->getVersion();
if ($version)
if ($conf->global->GEOIP_VERSION == 'php')
{
print '<br>'.$langs->trans("Version").': '.$version;
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
}
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
print '</td></tr>';
print '</table>';
@ -144,6 +158,13 @@ if ($geoip)
if ($result) print $result;
else print $langs->trans("Error");
$ip='2a01:e0a:7e:4a60:429a:23ff:f7b8:dc8a'; // should be France
print '<br>'.$ip.' -> ';
$result=dol_print_ip($ip, 1);
if ($result) print $result;
else print $langs->trans("Error");
/* We disable this test because dol_print_ip need an ip as input
$ip='www.google.com';
print '<br>'.$ip.' -> ';

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

@ -130,13 +130,13 @@ if ($action=='install')
}
else
{
if (! preg_match('/\.zip$/i', $original_file))
if (! $error && ! preg_match('/\.zip$/i', $original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
$error++;
}
if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i', $original_file))
if (! $error && ! preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
@ -180,13 +180,13 @@ if ($action=='install')
{
// Now we move the dir of the module
$modulename=preg_replace('/module_/', '', $original_file);
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
$modulename=preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
// Search dir $modulename
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
@ -195,10 +195,16 @@ if ($action=='install')
}
}
if (! $error)
{
// TODO Make more test
}
// Now we install the module
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulename);
@dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file
dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
@ -653,8 +659,8 @@ if ($mode == 'common')
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
if (! empty($objMod->picto))
{
if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, ' width="14px"', 1);
else print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"');
if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1);
else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"');
}
else
{

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

@ -522,9 +522,9 @@ if ($resql)
$nb=$obj->nb;
if ($nb > $limitforoptim)
{
if (empty($conf->global->THIRDPARTY_DONOTSEARCH_ANYWHERE))
if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE))
{
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'THIRDPARTY_DONOTSEARCH_ANYWHERE');
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE');
}
else
{

View File

@ -50,14 +50,23 @@ if (! $user->admin)
if ($action == 'delete')
{
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
$action='';
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
{
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
else
{
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
$ret=dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
$action='';
}
/*
* View
*/

View File

@ -118,14 +118,14 @@ function create_script_table($list)
{
global $sortby,$langs;
if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
$order = GETPOST('order');
if (GETPOT('order', 'alpha') == "asc" || GETPOST('order', 'alpha') == "desc") {
$order = GETPOST('order', 'alpha');
} else {
$order = "asc";
}
if (GETPOST('order')) {
switch (GETPOST('order')) {
if (GETPOST('order', 'alpha')) {
switch (GETPOST('order', 'alpha')) {
case "mtime":
case "size":
case "reloads":

View File

@ -618,14 +618,14 @@ if ($id)
// Active
print '<td align="center" class="nowrap">';
print '<a href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
print "</td>";
// Modify link
print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
// Delete link
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete">'.img_delete().'</a></td>';
else print '<td align="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
print "</tr>\n";

View File

@ -80,7 +80,7 @@ if ($action == 'setproductionmode')
if ($action == 'save')
{
dolibarr_set_const($db, 'API_RESTICT_ON_IP', GETPOST('API_RESTICT_ON_IP', 'alpha'));
dolibarr_set_const($db, 'API_RESTRICT_ON_IP', GETPOST('API_RESTRICT_ON_IP', 'alpha'));
}
@ -130,8 +130,8 @@ print '<td>&nbsp;</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("RestrictApiToIps").'</td>';
print '<td><input type="text" name="API_RESTICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTICT_ON_IP).'"></td>';
print '<td>'.$langs->trans("RESTRICT_API_ON_IP").'</td>';
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTRICT_ON_IP).'"></td>';
print '<td>';
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
print '</td>';

View File

@ -32,7 +32,7 @@ class DolibarrApi
/**
* @var DoliDb $db Database object
*/
static protected $db;
protected static $db;
/**
* @var Restler $r Restler object

View File

@ -56,7 +56,7 @@ class Documents extends DolibarrApi
* Note that, this API is similar to using the wrapper link "documents.php" to download a file (used for
* internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead).
*
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
* @param string $modulepart Name of module or area concerned by file download ('facture', ...)
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
* @return array List of documents
*
@ -67,11 +67,11 @@ class Documents extends DolibarrApi
*
* @url GET /download
*/
public function index($module_part, $original_file = '')
public function index($modulepart, $original_file = '')
{
global $conf, $langs;
if (empty($module_part)) {
if (empty($modulepart)) {
throw new RestException(400, 'bad value for parameter modulepart');
}
if (empty($original_file)) {
@ -81,7 +81,7 @@ class Documents extends DolibarrApi
//--- Finds and returns the document
$entity=$conf->entity;
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
@ -98,6 +98,7 @@ class Documents extends DolibarrApi
if (! file_exists($original_file_osencoded))
{
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
throw new RestException(404, 'File not found');
}
@ -111,7 +112,7 @@ class Documents extends DolibarrApi
*
* Test sample 1: { "module_part": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.
*
* @param string $module_part Name of module or area concerned by file download ('invoice', 'order', ...).
* @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...).
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
* @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template).
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
@ -126,11 +127,11 @@ class Documents extends DolibarrApi
*
* @url PUT /builddoc
*/
public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
public function builddoc($modulepart, $original_file = '', $doctemplate = '', $langcode = '')
{
global $conf, $langs;
if (empty($module_part)) {
if (empty($modulepart)) {
throw new RestException(400, 'bad value for parameter modulepart');
}
if (empty($original_file)) {
@ -147,7 +148,7 @@ class Documents extends DolibarrApi
//--- Finds and returns the document
$entity=$conf->entity;
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
@ -166,7 +167,7 @@ class Documents extends DolibarrApi
$templateused='';
if ($module_part == 'facture' || $module_part == 'invoice')
if ($modulepart == 'facture' || $modulepart == 'invoice')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
@ -181,7 +182,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error generating document');
}
}
elseif ($module_part == 'commande' || $module_part == 'order')
elseif ($modulepart == 'commande' || $modulepart == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$this->order = new Commande($this->db);
@ -195,7 +196,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Error generating document');
}
}
elseif ($module_part == 'propal' || $module_part == 'proposal')
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$this->propal = new Propal($this->db);

View File

@ -57,12 +57,13 @@ class Login
*/
public function index($login, $password, $entity = '', $reset = 0)
{
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
// Authentication mode
if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication = 'http,dolibarr';
// TODO Remove the API login. The token must be generated from backoffice only.
// Authentication mode
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'dolibarr';
// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser')
{
@ -73,6 +74,7 @@ class Login
throw new RestException(403, "Your instance is set to use the automatic login '".$dolibarr_auto_user."' that is not the requested login. API usage is forbidden in this mode.");
}
}
// Set authmode
$authmode = explode(',', $dolibarr_main_authentication);
@ -83,7 +85,7 @@ class Login
if ($entity == '') $entity=1;
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
$login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api');
if (empty($login))
{
throw new RestException(403, 'Access denied');

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

@ -24,6 +24,8 @@
* \file htdocs/api/index.php
*/
use Luracast\Restler\Format\UploadFormat;
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
@ -117,6 +119,21 @@ $api->r->addAuthenticationClass('DolibarrApiAccess', '');
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
// Restrict API to some IPs
if (! empty($conf->global->API_RESTRICT_ON_IP))
{
$allowedip=explode(' ', $conf->global->API_RESTRICT_ON_IP);
$ipremote = getUserRemoteIP();
if (! in_array($ipremote, $allowedip))
{
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
print 'APIs are not allowed from the IP '.$ipremote;
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
//print $conf->global->API_RESTRICT_ON_IP;
exit(0);
}
}
// Call Explorer file for all APIs definitions (this part is slow)
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
@ -136,6 +153,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
{
while (($file = readdir($handle))!==false)
{
$regmod=array();
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod))
{
$module = strtolower($regmod[1]);
@ -165,6 +183,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
{
if ($file_searched == 'api_access.class.php') continue;
$regapi = array();
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi))
{
$classname = ucwords($regapi[1]);
@ -204,23 +223,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
}
// Call one APIs or one definition of an API
$regbis = array();
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
{
// Restrict API to some IPs
if (! empty($conf->global->API_RESTICT_ON_IP))
{
$allowedip=explode(' ', $conf->global->API_RESTICT_ON_IP);
$ipremote = getUserRemoteIP();
if (! in_array($ipremote, $allowedip))
{
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTICT_ON_IP);
print 'API not allowed from the IP '.$ipremote;
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
//print $conf->global->API_RESTICT_ON_IP;
exit(0);
}
}
$module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service
{
@ -268,7 +273,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$api->r->addAPIClass($classname);
}
// TODO If not found, redirect to explorer
//var_dump($api->r->apiVersionMap);
//exit;

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

@ -338,7 +338,7 @@ if ($object->fetch($id) >= 0)
print '<div class="tagtd">';
if (empty($obj->picto)) $obj->picto='generic';
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto);
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule"');
print ' ';
print $obj->getDesc();
print '</div>';
@ -402,7 +402,8 @@ if ($object->fetch($id) >= 0)
}
// List of selected targets
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.fk_mailing=".$object->id;
if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
@ -475,15 +476,15 @@ if ($object->fetch($id) >= 0)
print '<tr class="liste_titre_filter">';
// EMail
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
print '</td>';
// Name
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
print '</td>';
// Firstname
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
print '<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
print '</td>';
// Other
print '<td class="liste_titre">';
@ -494,10 +495,16 @@ if ($object->fetch($id) >= 0)
print '&nbsp';
print '</td>';
// Date last update
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
//Statut
print '<td class="liste_titre right">';
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
@ -515,14 +522,10 @@ if ($object->fetch($id) >= 0)
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", 'align="center"', $sortfield, $sortorder);
// Date last update
print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "mc.tms", $param, "", 'align="center"', $sortfield, $sortorder);
// Date sending
if ($object->statut < 2) {
print_liste_field_titre('');
}
else
{
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
}
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print '</tr>';
@ -583,16 +586,25 @@ if ($object->fetch($id) >= 0)
}
print '</td>';
// Date last update
print '<td class="center">';
print dol_print_date($obj->tms, 'dayhour');
print '</td>';
// Status of recipient sending email (Warning != status of emailing)
if ($obj->statut == 0)
{
// Date sent
print '<td align="center">&nbsp;</td>';
print '<td class="nowrap right">'.$langs->trans("MailingStatusNotSent");
print '</td>';
}
else
{
// Date sent
print '<td align="center">'.$obj->date_envoi.'</td>';
print '<td class="nowrap right">';
print $object::libStatutDest($obj->statut, 2, $obj->error_text);
print '</td>';
@ -620,7 +632,7 @@ if ($object->fetch($id) >= 0)
{
if ($object->statut < 2)
{
print '<tr><td colspan="8" class="opacitymedium">';
print '<tr><td colspan="9" class="opacitymedium">';
print $langs->trans("NoTargetYet");
print '</td></tr>';
}

View File

@ -2248,7 +2248,8 @@ $formquestion = array_merge($formquestion, array(
print '<tr><td>';
print $langs->trans('OutstandingBill');
print '</td><td class="right">';
print price($soc->get_OutstandingBill()) . ' / ';
$arrayoutstandingbills = $soc->getOutstandingBills();
print price($arrayoutstandingbills['opened']) . ' / ';
print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency);
print '</td>';
print '</tr>';

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

@ -240,6 +240,7 @@ if (empty($reshook))
{
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
$selectedLines = GETPOST('toselect', 'array');
if ($datecommande == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
@ -346,6 +347,8 @@ if (empty($reshook))
for($i = 0; $i < $num; $i ++)
{
if(!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : '');
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
@ -1758,6 +1761,15 @@ if ($action == 'create' && $usercancreate)
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint;
if (empty($reshook)) {
if (! empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) {
// copy from thirdparty
$tpExtrafields = new Extrafields($db);
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);
if ($soc->fetch_optionals() > 0) {
$object->array_options = array_merge($object->array_options, $soc->array_options);
}
};
print $object->showOptionals($extrafields, 'edit');
}
@ -1872,8 +1884,6 @@ if ($action == 'create' && $usercancreate)
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
print '</div>';
print '</form>';
// Show origin lines
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
$title = $langs->trans('ProductsAndServices');
@ -1881,10 +1891,12 @@ if ($action == 'create' && $usercancreate)
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList();
$objectsrc->printOriginLinesList('', $selectedLines);
print '</table>';
}
print '</form>';
} else {
// Mode view
$now = dol_now();
@ -2126,7 +2138,8 @@ if ($action == 'create' && $usercancreate)
print '<tr><td class="titlefield">';
print $langs->trans('OutstandingBill');
print '</td><td>';
print price($soc->get_OutstandingBill()) . ' / ';
$arrayoutstandingbills = $soc->getOutstandingBills();
print price($arrayoutstandingbills['opened']) . ' / ';
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>';
print '</tr>';

View File

@ -365,7 +365,7 @@ class Commande extends CommonOrder
// Validate
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql.= " SET ref = '".$num."',";
$sql.= " SET ref = '".$this->db->escape($num)."',";
$sql.= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql.= " date_valid='".$this->db->idate($now)."',";
$sql.= " fk_user_valid = ".$user->id;

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

@ -312,7 +312,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if(empty($reshook)){
print $hookmanager->resPrint;
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
$solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde;
}
// solde

View File

@ -544,16 +544,16 @@ if ($id)
{
if (! empty($user->rights->banque->modifier))
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a></div>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a></div>';
}
print "</div>";

View File

@ -315,7 +315,7 @@ if (empty($reshook))
$object->retained_warranty_fk_cond_reglement = 0; // To clean property
$result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int'));
if ($result < 0) dol_print_error($db, $object->error);
$old_rw_date_lim_reglement = $object->retained_warranty_date_limit;
$new_rw_date_lim_reglement = $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
if ($new_rw_date_lim_reglement > $old_rw_date_lim_reglement) $object->retained_warranty_date_limit = $new_rw_date_lim_reglement;
@ -323,7 +323,7 @@ if (empty($reshook))
$result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error);
}
elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer)
{
$object->fetch($id);
@ -331,7 +331,7 @@ if (empty($reshook))
if ($result < 0)
dol_print_error($db, $object->error);
}
elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer)
{
$object->fetch($id);
@ -339,7 +339,7 @@ if (empty($reshook))
if ($result < 0)
dol_print_error($db, $object->error);
}
// Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
@ -1237,11 +1237,11 @@ if (empty($reshook))
$object->situation_counter = 1;
$object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle();
$object->retained_warranty = GETPOST('retained_warranty', 'int');
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
if(!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)){
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
@ -2761,7 +2761,8 @@ if ($action == 'create')
print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
// Outstanding Bill
$outstandingBills = $soc->get_OutstandingBill();
$arrayoutstandingbills = $soc->getOutstandingBills();
$outstandingBills = $arrayoutstandingbills['opened'];
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
if ($soc->outstanding_limit != '')
@ -3188,25 +3189,25 @@ if ($action == 'create')
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){
$rwStyle = 'display:none;';
if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){
$rwStyle = '';
}
$retained_warranty = GETPOST('retained_warranty', 'int');
$retained_warranty = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('RetainedWarranty') . '</td><td colspan="2">';
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
// Retained warranty payment term
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('PaymentConditionsShortRetainedWarranty') . '</td><td colspan="2">';
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("[name=\'type\'").change(function() {
@ -3312,8 +3313,8 @@ if ($action == 'create')
'__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')',
'__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')',
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')',
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')',
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')',
'__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'
);
@ -4109,9 +4110,9 @@ elseif ($id > 0 || ! empty($ref))
}
}
}
// Retained Warranty
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
@ -4120,7 +4121,7 @@ elseif ($id > 0 || ! empty($ref))
if ($action != 'editretainedwarranty' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarranty&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarranty'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editretainedwarranty')
@ -4137,7 +4138,7 @@ elseif ($id > 0 || ! empty($ref))
print price($object->retained_warranty).'%';
}
print '</td></tr>';
// Retained warranty payment term
print '<tr class="retained-warranty-lines" ><td>';
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
@ -4146,14 +4147,14 @@ elseif ($id > 0 || ! empty($ref))
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantypaymentterms&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
if($object->date > $defaultDate){
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantypaymentterms')
{
//date('Y-m-d',$object->date_lim_reglement)
@ -4175,10 +4176,10 @@ elseif ($id > 0 || ! empty($ref))
}
}
print '</td></tr>';
if($displayWarranty)
{
// Retained Warranty payment date limit
@ -4189,14 +4190,14 @@ elseif ($id > 0 || ! empty($ref))
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer){
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantydatelimit&amp;facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarrantyDateLimit'), 1) . '</a></td>';
}
print '</tr></table>';
print '</td><td>';
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
if($object->date > $defaultDate){
$defaultDate = $object->date;
}
if ($action == 'editretainedwarrantydatelimit')
{
//date('Y-m-d',$object->date_lim_reglement)
@ -4214,8 +4215,8 @@ elseif ($id > 0 || ! empty($ref))
print '</td></tr>';
}
}
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -4663,7 +4664,7 @@ elseif ($id > 0 || ! empty($ref))
// Retained warranty : usualy use on construction industry
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
// Billed - retained warranty
if($object->type == Facture::TYPE_SITUATION)
{
@ -4674,11 +4675,11 @@ elseif ($id > 0 || ! empty($ref))
// Because one day retained warranty could be used on standard invoices
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
}
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' :</td><td align="right">' . price($billedWithRetainedWarranty) . '</td><td>&nbsp;</td></tr>';
// retained warranty
print '<tr><td colspan="' . $nbcols . '" align="right">';
print $langs->trans("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';

View File

@ -1017,8 +1017,8 @@ if ($action == 'create')
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
// Only on template invoices
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')';
@ -1359,8 +1359,8 @@ else
$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
// Only on template invoices
$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when?$object->date_when:dol_now()), 'dayhour').')';

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');
/*
@ -615,7 +618,7 @@ if ($resql)
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
if($user->rights->facture->creer)
if($user->rights->facture->creer && $contextpage != 'poslist')
{
$newcardbutton.= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/facture/card.php?action=create');
}
@ -697,7 +700,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
if ($massactionbutton && $contextpage != 'poslist') $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -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">';
@ -1094,7 +1097,14 @@ if ($resql)
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="tdoverflowmax200">';
print $thirdpartystatic->getNomUrl(1, 'customer');
if ($contextpage == 'poslist')
{
print $thirdpartystatic->name;
}
else
{
print $thirdpartystatic->getNomUrl(1, 'customer');
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
@ -1261,7 +1271,7 @@ if ($resql)
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
if (($massactionbutton || $massaction) && $contextpage != 'poslist') // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->id, $arrayofselected)) $selected=1;

View File

@ -539,7 +539,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.entity IN ('.getEntity('invoice', $conf->entity).')';
$sql.= ' WHERE f.entity IN ('.getEntity('facture').')';
$sql.= ' AND (f.fk_soc = '.$facture->socid;
// Can pay invoices of all child of parent company
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
@ -597,7 +597,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td class="right">'.$alreadypayedlabel.'</td>';
print '<td class="right">'.$remaindertopay.'</td>';
print '<td class="right">'.$langs->trans('PaymentAmount').'</td>';
print '<td class="right">&nbsp;</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $facture, $action); // Note that $action and $object may have been modified by hook
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
$total=0;
@ -744,6 +748,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print "</td>";
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
// Warning
print '<td align="center" width="16">';
//print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."<br>";
@ -754,9 +761,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
print "</tr>\n";
$total+=$objp->total;
@ -804,9 +808,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if ($action != 'add_paiement')
{
$checkboxlabel=$langs->trans("ClosePaidInvoicesAutomatically");
if ($facture->type == 2) $checkboxlabel=$langs->trans("ClosePaidCreditNotesAutomatically");
if ($facture->type == Facture::TYPE_CREDIT_NOTE) $checkboxlabel=$langs->trans("ClosePaidCreditNotesAutomatically");
$buttontitle=$langs->trans('ToMakePayment');
if ($facture->type == 2) $buttontitle=$langs->trans('ToMakePaymentBack');
if ($facture->type == Facture::TYPE_CREDIT_NOTE) $buttontitle=$langs->trans('ToMakePaymentBack');
print '<br><div class="center">';
print '<input type="checkbox" checked name="closepaidinvoices"> '.$checkboxlabel;
@ -893,12 +897,13 @@ if (! GETPOST('action', 'aZ09'))
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td class="right">'.price($objp->amount).'</td><td>&nbsp;</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
print '<td class="right">'.price($objp->amount).'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook
$i++;
}
print '</table>';

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

@ -710,37 +710,37 @@ if ($id > 0)
// Reopen
if ($object->paye && $user->rights->tax->charges->creer)
{
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&amp;action=reopen\">".$langs->trans("ReOpen")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&amp;action=reopen\">".$langs->trans("ReOpen")."</a></div>";
}
// Edit
if ($object->paye == 0 && $user->rights->tax->charges->creer)
{
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=edit\">".$langs->trans("Modify")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=edit\">".$langs->trans("Modify")."</a></div>";
}
// Emit payment
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer)
{
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a></div>";
}
// Classify 'paid'
if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer)
{
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=paid\">".$langs->trans("ClassifyPaid")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=paid\">".$langs->trans("ClassifyPaid")."</a></div>";
}
// Clone
if ($user->rights->tax->charges->creer)
{
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&amp;action=clone\">".$langs->trans("ToClone")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php", 1). "?id=$object->id&amp;action=clone\">".$langs->trans("ToClone")."</a></div>";
}
// Delete
if ($user->rights->tax->charges->supprimer)
{
print "<a class=\"butActionDelete\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=delete\">".$langs->trans("Delete")."</a>";
print "<div class=\"inline-block divButAction\"><a class=\"butActionDelete\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&amp;action=delete\">".$langs->trans("Delete")."</a></div>";
}
print "</div>";

View File

@ -317,7 +317,7 @@ class ChargeSociales extends CommonObject
$sql.= ", date_ech='".$this->db->idate($this->date_ech)."'";
$sql.= ", periode='".$this->db->idate($this->periode)."'";
$sql.= ", amount='".price2num($this->amount, 'MT')."'";
$sql.= ", fk_projet=".($this->fk_project > 0 ? $this->fk_project : null);
$sql.= ", fk_projet=".($this->fk_project>0?$this->db->escape($this->fk_project):"NULL");
$sql.= ", fk_user_modif=".$user->id;
$sql.= " WHERE rowid=".$this->id;

View File

@ -385,16 +385,16 @@ if ($id)
{
if (! empty($user->rights->tax->charges->supprimer))
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a></div>';
}
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a></div>';
}
print "</div>";
}

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

@ -165,8 +165,8 @@ $arrayfields=array(
'p.fax'=>array('label'=>"Fax", 'checked'=>0),
'p.email'=>array('label'=>"EMail", 'checked'=>1),
'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))),
'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))),
@ -427,7 +427,7 @@ if ($search_societe != '') $param.='&amp;search_societe='.urlencode($search_soci
if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip);
if ($search_town != '') $param.='&amp;search_town='.urlencode($search_town);
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
if ($search_job != '') $param.='&amp;search_job='.urlencode($search_job);
if ($search_poste != '') $param.='&amp;search_poste='.urlencode($search_poste);
if ($search_phone_pro != '') $param.='&amp;search_phone_pro='.urlencode($search_phone_pro);
if ($search_phone_perso != '') $param.='&amp;search_phone_perso='.urlencode($search_phone_perso);
if ($search_phone_mobile != '') $param.='&amp;search_phone_mobile='.urlencode($search_phone_mobile);
@ -629,6 +629,12 @@ if (! empty($arrayfields['p.skype']['checked']))
print '<input class="flat" type="text" name="search_skype" size="6" value="'.dol_escape_htmltag($search_skype).'">';
print '</td>';
}
if (! empty($arrayfields['p.jabberid']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_jabberid" size="6" value="'.dol_escape_htmltag($search_jabberid).'">';
print '</td>';
}
if (! empty($arrayfields['p.twitter']['checked']))
{
print '<td class="liste_titre">';
@ -720,6 +726,7 @@ if (! empty($arrayfields['p.fax']['checked'])) print_liste_field
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.jabberid']['checked'])) print_liste_field_titre($arrayfields['p.jabberid']['label'], $_SERVER["PHP_SELF"], "p.jabberid", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder);

View File

@ -96,6 +96,12 @@ class Contrat extends CommonObject
*/
public $ref_supplier;
/**
* Entity of the contract
* @var int
*/
public $entity;
/**
* Client id linked to the contract
* @var int
@ -617,13 +623,14 @@ class Contrat extends CommonObject
* @param string $ref Ref
* @param string $ref_customer Customer ref
* @param string $ref_supplier Supplier ref
* @return int <0 if KO, 0 if not found, Id of contract if OK
* @return int <0 if KO, 0 if not found or if two records found for same ref, Id of contract if OK
*/
public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '')
{
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
$sql.= " ref_supplier, ref_customer,";
$sql.= " ref_ext,";
$sql.= " entity,";
$sql.= " fk_user_mise_en_service, date_contrat as datecontrat,";
$sql.= " fk_user_author, fin_validite, date_cloture,";
$sql.= " fk_projet as fk_project,";
@ -649,57 +656,67 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
if ($obj)
$num=$this->db->num_rows($resql);
if ($num > 1)
{
$this->id = $obj->rowid;
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
$this->ref_customer = $obj->ref_customer;
$this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $obj->ref_ext;
$this->statut = $obj->statut;
$this->mise_en_service = $this->db->jdate($obj->datemise);
$this->date_contrat = $this->db->jdate($obj->datecontrat);
$this->date_creation = $this->db->jdate($obj->datecontrat);
$this->fin_validite = $this->db->jdate($obj->fin_validite);
$this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->user_author_id = $obj->fk_user_author;
$this->commercial_signature_id = $obj->fk_commercial_signature;
$this->commercial_suivi_id = $obj->fk_commercial_suivi;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf;
$this->fk_projet = $obj->fk_project; // deprecated
$this->fk_project = $obj->fk_project;
$this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->db->free($resql);
// Retreive all extrafields
// fetch optionals attributes and labels
$this->fetch_optionals();
// Lines
$result=$this->fetch_lines();
if ($result < 0)
$this->error='Fetch found several records.';
dol_syslog($this->error, LOG_ERR);
$result = -2;
}
elseif ($num) // $num = 1
{
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$this->error=$this->db->lasterror();
return -3;
}
$this->id = $obj->rowid;
$this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref;
$this->ref_customer = $obj->ref_customer;
$this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $obj->ref_ext;
$this->entity = $obj->entity;
$this->statut = $obj->statut;
$this->mise_en_service = $this->db->jdate($obj->datemise);
return $this->id;
$this->date_contrat = $this->db->jdate($obj->datecontrat);
$this->date_creation = $this->db->jdate($obj->datecontrat);
$this->fin_validite = $this->db->jdate($obj->fin_validite);
$this->date_cloture = $this->db->jdate($obj->date_cloture);
$this->user_author_id = $obj->fk_user_author;
$this->commercial_signature_id = $obj->fk_commercial_signature;
$this->commercial_suivi_id = $obj->fk_commercial_suivi;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->modelpdf = $obj->model_pdf;
$this->fk_projet = $obj->fk_project; // deprecated
$this->fk_project = $obj->fk_project;
$this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->db->free($resql);
// Retreive all extrafields
// fetch optionals attributes and labels
$this->fetch_optionals();
// Lines
$result=$this->fetch_lines();
if ($result < 0)
{
$this->error=$this->db->lasterror();
return -3;
}
return $this->id;
}
}
else
{

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

@ -39,7 +39,7 @@
// Protection
if (empty($objectclass) || empty($uploaddir))
{
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined');
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $objectclass or $uploaddir was not defined');
exit;
}

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$action=GETPOST('action', 'alpha');
$hash_unique_id=GETPOST('hash_unique_id', 'alpha');
$hash_algo=GETPOST('hash', 'alpha');
$hash_algo=GETPOST('hash_algo', 'alpha');
// Security check
@ -53,7 +53,7 @@ print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"])
// If ok
if ($action == 'firstpingok')
{
// Note: pings are by entities
// Note: pings are by installation, done on entity 1.
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_DATE', dol_print_date($now, 'dayhourlog', 'gmt'));
dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id);
@ -62,7 +62,7 @@ if ($action == 'firstpingok')
// If ko
elseif ($action == 'firstpingko')
{
// Note: pings are by entities
// Note: pings are by installation, done on entity 1.
dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt');
print 'First ping KO saved for entity '.$conf->entity;
}

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

@ -0,0 +1,163 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* 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/>.
*/
/**
* \file htdocs/core/boxes/box_adherent_birthdays.php
* \ingroup member
* \brief Box for member birthdays
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show user birthdays
*/
class box_birthdays_members extends ModeleBoxes
{
public $boxcode="birthdays_members";
public $boximg="object_user";
public $boxlabel="BoxBirthdaysMembers";
public $depends = array("adherent");
/**
* @var DoliDB Database handler.
*/
public $db;
public $enabled = 1;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $user;
$this->db = $db;
$this->hidden = ! ($user->rights->adherent->lire && empty($user->socid));
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 20)
{
global $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$memberstatic=new Adherent($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleMemberNextBirthdays"));
if ($user->rights->adherent->lire)
{
$sql = "SELECT u.rowid, u.firstname, u.lastname";
$sql.= ", u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as u";
$sql.= " WHERE u.entity IN (".getEntity('adherent').")";
$sql.= " AND u.statut = 1";
$sql.= " AND date_format(u.birth, '%m-%d') >= date_format(curdate(), '%m-%d')";
$sql.= " ORDER BY date_format(u.birth, '%m-%d') ASC";
$sql.= $db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$line = 0;
while ($line < $num)
{
$objp = $db->fetch_object($result);
$memberstatic->id = $objp->rowid;
$memberstatic->firstname = $objp->firstname;
$memberstatic->lastname = $objp->lastname;
$memberstatic->email = $objp->email;
$dateb=$db->jdate($objp->birth);
$age = date('Y', dol_now()) - date('Y', $dateb);
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $memberstatic->getNomUrl(1),
'asis' => 1,
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($dateb, "day") . ' - ' . $age . ' ' . $langs->trans('DurationYears')
);
/*$this->info_box_contents[$line][] = array(
'td' => 'class="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status, 3)
);*/
$line++;
}
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedUsers"));
$db->free($result);
}
else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)
);
}
}
else {
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

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);
}
/**

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