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

This commit is contained in:
Florian HENRY 2022-01-24 23:23:43 +01:00
commit 3f811d37f1
1270 changed files with 22743 additions and 18275 deletions

View File

@ -26,8 +26,9 @@ Default **language here is english**. So please prepare your contributions in en
1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). 1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr).
2. Clone your fork. 2. Clone your fork.
3. Choose a branch(See the [Branches](#branches) section below). 3. Choose a branch(See the [Branches](#branches) section below).
4. Commit and push your changes. 4. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation).
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). 5. Commit and push your changes.
6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
<span id="branches" name="branches"></span> <span id="branches" name="branches"></span>
### Branches ### Branches

View File

@ -57,7 +57,7 @@ jobs:
php: nightly php: nightly
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = 14.0 if: type = push AND branch = 15.0
php: nightly php: nightly
env: DB=mysql env: DB=mysql
@ -411,6 +411,12 @@ script:
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log
php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log
php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
ls -alrt $TRAVIS_BUILD_DIR/ ls -alrt $TRAVIS_BUILD_DIR/
- | - |

View File

@ -15,7 +15,7 @@ NEW: Add option to disable globaly some notifications emails.
NEW: #18326 Workflow: Close order on shipment closing. NEW: #18326 Workflow: Close order on shipment closing.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference. NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
NEW: #18689 REST API module: add api key generate / modify right. NEW: #18689 REST API module: add api key generate / modify pemrission.
NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties. NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties.
NEW: #18046 Add tags on ticket/categories NEW: #18046 Add tags on ticket/categories
NEW: #18326 Workflow: Close order on shipment closing. NEW: #18326 Workflow: Close order on shipment closing.
@ -109,6 +109,13 @@ NEW: External backups can be downloaded from the "About info page".
NEW: Add massaction to switch status on sale / on purchase of a product. NEW: Add massaction to switch status on sale / on purchase of a product.
Modules
NEW: Stable module Knowledge Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Development of module Partnership Management
For developers: For developers:
--------------- ---------------
@ -116,6 +123,7 @@ NEW: Introduce method hasRight
NEW: Can use textarea field into a confirm popup. NEW: Can use textarea field into a confirm popup.
NEW: Can use the result_mode of mysqli driver. Save memory for list count NEW: Can use the result_mode of mysqli driver. Save memory for list count
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
NEW: Add API /approve and /makeOrder for purchase orders.
NEW: add action trigger for member excluded NEW: add action trigger for member excluded
NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
NEW: Add code codebar column on serial/lot structure NEW: Add code codebar column on serial/lot structure
@ -138,6 +146,8 @@ NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
NEW: Add hook printUnderHeaderPDFline on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices). NEW: Add hook printUnderHeaderPDFline on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it).
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). * The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).

View File

@ -4,6 +4,7 @@
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr) [![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521)
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).

View File

@ -6,13 +6,14 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported | | Version | Supported |
| ---------- | ---------------------- | | ---------- | ---------------------- |
| <= 14.0.1 | :x: | | <= 14.0.4 | :x: |
| >= 14.0.2+ | :white_check_mark: except CSRF attacks| | >= 14.0.5+ | :white_check_mark: except CSRF attacks|
| >= develop | :white_check_mark: | | >= develop | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability
To report a vulnerability, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody) To report a vulnerability, for a private report, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions).
Alternatively send an email to security@dolibarr.org (for everybody)
## Hunting vulnerabilities on Dolibarr ## Hunting vulnerabilities on Dolibarr
@ -66,7 +67,7 @@ Scope is the web application (back office) and the APIs.
* Remote code execution (RCE) * Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...) * Code injections (HTML, JS, SQL, PHP, ...)
* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose or into module "Web site" when permission to edit website content is allowed). * Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too).
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users) * Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
* Open redirect * Open redirect
* Broken authentication & session management * Broken authentication & session management

View File

@ -39,15 +39,13 @@ RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug && docker-php-ext-enable xdebug RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini #RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'localhost docker.host' >> /etc/hosts
# set up sendmail config, to use maildev # set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc RUN echo "account default" > /etc/msmtprc

View File

@ -48,6 +48,7 @@ services:
- external-pod - external-pod
extra_hosts: extra_hosts:
- "localhost.localdomain:127.0.0.1" - "localhost.localdomain:127.0.0.1"
- "host.docker.internal:host-gateway"
mail: mail:
image: maildev/maildev image: maildev/maildev

View File

@ -58,8 +58,8 @@ $listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
$active = 1; $active = 1;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -80,8 +80,8 @@ if (empty($accounting_product_mode)) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -48,8 +48,8 @@ $socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid; // if ($user->socid) $socid=$user->socid;
$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) { if (empty($page) || $page == - 1) {
$page = 0; $page = 0;
@ -157,7 +157,7 @@ $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code"; $sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )"; $sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
/* /*
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {

View File

@ -48,8 +48,8 @@ $socid = GETPOSTINT("socid");
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) { if (empty($page) || $page == - 1) {
$page = 0; $page = 0;

View File

@ -29,6 +29,7 @@
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
/** /**
* Class to manage accounting accounts * Class to manage accounting accounts
*/ */
@ -566,7 +567,7 @@ class AccountingAccount extends CommonObject
/** /**
* Information on record * Information on record
* *
* @param int $id of record * @param int $id ID of record
* @return void * @return void
*/ */
public function info($id) public function info($id)
@ -850,8 +851,8 @@ class AccountingAccount extends CommonObject
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) // Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($buyer->code_compta)) { if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta; $code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty']; $suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thridparty'; $suggestedaccountingaccountfor = 'thridparty';
} }

View File

@ -2114,15 +2114,26 @@ class BookKeepingLine
public $montant; public $montant;
/** /**
* @var float Amount * @var float Amount
*/ */
public $amount; public $amount;
/**
* @var float Multicurrency amount
*/
public $multicurrency_amount;
/**
* @var float Multicurrency code
*/
public $multicurrency_code;
/** /**
* @var string Sens * @var string Sens
*/ */
public $sens; public $sens;
public $lettering_code; public $lettering_code;
public $date_lettering;
/** /**
* @var int ID * @var int ID
@ -2153,4 +2164,9 @@ class BookKeepingLine
* @var integer|string $date_validation; * @var integer|string $date_validation;
*/ */
public $date_validation; public $date_validation;
/**
* @var integer|string $date_lim_reglement;
*/
public $date_lim_reglement;
} }

View File

@ -153,9 +153,9 @@ if ($action == 'validatehistory') {
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra,"; $sql .= " s.tva_intra,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_sell as company_code_sell"; $sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
} else { } else {
$sql .= " s.accountancy_code_sell as company_code_sell"; $sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
} }
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
@ -215,7 +215,7 @@ if ($action == 'validatehistory') {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;

View File

@ -539,13 +539,14 @@ if ($result) {
$thirdpartystatic->client = $objp->client; $thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility
$thirdpartystatic->code_compta_client = $objp->code_compta_client; $thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_company = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;

View File

@ -211,7 +211,7 @@ if ($action == 'validatehistory') {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -230,7 +230,7 @@ if ($action == 'validatehistory') {
$facture_static->ref = $objp->ref; $facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid; $facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype; $facture_static->type = $objp->ftype;
$facture_static->datef = $objp->datef; $facture_static->date = $objp->datef;
$facture_static_det->id = $objp->rowid; $facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht; $facture_static_det->total_ht = $objp->total_ht;

View File

@ -547,7 +547,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_company = $objp->company_code_buy; $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;

View File

@ -39,8 +39,8 @@ $langs->loadLangs(array("companies", "members"));
$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int'); $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -949,7 +949,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print load_fiche_titre($langs->trans("NewMember"), '', $object->picto); print load_fiche_titre($langs->trans("NewMember"), '', $object->picto);
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript">'; print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";

View File

@ -275,7 +275,7 @@ dol_htmloutput_errors($mesg);
print '<br>'; print '<br>';
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="foruserid" value="all">'; print '<input type="hidden" name="foruserid" value="all">';
@ -289,12 +289,12 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br><br>'; print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="cardlogin">'; print '<input type="hidden" name="mode" value="cardlogin">';
@ -308,12 +308,12 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">'; print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br><br>'; print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' '; print img_picto('', 'card').' '.$langs->trans("DocForLabels", (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="label">'; print '<input type="hidden" name="mode" value="label">';
@ -326,7 +326,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
// End of page // End of page

View File

@ -94,9 +94,15 @@ class AdherentType extends CommonObject
*/ */
public $amount; public $amount;
/** @var string Public note */ /**
* @var string Public note
* @deprecated
*/
public $note; public $note;
/** @var string Public note */
public $note_public;
/** @var integer Can vote */ /** @var integer Can vote */
public $vote; public $vote;
@ -358,6 +364,10 @@ class AdherentType extends CommonObject
$this->label = trim($this->label); $this->label = trim($this->label);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -368,14 +378,14 @@ class AdherentType extends CommonObject
$sql .= "subscription = '".$this->db->escape($this->subscription)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',";
$sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).","; $sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
$sql .= " WHERE rowid =".((int) $this->id); $sql .= " WHERE rowid =".((int) $this->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->description = $this->db->escape($this->note); $this->description = $this->db->escape($this->note_public);
// Multilangs // Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -461,7 +471,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note as note_public, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -483,7 +493,8 @@ class AdherentType extends CommonObject
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->vote = $obj->vote; $this->vote = $obj->vote;
// multilangs // multilangs
@ -792,12 +803,16 @@ class AdherentType extends CommonObject
// Object classes // Object classes
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS); $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
// Champs // Champs
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) { if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label; $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
} }
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) { if ($this->note_public && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1); $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 0, 'UTF-8', 1);
} }
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) { if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array(); $valueofldapfield = array();
@ -829,7 +844,7 @@ class AdherentType extends CommonObject
$this->specimen = 1; $this->specimen = 1;
$this->label = 'MEMBERS TYPE SPECIMEN'; $this->label = 'MEMBERS TYPE SPECIMEN';
$this->note = 'This is a note'; $this->note_public = 'This is a public note';
$this->mail_valid = 'This is welcome email'; $this->mail_valid = 'This is welcome email';
$this->subscription = 1; $this->subscription = 1;
$this->vote = 0; $this->vote = 0;

View File

@ -215,7 +215,7 @@ class Subscription extends CommonObject
$sql .= " tms,"; $sql .= " tms,";
$sql .= " dateadh as dateh,"; $sql .= " dateadh as dateh,";
$sql .= " datef,"; $sql .= " datef,";
$sql .= " subscription, note, fk_bank"; $sql .= " subscription, note as note_public, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".((int) $rowid); $sql .= " WHERE rowid=".((int) $rowid);
@ -235,7 +235,8 @@ class Subscription extends CommonObject
$this->dateh = $this->db->jdate($obj->dateh); $this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef); $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription; $this->amount = $obj->subscription;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
return 1; return 1;
} else { } else {
@ -266,10 +267,14 @@ class Subscription extends CommonObject
return -1; return -1;
} }
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".((int) $this->fk_type).","; $sql .= " fk_type = ".((int) $this->fk_type).",";
$sql .= " fk_adherent = ".((int) $this->fk_adherent).","; $sql .= " fk_adherent = ".((int) $this->fk_adherent).",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null').",";
$sql .= " subscription = ".price2num($this->amount).","; $sql .= " subscription = ".price2num($this->amount).",";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";

View File

@ -44,8 +44,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -83,8 +83,8 @@ if ($search_status < -2) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -22,27 +22,6 @@
* \brief Page to create/edit/view partnership * \brief Page to create/edit/view partnership
*/ */
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';

View File

@ -1163,9 +1163,13 @@ if ($rowid > 0) {
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">'; $parameters = array();
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; if (empty($reshook)) {
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -52,8 +52,8 @@ $sall = '';
$date_select = GETPOST("date_select", 'alpha'); $date_select = GETPOST("date_select", 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -53,8 +53,8 @@ $status = GETPOST('status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -192,6 +192,7 @@ if (!empty($triggers)) {
} }
if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) { if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) {
print '<!-- '.$trigger['position'].' -->';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$trigger['code'].'</td>'; print '<td>'.$trigger['code'].'</td>';
print '<td>'.$trigger['label'].'</td>'; print '<td>'.$trigger['label'].'</td>';

View File

@ -104,6 +104,8 @@ if ($action == 'set') {
$resultCreat = $defaultValues->create($user); $resultCreat = $defaultValues->create($user);
if ($resultCreat < 0) { if ($resultCreat < 0) {
setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
} else {
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
} }
} elseif ($action == 'specimen') { // For orders } elseif ($action == 'specimen') { // For orders
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@ -316,6 +318,16 @@ print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'.$langs->trans("Value").'</td>'."\n"; print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";
// AGENDA_DEFAULT_VIEW
print '<tr class="oddeven">'."\n";
$htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";
// Manual or automatic // Manual or automatic
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
@ -340,16 +352,6 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
// AGENDA_DEFAULT_VIEW
print '<tr class="oddeven">'."\n";
$htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n";
$tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";
// AGENDA_EVENT_DEFAULT_STATUS // AGENDA_EVENT_DEFAULT_STATUS
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n"; print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n";

View File

@ -158,18 +158,6 @@ if ($action == 'updateMask') {
$error++; $error++;
} }
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
@ -646,25 +634,6 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// Shippable Icon in List
/* Kept as hidden feature for the moment, result seems bugged.
Where is definition of "shippable" according to all different STOCK_CALCULATE_... options ?
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
print '<td>&nbsp;</td>';
print '<td class="center">';
if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activated"),'switch_on');
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"),'switch_off');
}
print '</a></td>';
print '</tr>';
*/
/* /*
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. // Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
// Ask for payment bank during order // Ask for payment bank during order

View File

@ -37,8 +37,6 @@ if (!$user->admin) {
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$entity = GETPOST('entity', 'int'); $entity = GETPOST('entity', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$update = GETPOST('update', 'alpha');
$delete = GETPOST('delete', 'none'); // Do not use alpha here
$debug = GETPOST('debug', 'int'); $debug = GETPOST('debug', 'int');
$consts = GETPOST('const', 'array'); $consts = GETPOST('const', 'array');
$constname = GETPOST('constname', 'alphanohtml'); $constname = GETPOST('constname', 'alphanohtml');

View File

@ -46,8 +46,8 @@ $optioncss = GETPOST('optionscss', 'alphanohtml');
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus' $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus'
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -64,7 +64,7 @@ if (!$sortorder) {
$defaulturl = GETPOST('defaulturl', 'alphanohtml'); $defaulturl = GETPOST('defaulturl', 'alphanohtml');
$defaultkey = GETPOST('defaultkey', 'alphanohtml'); $defaultkey = GETPOST('defaultkey', 'alphanohtml');
$defaultvalue = GETPOST('defaultvalue', 'none'); $defaultvalue = GETPOST('defaultvalue', 'restricthtml');
$defaulturl = preg_replace('/^\//', '', $defaulturl); $defaulturl = preg_replace('/^\//', '', $defaulturl);

View File

@ -77,8 +77,8 @@ $listoffset = GETPOST('listoffset');
$listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries $listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries
$active = 1; $active = 1;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -1,6 +1,5 @@
div.divsearchfield { div.divsearchfield {
float: left;
margin: 4px 12px 4px 2px; margin: 4px 12px 4px 2px;
padding-left: 2px; padding-left: 2px;
} }

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/eventorganization.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Translations // Translations
$langs->loadLangs(array("admin", "eventorganization")); $langs->loadLangs(array("admin", "eventorganization", "categories"));
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -54,11 +54,11 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1), //'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:conferenceorbooth', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
); );
$error = 0; $error = 0;

View File

@ -49,7 +49,7 @@ $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$cu
$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int'); $valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int');
$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int'); $valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int');
$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int'); $valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int');
$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alpha')); $valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2);
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
@ -211,7 +211,7 @@ if (empty($mysoc->country_code)) {
print '<span class="opacitymedium">'.$langs->trans("Format").':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("Format").':</span> '.price(price2num(1234.56789, 'MT'), 0, $langs, 1, -1, -1, $currencycode)."<br>\n";
// Always show vat rates with vat 0 // Always show vat rates with vat 0
$s = 2 / 7; $qty = 1; $vat = 0; $s = 2 / 3; $qty = 1; $vat = 0;
$tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;

View File

@ -80,8 +80,8 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"')
$listoffset = GETPOST('listoffset', 'alpha'); $listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000; $listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -535,11 +535,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>'; //$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
$moreforfilter .= '<div class="colorbacktimesheet float valignmiddle">'; $moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacityhigh hideonsmartphone"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">'; $moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacityhigh hideonsmartphone"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1); $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
@ -553,16 +553,16 @@ if ($mode == 'common' || $mode == 'commonkanban') {
if ($conf->global->MAIN_FEATURES_LEVEL > 1) { if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
$array_version['development'] = $langs->trans("Development"); $array_version['development'] = $langs->trans("Development");
} }
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
$moreforfilter .= '<div class="divsearchfield paddingtop">'; $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= ' '; $moreforfilter .= ' ';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
$moreforfilter .= '<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">'; $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) { if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) {
$moreforfilter .= ' '; $moreforfilter .= ' ';
$moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">'; $moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
@ -1139,7 +1139,7 @@ if ($mode == 'deploy') {
} }
if ($allowfromweb == 1) { if ($allowfromweb == 1) {
print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>'; print '<span class="opacitymedium">'.$langs->trans("UnpackPackageInModulesRoot", $dirins).'</span><br>';
print '<br>'; print '<br>';

View File

@ -27,6 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php';
// $supportedoauth2array is defined into oauth.lib.php
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -96,10 +97,12 @@ print '<table class="noborder centpercent">';
$i = 0; $i = 0;
// $list is defined into oauth.lib.php // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
foreach ($list as $key) { foreach ($list as $key) {
$supported = 0; $supported = 0;
if (in_array($key[0], array_keys($supportedoauth2array))) { $keyforsupportedoauth2array = $key[0];
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
$supported = 1; $supported = 1;
} }
if (!$supported) { if (!$supported) {
@ -110,20 +113,23 @@ foreach ($list as $key) {
print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">'; print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
// Api Name // Api Name
$label = $langs->trans($key[0]); $label = $langs->trans($keyforsupportedoauth2array);
print '<td>'.$label.'</td>';
print '<td>'; print '<td>';
if (!empty($key[3])) { print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
print $langs->trans($key[3]); print $label;
print '</td>';
print '<td>';
if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp'])) {
print $langs->trans($supportedoauth2array[$keyforsupportedoauth2array]['urlforapp']);
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if ($supported) { if ($supported) {
$redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$key[0]].'_oauthcallback.php'; $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>'; print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td><input style="width: 80%" type"text" name="uri'.$key[0].'" value="'.$redirect_uri.'">'; print '<td><input style="width: 80%" type"text" name="uri'.$keyforsupportedoauth2array.'" value="'.$redirect_uri.'">';
print '</td></tr>'; print '</td></tr>';
} else { } else {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';

View File

@ -25,17 +25,13 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list and $supportedoauth2array
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Storage\DoliStorage;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'printing', 'oauth')); $langs->loadLangs(array('admin', 'printing', 'oauth'));
if (!$user->admin) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
@ -50,6 +46,10 @@ if (!$mode) {
$mode = 'setup'; $mode = 'setup';
} }
if (!$user->admin) {
accessforbidden();
}
/* /*
* Action * Action
@ -122,7 +122,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai
$form = new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("PrintingSetup")); llxHeader('', $langs->trans("TokenManager"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup'); print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
@ -140,7 +140,9 @@ if ($mode == 'setup' && $user->admin) {
foreach ($list as $key) { foreach ($list as $key) {
$supported = 0; $supported = 0;
if (in_array($key[0], array_keys($supportedoauth2array))) { $keyforsupportedoauth2array = $key[0];
if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
$supported = 1; $supported = 1;
} }
if (!$supported) { if (!$supported) {
@ -148,34 +150,44 @@ if ($mode == 'setup' && $user->admin) {
} }
$OAUTH_SERVICENAME = 'Unknown'; $OAUTH_SERVICENAME = empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'];
if ($key[0] == 'OAUTH_GITHUB_NAME') {
$OAUTH_SERVICENAME = 'GitHub'; // Define $shortscope, $urltorenew, $urltodelete, $urltocheckperms
// TODO Use array $supportedoauth2array
if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect. // We pass this param list in to 'state' because we need it before and after the redirect.
$shortscope = 'user,public_repo'; $shortscope = 'user,public_repo';
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/'; $urltocheckperms = 'https://github.com/settings/applications/';
} elseif ($key[0] == 'OAUTH_GOOGLE_NAME') { } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
$OAUTH_SERVICENAME = 'Google';
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect. // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
$shortscope = 'userinfo_email,userinfo_profile,cloud_print'; // We pass this key list into the param 'state' because we need it before and after the redirect.
if (!empty($conf->global->OAUTH_GSUITE)) { $shortscope = 'userinfo_email,userinfo_profile';
$shortscope .= ',openid,email,profile'; // For openid connect
if (!empty($conf->printing->enabled)) {
$shortscope .= ',cloud_print';
}
if (!empty($conf->global->OAUTH_GOOGLE_GSUITE)) {
$shortscope .= ',admin_directory_user'; $shortscope .= ',admin_directory_user';
} }
//$scope.=',gmail_full'; if (!empty($conf->global->OAUTH_GOOGLE_GMAIL)) {
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $shortscope.=',gmail_full';
}
$oauthstateanticsrf = bin2hex(random_bytes(128/8));
$_SESSION['oauthstateanticsrf'] = $shortscope.'-'.$oauthstateanticsrf;
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions'; $urltocheckperms = 'https://security.google.com/settings/security/permissions';
} elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME') { } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_TEST_NAME') {
$OAUTH_SERVICENAME = 'StripeTest';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
} elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME') { } elseif ($keyforsupportedoauth2array == 'OAUTH_STRIPE_LIVE_NAME') {
$OAUTH_SERVICENAME = 'StripeLive';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
@ -230,11 +242,14 @@ if ($mode == 'setup' && $user->admin) {
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setconst">'; print '<input type="hidden" name="action" value="setconst">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'."\n"; print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>'; print '<th class="titlefieldcreate">';
print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
print $langs->trans($keyforsupportedoauth2array);
print '</th>';
print '<th></th>'; print '<th></th>';
print '<th></th>'; print '<th></th>';
print "</tr>\n"; print "</tr>\n";
@ -244,7 +259,7 @@ if ($mode == 'setup' && $user->admin) {
//var_dump($key); //var_dump($key);
print $langs->trans("OAuthIDSecret").'</td>'; print $langs->trans("OAuthIDSecret").'</td>';
print '<td>'; print '<td>';
print $langs->trans("SeePreviousTab"); print '<span class="opacitymedium">'.$langs->trans("SeePreviousTab").'</span>';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '</td>'; print '</td>';
@ -259,7 +274,7 @@ if ($mode == 'setup' && $user->admin) {
if (is_object($tokenobj)) { if (is_object($tokenobj)) {
print $langs->trans("HasAccessToken"); print $langs->trans("HasAccessToken");
} else { } else {
print $langs->trans("NoAccessToken"); print '<span class="opacitymedium">'.$langs->trans("NoAccessToken").'</span>';
} }
print '</td>'; print '</td>';
print '<td width="50%">'; print '<td width="50%">';
@ -346,7 +361,7 @@ if ($mode == 'setup' && $user->admin) {
if ($mode == 'test' && $user->admin) { if ($mode == 'test' && $user->admin) {
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n"; print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
if (!empty($driver)) { if (!empty($driver)) {
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';

View File

@ -40,8 +40,8 @@ $search_id = GETPOST("search_id", 'alpha');
$search_version = GETPOST("search_version", 'alpha'); $search_version = GETPOST("search_version", 'alpha');
$search_permission = GETPOST("search_permission", 'alpha'); $search_permission = GETPOST("search_permission", 'alpha');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
if (!$sortfield) { if (!$sortfield) {
$sortfield = "id"; $sortfield = "id";

View File

@ -400,8 +400,6 @@ print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</td></tr>';
print '</table>';
@ -538,6 +536,8 @@ if (!empty($_SESSION["commandbackuptorun"])) {
print "</div> <!-- end div center button -->\n"; print "</div> <!-- end div center button -->\n";
print '</td></tr>';
print '</table>';
print "</div> <!-- end div fichehalfleft -->\n"; print "</div> <!-- end div fichehalfleft -->\n";

View File

@ -137,7 +137,7 @@ $dirtocompress = basename($fulldirtocompress);
if ($compression == 'zip') { if ($compression == 'zip') {
$file .= '.zip'; $file .= '.zip';
$excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; $excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
//var_dump($fulldirtocompress); //var_dump($fulldirtocompress);
//var_dump($outputdir."/".$file);exit; //var_dump($outputdir."/".$file);exit;
@ -173,7 +173,7 @@ if ($compression == 'zip') {
// We also exclude '/temp/' dir and 'documents/admin/documents' // We also exclude '/temp/' dir and 'documents/admin/documents'
// We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped. // We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped.
$cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'"; $cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='*.pdf_preview-*.png' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'";
$result = $utils->executeCLI($cmd, $outputfile, 0, null, 1); $result = $utils->executeCLI($cmd, $outputfile, 0, null, 1);

View File

@ -47,8 +47,8 @@ if ($user->socid > 0) {
} }
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -47,8 +47,8 @@ $transvalue = GETPOST('transvalue', 'restricthtml');
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey';
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -624,6 +624,9 @@ class Documents extends DolibarrApi
} elseif ($modulepart == 'expensereport') { } elseif ($modulepart == 'expensereport') {
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$object = new ExpenseReport($this->db); $object = new ExpenseReport($this->db);
} elseif ($modulepart == 'fichinter') {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$object = new Fichinter($this->db);
} elseif ($modulepart == 'adherent' || $modulepart == 'member') { } elseif ($modulepart == 'adherent' || $modulepart == 'member') {
$modulepart = 'adherent'; $modulepart = 'adherent';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';

View File

@ -137,7 +137,11 @@ class Login
if (empty($tmpuser->api_key) || $reset) { if (empty($tmpuser->api_key) || $reset) {
$tmpuser->getrights(); $tmpuser->getrights();
if (empty($tmpuser->rights->user->self->creer)) { if (empty($tmpuser->rights->user->self->creer)) {
throw new RestException(403, 'User need write permission on itself to reset its API token'); if (empty($tmpuser->api_key)) {
throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token');
} else {
throw new RestException(403, 'User need write permission on itself to reset its API token');
}
} }
// Generate token for user // Generate token for user

View File

@ -4,7 +4,7 @@
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr> * Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Thibault FOUCART <support@ptibogxiv.net> * Copyright (C) 2018-2022 Thibault FOUCART <support@ptibogxiv.net>
* *
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -26,7 +26,7 @@ use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/cstate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/cstate.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
/** /**
* API class for dictionaries * API class for dictionaries
@ -1721,6 +1721,66 @@ class Setup extends DolibarrApi
return $this->_cleanObjectDatas($mysoc); return $this->_cleanObjectDatas($mysoc);
} }
/**
* Get the list of establishments.
*
* @return array List of establishments
*
* @url GET /establishments
*
* @throws RestException
*/
public function getEstablishments()
{
$list = array();
$limit = 0;
$sql = "SELECT e.rowid, e.rowid as ref, e.label, e.address, e.zip, e.town, e.status";
$sql .= " FROM ".MAIN_DB_PREFIX."establishment as e";
$sql .= " WHERE e.entity IN (".getEntity('establishment').')';
// if ($type) $sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'";
// if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
// Add sql filters
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(503, 'Error when retrieving list of establishments : '.$this->db->lasterror());
}
return $list;
}
/**
* Get establishment by ID.
*
* @param int $id ID of establishment
* @return array Array of cleaned object properties
*
* @url GET establishments/{id}
*
* @throws RestException
*/
public function getEtablishmentByID($id)
{
$establishment = new Establishment($this->db);
$result = $establishment->fetch($id);
if ($result < 0) {
throw new RestException(503, 'Error when retrieving state : '.$establishment->error);
} elseif ($result == 0) {
throw new RestException(404, 'Establishment not found');
}
return $this->_cleanObjectDatas($establishment);
}
/** /**
* Get value of a setup variables * Get value of a setup variables

View File

@ -359,11 +359,7 @@ class AssetType extends CommonObject
if (!array_key_exists($obj->rowid, $ret)) { if (!array_key_exists($obj->rowid, $ret)) {
if ($mode < 2) { if ($mode < 2) {
$assetstatic = new Asset($this->db); $assetstatic = new Asset($this->db);
if ($mode == 1) { $assetstatic->fetch($obj->rowid);
$assetstatic->fetch($obj->rowid, '', '', '', false, false);
} else {
$assetstatic->fetch($obj->rowid);
}
$ret[$obj->rowid] = $assetstatic; $ret[$obj->rowid] = $assetstatic;
} else { } else {
$ret[$obj->rowid] = $obj->rowid; $ret[$obj->rowid] = $obj->rowid;

View File

@ -42,8 +42,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -47,8 +47,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$type = GETPOST('type', 'alpha'); $type = GETPOST('type', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -52,8 +52,8 @@ if (GETPOST('actioncode', 'array')) {
$search_agenda_label = GETPOST('search_agenda_label'); $search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -47,8 +47,8 @@ $ref = GETPOST('ref', 'alpha');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -789,6 +789,15 @@ class BOM extends CommonObject
if (isset($this->label)) { if (isset($this->label)) {
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
} }
if (!empty($this->fk_product) && $this->fk_product > 0) {
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($db);
$resultFetch = $product->fetch($this->fk_product);
if ($resultFetch > 0) {
$label .= "<br><b>".$langs->trans("Product").'</b>: '.$product->ref.' - '.$product->label;
}
}
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id; $url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;

View File

@ -56,7 +56,7 @@ function bomAdminPrepareHead()
//); // to remove a tab //); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp'); complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@mrp', 'remove'); complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp', 'remove');
return $head; return $head;
} }

View File

@ -937,7 +937,7 @@ if ($action == 'create') {
$("#selectcomplete").change(function() { $("#selectcomplete").change(function() {
if ($("#selectcomplete").val() == 100) if ($("#selectcomplete").val() == 100)
{ {
if ($("#doneby").val() <= 0) $("#doneby").val(\''.$user->id.'\'); if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
} }
if ($("#selectcomplete").val() == 0) if ($("#selectcomplete").val() == 0)
{ {
@ -992,7 +992,8 @@ if ($action == 'create') {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
$default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT); $default = (empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT) ? 'AC_RDV' : $conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
$formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1); print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions(GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default), "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
print '</td></tr>'; print '</td></tr>';
} }
@ -1000,7 +1001,7 @@ if ($action == 'create') {
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>'; print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
// Full day // Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>'; print '<tr><td><label for="fullday">'.$langs->trans("EventOnFullDay").'</label></td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep)); $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) { if (GETPOST('datep', 'int', 1)) {
@ -1311,7 +1312,7 @@ if ($action == 'create') {
print '</table>'; print '</table>';
if ($conf->global->AGENDA_REMINDER_EMAIL || $conf->global->AGENDA_REMINDER_BROWSER) { if (getDolGlobalString('AGENDA_REMINDER_EMAIL') || getDolGlobalString('AGENDA_REMINDER_BROWSER')) {
//checkbox create reminder //checkbox create reminder
print '<hr>'; print '<hr>';
print '<br>'; print '<br>';
@ -1336,10 +1337,11 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
//Mail Model //Mail Model
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("EMailTemplates").'</td><td colspan="3">'; if (getDolGlobalString('AGENDA_REMINDER_EMAIL')) {
print $form->selectModelMail('actioncommsend', 'actioncomm_send', 1, 1); print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("EMailTemplates").'</td><td colspan="3">';
print '</td></tr>'; print $form->selectModelMail('actioncommsend', 'actioncomm_send', 1, 1);
print '</td></tr>';
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -123,16 +123,17 @@ class ActionComm extends CommonObject
*/ */
public $label; public $label;
/**
* @var string Agenda event label
* @deprecated Use $label
*/
public $libelle;
/** /**
* @var integer Date creation record (datec) * @var integer Date creation record (datec)
*/ */
public $datec; public $datec;
/**
* @var integer Date end record (datef)
*/
public $datef;
/** /**
* @var integer Duration (duree) * @var integer Duration (duree)
*/ */
@ -172,6 +173,21 @@ class ActionComm extends CommonObject
*/ */
public $datep; public $datep;
/**
* @var integer Date action end (datef)
*/
public $datef;
/**
* @var integer This is date start action (datep) but modified to not be outside calendar view.
*/
public $date_start_in_calendar;
/**
* @var integer This is date end action (datef) but modified to not be outside calendar view.
*/
public $date_end_in_calendar;
/** /**
* @var integer Date action end (datep2) * @var integer Date action end (datep2)
*/ */
@ -188,6 +204,11 @@ class ActionComm extends CommonObject
*/ */
public $fulldayevent = 0; public $fulldayevent = 0;
/**
* @var int 1=???
*/
public $ponctuel;
/** /**
* @var integer Percentage * @var integer Percentage
*/ */
@ -219,8 +240,7 @@ class ActionComm extends CommonObject
public $userownerid; public $userownerid;
/** /**
* @var int Id of user done (deprecated) * @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set.
* @deprecated
*/ */
public $userdoneid; public $userdoneid;
@ -239,20 +259,6 @@ class ActionComm extends CommonObject
*/ */
public $reminders = array(); public $reminders = array();
/**
* @var User Object user of owner
* @deprecated
* @see $userownerid
*/
public $usertodo;
/**
* @var User Object user that did action
* @deprecated
* @see $userdoneid
*/
public $userdone;
/** /**
* @var int thirdparty id linked to action * @var int thirdparty id linked to action
*/ */
@ -827,18 +833,17 @@ class ActionComm extends CommonObject
$this->usermodid = $obj->fk_user_mod; $this->usermodid = $obj->fk_user_mod;
if (!is_object($this->author)) { if (!is_object($this->author)) {
$this->author = new stdClass(); // To avoid warning $this->author = new User($this->db); // To avoid warning
} }
$this->author->id = $obj->fk_user_author; // deprecated $this->author->id = $obj->fk_user_author; // deprecated
$this->author->firstname = $obj->firstname; // deprecated $this->author->firstname = $obj->firstname; // deprecated
$this->author->lastname = $obj->lastname; // deprecated $this->author->lastname = $obj->lastname; // deprecated
if (!is_object($this->usermod)) { if (!is_object($this->usermod)) {
$this->usermod = new stdClass(); // To avoid warning $this->usermod = new User($this->db); // To avoid warning
} }
$this->usermod->id = $obj->fk_user_mod; // deprecated $this->usermod->id = $obj->fk_user_mod; // deprecated
$this->userownerid = $obj->fk_user_action; $this->userownerid = $obj->fk_user_action;
$this->userdoneid = $obj->fk_user_done;
$this->priority = $obj->priority; $this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
@ -1130,18 +1135,18 @@ class ActionComm extends CommonObject
$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
$sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated
$sql .= ", note = '".$this->db->escape($this->note_private)."'"; $sql .= ", note = '".$this->db->escape($this->note_private)."'";
$sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", fk_project =".($this->fk_project > 0 ? ((int) $this->fk_project) : "null");
$sql .= ", fk_soc =".($socid > 0 ? $socid : "null"); $sql .= ", fk_soc =".($socid > 0 ? ((int) $socid) : "null");
$sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null"); $sql .= ", fk_contact =".($contactid > 0 ? ((int) $contactid) : "null");
$sql .= ", priority = '".$this->db->escape($this->priority)."'"; $sql .= ", priority = '".$this->db->escape($this->priority)."'";
$sql .= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'"; $sql .= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'";
$sql .= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'" : "null"); $sql .= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'" : "null");
$sql .= ", transparency = '".$this->db->escape($this->transparency)."'"; $sql .= ", transparency = '".$this->db->escape($this->transparency)."'";
$sql .= ", fk_user_mod = ".$user->id; $sql .= ", fk_user_mod = ".((int) $user->id);
$sql .= ", fk_user_action = ".($userownerid > 0 ? "'".$this->db->escape($userownerid)."'" : "null"); $sql .= ", fk_user_action = ".($userownerid > 0 ? ((int) $userownerid) : "null");
$sql .= ", fk_user_done = ".($userdoneid > 0 ? "'".$this->db->escape($userdoneid)."'" : "null"); $sql .= ", fk_user_done = ".($userdoneid > 0 ? ((int) $userdoneid) : "null");
if (!empty($this->fk_element)) { if (!empty($this->fk_element)) {
$sql .= ", fk_element=".($this->fk_element ? $this->db->escape($this->fk_element) : "null"); $sql .= ", fk_element=".($this->fk_element ? ((int) $this->fk_element) : "null");
} }
if (!empty($this->elementtype)) { if (!empty($this->elementtype)) {
$sql .= ", elementtype=".($this->elementtype ? "'".$this->db->escape($this->elementtype)."'" : "null"); $sql .= ", elementtype=".($this->elementtype ? "'".$this->db->escape($this->elementtype)."'" : "null");
@ -1439,9 +1444,9 @@ class ActionComm extends CommonObject
/** /**
* Return label of status * Return the label of the status
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable" * @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @return string String with status * @return string String with status
*/ */
@ -1628,36 +1633,34 @@ class ActionComm extends CommonObject
} }
if ($withpicto == 2) { if ($withpicto == 2) {
$libelle = $label;
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
$libelle = $labeltype; $label = $labeltype;
} }
$libelleshort = ''; $labelshort = '';
} else { } else {
$libelle = (empty($this->libelle) ? $label : $this->libelle.(($label && $label != $this->libelle) ? ' '.$label : '')); if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($label)) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) { $label = $labeltype;
$libelle = $labeltype;
} }
if ($maxlength < 0) { if ($maxlength < 0) {
$libelleshort = $this->ref; $labelshort = $this->ref;
} else { } else {
$libelleshort = dol_trunc($libelle, $maxlength); $labelshort = dol_trunc($label, $maxlength);
} }
} }
if ($withpicto) { if ($withpicto) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { // Add code into () if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { // Add code into ()
if ($labeltype) { if ($labeltype) {
$libelle .= (preg_match('/'.preg_quote($labeltype, '/').'/', $libelle) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')'); $label .= (preg_match('/'.preg_quote($labeltype, '/').'/', $label) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')');
} }
} }
} }
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { if ($withpicto) {
$result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$libelle), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); $result .= img_object(($notooltip ? '' : $langs->trans("ShowAction").': '.$label), ($overwritepicto ? $overwritepicto : 'action'), (($this->type_color && $overwritepicto) ? 'style="color: #'.$this->type_color.' !important;" ' : '').($notooltip ? 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"' : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
} }
$result .= $libelleshort; $result .= $labelshort;
$result .= $linkend; $result .= $linkend;
global $action; global $action;

View File

@ -205,9 +205,9 @@ class ActionCommReminder extends CommonObject
} }
/** /**
* Retourne le libelle du status d'un user (actif, inactif) * Return label of the status of a reminder
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)

View File

@ -145,7 +145,7 @@ class CActionComm
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter) * @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
* @param string $idorcode 'id' or 'code' or 'all' * @param string $idorcode 'id' or 'code' or 'all'
* @param string $excludetype Type to exclude ('system' or 'systemauto') * @param string $excludetype Type to exclude ('system' or 'systemauto')
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...) * @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1 or -2=Keep details and add a combined line per calendar (Default, Auto, BoothConf, ...)
* @param string $morefilter Add more SQL filter * @param string $morefilter Add more SQL filter
* @param int $shortlabel 1=Get short label instead of long label * @param int $shortlabel 1=Get short label instead of long label
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
@ -241,7 +241,7 @@ class CActionComm
$transcode = $langs->trans($keyfortrans); $transcode = $langs->trans($keyfortrans);
} }
$label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label)); $label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label));
if ($onlyautoornot == -1 && !empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if (($onlyautoornot == -1 || $onlyautoornot == -2) && !empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($typecalendar == 'system') { if ($typecalendar == 'system') {
$label = '&nbsp;&nbsp; '.$label; $label = '&nbsp;&nbsp; '.$label;
$repid[-99] = $langs->trans("ActionAC_MANUAL"); $repid[-99] = $langs->trans("ActionAC_MANUAL");

View File

@ -64,8 +64,8 @@ if ($id > 0) {
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -61,8 +61,8 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
$newparam = ''; $newparam = '';
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -107,10 +107,10 @@ $year = GETPOST("year", "int") ?GETPOST("year", "int") : date("Y");
$month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m"); $month = GETPOST("month", "int") ?GETPOST("month", "int") : date("m");
$week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W"); $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d"); $day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ?GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3); $pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOST("search_status", 'aZ09') ?GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo' $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOST("search_type", 'aZ09') ?GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); $type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = (isset($_GET["maxprint"]) ?GETPOST("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int')); $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@ -570,7 +570,7 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
$s .= 'console.log("found parent div.dayevent with id = "+newval);'."\n"; $s .= 'console.log("found parent div.dayevent with id = "+newval);'."\n";
$s .= 'var frm=jQuery("#searchFormList");'."\n"; $s .= 'var frm=jQuery("#searchFormList");'."\n";
$s .= 'var newurl = ui.item.find("a.cal_event").attr("href");'."\n"; $s .= 'var newurl = ui.item.find("a.cal_event").attr("href");'."\n";
$s .= 'console.log(newurl);'."\n"; $s .= 'console.log("Found url on href of a.cal_event"+newurl+", we submit form with actionmove=mupdate");'."\n";
$s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'."\n"; $s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'."\n";
$s .= '});'."\n"; $s .= '});'."\n";
} }
@ -837,7 +837,7 @@ if ($resql) {
$event->fk_project = $obj->fk_project; $event->fk_project = $obj->fk_project;
$event->thirdparty_id = $obj->fk_soc; $event->socid = $obj->fk_soc;
$event->contact_id = $obj->fk_contact; $event->contact_id = $obj->fk_contact;
// Defined date_start_in_calendar and date_end_in_calendar property // Defined date_start_in_calendar and date_end_in_calendar property
@ -848,10 +848,6 @@ if ($resql) {
} else { } else {
$event->date_end_in_calendar = $event->datep; $event->date_end_in_calendar = $event->datep;
} }
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
$event->ponctuel = 1;
}
// Check values // Check values
if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
@ -945,7 +941,6 @@ if ($showbirthday) {
$event->date_start_in_calendar = $db->jdate($event->datep); $event->date_start_in_calendar = $db->jdate($event->datep);
$event->date_end_in_calendar = $db->jdate($event->datef); $event->date_end_in_calendar = $db->jdate($event->datef);
$event->ponctuel = 0;
// Add an entry in eventarray for each day // Add an entry in eventarray for each day
$daycursor = $event->datep; $daycursor = $event->datep;
@ -1288,12 +1283,6 @@ if (count($listofextcals)) {
$event->date_end_in_calendar = $event->datep; $event->date_end_in_calendar = $event->datep;
} }
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
$event->ponctuel = 1;
//print 'x'.$datestart.'-'.$dateend;exit;
}
// Add event into $eventarray if date range are ok. // Add event into $eventarray if date range are ok.
if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) { if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
//print 'x'.$datestart.'-'.$dateend;exit; //print 'x'.$datestart.'-'.$dateend;exit;
@ -1393,7 +1382,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
print '</div>'; print '</div>';
print '<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">'; print '<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">'; print '<table class="centpercent noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">'; print ' <tr class="liste_titre">';
// Column title of weeks numbers // Column title of weeks numbers
echo ' <td class="center">#</td>'; echo ' <td class="center">#</td>';
@ -1482,7 +1471,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
print '</div>'; print '</div>';
print '<input type="hidden" name="actionmove" value="mupdate">'; print '<input type="hidden" name="actionmove" value="mupdate">';
print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">'; print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?mode=show_month&'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">';
print '<input type="hidden" name="newdate" id="newdate">'; print '<input type="hidden" name="newdate" id="newdate">';
} elseif ($mode == 'show_week') { } elseif ($mode == 'show_week') {
// View by week // View by week
@ -1502,7 +1491,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
print '</div></div>'; print '</div></div>';
print '<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">'; print '<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">'; print '<table class="centpercent noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">'; print ' <tr class="liste_titre">';
$i = 0; $i = 0;
while ($i < 7) { while ($i < 7) {
@ -1544,10 +1533,9 @@ if (empty($mode) || $mode == 'show_month') { // View by month
print '</div>'; print '</div>';
echo '<input type="hidden" name="actionmove" value="mupdate">'; echo '<input type="hidden" name="actionmove" value="mupdate">';
echo '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">'; echo '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER['PHP_SELF']).'?mode=show_week&'.dol_escape_htmltag($_SERVER['QUERY_STRING']).'">';
echo '<input type="hidden" name="newdate" id="newdate">'; echo '<input type="hidden" name="newdate" id="newdate">';
} else // View by day } else { // View by day
{
$newparam = $param; // newparam is for birthday links $newparam = $param; // newparam is for birthday links
$newparam = preg_replace('/mode=show_month&?/i', '', $newparam); $newparam = preg_replace('/mode=show_month&?/i', '', $newparam);
$newparam = preg_replace('/mode=show_week&?/i', '', $newparam); $newparam = preg_replace('/mode=show_week&?/i', '', $newparam);
@ -1965,7 +1953,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($event->type_code != 'ICALEVENT') { if ($event->type_code != 'ICALEVENT') {
$savlabel = $event->label ? $event->label : $event->libelle; $savlabel = $event->label ? $event->label : $event->libelle;
$event->label = $titletoshow; $event->label = $titletoshow;
$event->libelle = $titletoshow; $event->libelle = $titletoshow; // deprecatd
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0); $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0);
@ -1997,7 +1985,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')'; print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
} }
$thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0)); $thirdparty_id = ($event->socid > 0 ? $event->socid : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0));
$contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0)); $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0));
// If action related to company / contact // If action related to company / contact

View File

@ -110,8 +110,8 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters // If $page is not defined, or '' or -1 or if we click on clear filters
@ -881,6 +881,8 @@ while ($i < min($num, $limit)) {
$actionstatic->label = $obj->label; $actionstatic->label = $obj->label;
$actionstatic->location = $obj->location; $actionstatic->location = $obj->location;
$actionstatic->note_private = dol_htmlentitiesbr($obj->note); $actionstatic->note_private = dol_htmlentitiesbr($obj->note);
$actionstatic->datep = $db->jdate($obj->dp);
$actionstatic->percentage = $obj->percent;
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
// but only if we need it // but only if we need it
@ -953,16 +955,7 @@ while ($i < min($num, $limit)) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser');
$late = 0; $late = 0;
if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) { if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) {
$late = 1;
}
if ($obj->percent == 0 && !$obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) {
$late = 1;
}
if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) {
$late = 1;
}
if ($obj->percent > 0 && $obj->percent < 100 && !$obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) {
$late = 1; $late = 1;
} }
if ($late) { if ($late) {

View File

@ -57,8 +57,8 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
$filtert = $user->id; $filtert = $user->id;
} }
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -683,10 +683,6 @@ if ($resql) {
$event->date_end_in_calendar = $datep; $event->date_end_in_calendar = $datep;
} }
} }
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
$event->ponctuel = 1;
}
// Check values // Check values
if ($event->date_end_in_calendar < $firstdaytoshow || if ($event->date_end_in_calendar < $firstdaytoshow ||
@ -1236,9 +1232,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
$color2 = '222222'; $color2 = '222222';
} }
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
print '<tr><td '.($color1 ? 'style="background: #'.$color1.';"' : '').'class="'.($style1 ? $style1.' ' : '').'onclickopenref'.($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>'; print '<tr><td '.($color1 ? 'style="background: #'.$color1.';"' : '').'class="'.($style1 ? $style1.' ' : '').'onclickopenref center'.($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>';
print $string1; print $string1;
print '</td><td '.($color2 ? 'style="background: #'.$color2.';"' : '').'class="'.($style2 ? $style2.' ' : '').'onclickopenref'.($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>'; print '</td><td '.($color2 ? 'style="background: #'.$color2.';"' : '').'class="'.($style2 ? $style2.' ' : '').'onclickopenref center'.($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>';
print $string2; print $string2;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -58,8 +58,8 @@ $showbirthday = 0;
$filtert = $user->id; $filtert = $user->id;
}*/ }*/
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -711,10 +711,6 @@ if ($resql) {
$event->date_end_in_calendar = $datep; $event->date_end_in_calendar = $datep;
} }
} }
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar) {
$event->ponctuel = 1;
}
// Check values // Check values
if ($event->date_end_in_calendar < $firstdaytoshow || if ($event->date_end_in_calendar < $firstdaytoshow ||
@ -1441,7 +1437,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} }
print 'class="'; print 'class="';
print ($style1 ? $style1.' ' : ''); print ($style1 ? $style1.' ' : '');
print 'onclickopenref'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>'; print 'onclickopenref center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"'.($title1 ? ' title="'.$title1.'"' : '').'>';
print $string1; print $string1;
print '</td><td '; print '</td><td ';
if ($style2 == 'peruser_notbusy') { if ($style2 == 'peruser_notbusy') {
@ -1451,7 +1447,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} }
print 'class="'; print 'class="';
print ($style2 ? $style2.' ' : ''); print ($style2 ? $style2.' ' : '');
print 'onclickopenref'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>'; print 'onclickopenref center'.($title2 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'" ref="ref_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids2 ? $ids2 : 'none').'"'.($title2 ? ' title="'.$title2.'"' : '').'>';
print $string2; print $string2;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@ -40,8 +40,8 @@ $year = GETPOST('year', 'int');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
// If $page is not defined, or '' or -1 or if we click on clear filters // If $page is not defined, or '' or -1 or if we click on clear filters
@ -163,7 +163,7 @@ if ($resql) {
// Button to build doc // Button to build doc
print '<td class="center">'; print '<td class="center">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=builddoc&page='.((int) $page).'&month='.((int) $obj->month).'&year='.((int) $obj->year).'">'.img_picto($langs->trans('BuildDoc'), 'filenew').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=builddoc&token='.newToken().'&page='.((int) $page).'&month='.((int) $obj->month).'&year='.((int) $obj->year).'">'.img_picto($langs->trans('BuildDoc'), 'filenew').'</a>';
print '</td>'; print '</td>';
$name = "actions-".$obj->month."-".$obj->year.".pdf"; $name = "actions-".$obj->month."-".$obj->year.".pdf";

View File

@ -93,8 +93,8 @@ $action = GETPOST('action', 'aZ09');
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -157,10 +157,10 @@ if ($resql) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"), "contact"); print '<td><a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"), "contact");
print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->name.'</a></td>'; print '</a>&nbsp;<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.$obj->name.'</a></td>';
print "<td>$obj->firstname</TD>"; print '<td>'.dol_escape_htmltag($obj->firstname).'</td>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"), "company").'</a>&nbsp;'; print '<td><a href="'.$_SERVER["PHP_SELF"].'?type='.$type.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"), "company").'</a>&nbsp;';
print "<a href=\"".$urlfiche."?socid=".$obj->rowid."\">$obj->name</a></td>\n"; print '<a href="'.$urlfiche."?socid=".$obj->rowid.'">'.$obj->name."</a></td>\n";
print '<td>'.dol_print_phone($obj->email, $obj->cidp, $obj->rowid, 'AC_EMAIL').'</td>'; print '<td>'.dol_print_phone($obj->email, $obj->cidp, $obj->rowid, 'AC_EMAIL').'</td>';

View File

@ -171,6 +171,7 @@ if (empty($reshook)) {
dol_print_error($db); dol_print_error($db);
} }
$thirdpartystatic = new Societe($db);
// Loop on each email and send it // Loop on each email and send it
$i = 0; $i = 0;
@ -200,6 +201,15 @@ if (empty($reshook)) {
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$substitutionarray['__ID__'] = $obj->source_id; $substitutionarray['__ID__'] = $obj->source_id;
if ($obj->source_type == "thirdparty") {
$result = $thirdpartystatic->fetch($obj->source_id);
if ($result > 0) {
$substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client;
} else {
$substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = '';
}
}
$substitutionarray['__EMAIL__'] = $obj->email; $substitutionarray['__EMAIL__'] = $obj->email;
$substitutionarray['__LASTNAME__'] = $obj->lastname; $substitutionarray['__LASTNAME__'] = $obj->lastname;
$substitutionarray['__FIRSTNAME__'] = $obj->firstname; $substitutionarray['__FIRSTNAME__'] = $obj->firstname;
@ -483,9 +493,9 @@ if (empty($reshook)) {
if ($action == 'add') { if ($action == 'add') {
$mesgs = array(); $mesgs = array();
$object->email_from = (string) GETPOST("from", "none"); // Must allow 'name <email>' $object->email_from = (string) GETPOST("from", 'alphawithlgt'); // Must allow 'name <email>'
$object->email_replyto = (string) GETPOST("replyto", "none"); // Must allow 'name <email>' $object->email_replyto = (string) GETPOST("replyto", 'alphawithlgt'); // Must allow 'name <email>'
$object->email_errorsto = (string) GETPOST("errorsto", "none"); // Must allow 'name <email>' $object->email_errorsto = (string) GETPOST("errorsto", 'alphawithlgt'); // Must allow 'name <email>'
$object->title = (string) GETPOST("title"); $object->title = (string) GETPOST("title");
$object->sujet = (string) GETPOST("sujet"); $object->sujet = (string) GETPOST("sujet");
$object->body = (string) GETPOST("bodyemail", 'restricthtml'); $object->body = (string) GETPOST("bodyemail", 'restricthtml');
@ -521,11 +531,11 @@ if (empty($reshook)) {
if ($action == 'settitle') { if ($action == 'settitle') {
$object->title = trim(GETPOST('title', 'alpha')); $object->title = trim(GETPOST('title', 'alpha'));
} elseif ($action == 'setemail_from') { } elseif ($action == 'setemail_from') {
$object->email_from = trim(GETPOST('email_from', 'none')); // Must allow 'name <email>' $object->email_from = trim(GETPOST('email_from', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_replyto') { } elseif ($action == 'setemail_replyto') {
$object->email_replyto = trim(GETPOST('email_replyto', 'none')); // Must allow 'name <email>' $object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_errorsto') { } elseif ($action == 'setemail_errorsto') {
$object->email_errorsto = trim(GETPOST('email_errorsto', 'none')); // Must allow 'name <email>' $object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'settitle' && empty($object->title)) { } elseif ($action == 'settitle' && empty($object->title)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) { } elseif ($action == 'setfrom' && empty($object->email_from)) {

View File

@ -230,7 +230,7 @@ class FormAdvTargetEmailing extends Form
$InfoFieldList = explode(":", $param_list [0]); $InfoFieldList = explode(":", $param_list [0]);
// 0 1 : tableName // 0 1 : tableName
// 1 2 : label field name Nom du champ contenant le libelle // 1 2 : label field name Name of field that contains the label
// 2 3 : key fields name (if differ of rowid) // 2 3 : key fields name (if differ of rowid)
// 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value // 3 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value
@ -304,7 +304,7 @@ class FormAdvTargetEmailing extends Form
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut // If a translation exists, we use it, else we use the default label
$label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : '')); $label = ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->civilite != '-' ? $obj->civilite : ''));
$options_array[$obj->code] = $label; $options_array[$obj->code] = $label;

View File

@ -754,7 +754,7 @@ class Mailing extends CommonObject
/** /**
* Return label of status of emailing (draft, validated, ...) * Return label of status of emailing (draft, validated, ...)
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @return string Label * @return string Label
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
@ -764,10 +764,10 @@ class Mailing extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Return the label of a given status
* *
* @param int $status Id status * @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @return string Label * @return string Label
*/ */
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
@ -792,11 +792,11 @@ class Mailing extends CommonObject
/** /**
* Renvoi le libelle d'un statut donne * Return the label of a given status of a recipient
* TODO Add class mailin_target.class.php * TODO Add class mailin_target.class.php
* *
* @param int $status Id status * @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param string $desc Desc error * @param string $desc Desc error
* @return string Label * @return string Label
*/ */

View File

@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("mails"); $langs->load("mails");
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');

View File

@ -53,8 +53,8 @@ $result = restrictedArea($user, 'propal', $id);
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -130,8 +130,8 @@ $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) {
$page = 0; $page = 0;

View File

@ -77,7 +77,7 @@ if (!empty($conf->propal->enabled)) {
* *
*/ */
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id"; $sql = "SELECT count(*) as cc, st.libelle as stcomm, st.picto, st.id";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st "; $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
if (empty($user->rights->societe->client->voir) && !$socid) { if (empty($user->rights->societe->client->voir) && !$socid) {

View File

@ -210,6 +210,8 @@ if (empty($reshook)) {
// Remove a product line // Remove a product line
$result = $object->deleteline($user, $lineid); $result = $object->deleteline($user, $lineid);
if ($result > 0) { if ($result > 0) {
// reorder lines
$object->line_order(true);
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';

View File

@ -261,6 +261,11 @@ class Commande extends CommonOrder
//! key of pos source ('0', '1', ...) //! key of pos source ('0', '1', ...)
public $pos_source; public $pos_source;
/**
* @var array Array with line of all shipments
*/
public $expeditions;
/** /**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@ -490,7 +495,8 @@ class Commande extends CommonOrder
$sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " fk_statut = ".self::STATUS_VALIDATED.","; $sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($now)."',"; $sql .= " date_valid='".$this->db->idate($now)."',";
$sql .= " fk_user_valid = ".((int) $user->id); $sql .= " fk_user_valid = ".((int) $user->id).",";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::valid", LOG_DEBUG); dol_syslog(get_class($this)."::valid", LOG_DEBUG);
@ -620,7 +626,8 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql .= " SET fk_statut = ".self::STATUS_DRAFT; $sql .= " SET fk_statut = ".self::STATUS_DRAFT."',";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
@ -694,7 +701,8 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0'; $sql .= ' SET fk_statut='.self::STATUS_VALIDATED.', facture=0,';
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG); dol_syslog(get_class($this)."::set_reopen", LOG_DEBUG);
@ -755,7 +763,8 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET fk_statut = '.self::STATUS_CLOSED.','; $sql .= ' SET fk_statut = '.self::STATUS_CLOSED.',';
$sql .= ' fk_user_cloture = '.((int) $user->id).','; $sql .= ' fk_user_cloture = '.((int) $user->id).',';
$sql .= " date_cloture = '".$this->db->idate($now)."'"; $sql .= " date_cloture = '".$this->db->idate($now)."',";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > '.self::STATUS_DRAFT; $sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > '.self::STATUS_DRAFT;
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
@ -803,7 +812,8 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande";
$sql .= " SET fk_statut = ".self::STATUS_CANCELED; $sql .= " SET fk_statut = ".self::STATUS_CANCELED.",";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND fk_statut = ".self::STATUS_VALIDATED; $sql .= " AND fk_statut = ".self::STATUS_VALIDATED;
@ -1779,7 +1789,7 @@ class Commande extends CommonOrder
return -1; return -1;
} }
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_user_modif, c.fk_statut';
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql .= ', c.fk_account'; $sql .= ', c.fk_account';
$sql .= ', c.date_commande, c.date_valid, c.tms'; $sql .= ', c.date_commande, c.date_valid, c.tms';
@ -1844,6 +1854,7 @@ class Commande extends CommonOrder
$this->user_author_id = $obj->fk_user_author; $this->user_author_id = $obj->fk_user_author;
$this->user_valid = $obj->fk_user_valid; $this->user_valid = $obj->fk_user_valid;
$this->user_modification = $obj->fk_user_modif;
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva; $this->total_tva = $obj->total_tva;
$this->total_localtax1 = $obj->total_localtax1; $this->total_localtax1 = $obj->total_localtax1;
@ -2004,9 +2015,9 @@ class Commande extends CommonOrder
/** /**
* Load array lines * Load array lines
* *
* @param int $only_product Return only physical products, not services * @param int $only_product Return only physical products, not services
* @param int $loadalsotranslation Return translation for products * @param int $loadalsotranslation Return translation for products
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetch_lines($only_product = 0, $loadalsotranslation = 0) public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
{ {
@ -2201,9 +2212,10 @@ class Commande extends CommonOrder
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
* *
* @param int $filtre_statut Filter on shipment status * @param int $filtre_statut Filter on shipment status
* @param int $fk_product Add a filter on a product
* @return int <0 if KO, Nb of lines found if OK * @return int <0 if KO, Nb of lines found if OK
*/ */
public function loadExpeditions($filtre_statut = -1) public function loadExpeditions($filtre_statut = -1, $fk_product = 0)
{ {
$this->expeditions = array(); $this->expeditions = array();

View File

@ -46,8 +46,8 @@ if (!$user->rights->facture->creer) {
$langs->loadLangs(array("companies", "orders")); $langs->loadLangs(array("companies", "orders"));
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -46,8 +46,8 @@ $ref = GETPOST('ref');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -116,8 +116,8 @@ $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/ma
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$page = 0; $page = 0;
@ -1854,10 +1854,13 @@ if ($resql) {
print '<td class="center">'; print '<td class="center">';
if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) { if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) {
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) { if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
$generic_commande->getLinesArray(); // This set ->lines $generic_commande->getLinesArray(); // Load array ->lines
$generic_commande->loadExpeditions(); // Load array ->expeditions
$numlines = count($generic_commande->lines); // Loop on each line of order $numlines = count($generic_commande->lines); // Loop on each line of order
for ($lig = 0; $lig < $numlines; $lig++) { for ($lig = 0; $lig < $numlines; $lig++) {
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
$nbprod++; // order contains real products $nbprod++; // order contains real products
$generic_product->id = $generic_commande->lines[$lig]->fk_product; $generic_product->id = $generic_commande->lines[$lig]->fk_product;
@ -1872,15 +1875,15 @@ if ($resql) {
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
} }
if ($reliquat > $generic_product->stock_reel) {
$notshippable++;
}
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case. if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25); $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>'; $text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>'; $text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
$text_info .= '<br>'; $text_info .= '<br>';
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
$notshippable++;
}
} else { // BUGGED CODE. } else { // BUGGED CODE.
// DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
// COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
@ -1908,32 +1911,31 @@ if ($resql) {
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
} }
} }
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 25); $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.'&nbsp;'.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
$text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
$warning++; $warning++;
$text_warning .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_warning .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} }
if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) { if ($reliquat > $generic_product->stock_reel) {
$notshippable++;
$text_info .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_info .= '<span class="warning">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} else { } else {
$text_info .= '<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>'; $text_info .= '<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
} }
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) { if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$text_info .= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier.'<br>'; $text_info .= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier;
} else {
$text_info .= '<br>';
} }
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
$text_info .= '<br>';
} }
} }
} }
if ($notshippable == 0) { if ($notshippable == 0) {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
$text_info = $langs->trans('Shippable').'<br>'.$text_info; $text_info = $text_icon.' '.$langs->trans('Shippable').'<br>'.$text_info;
} else { } else {
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft'); $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
$text_info = $langs->trans('NonShippable').'<br>'.$text_info; $text_info = $text_icon.' '.$langs->trans('NonShippable').'<br>'.$text_info;
} }
} }

View File

@ -53,8 +53,8 @@ if ($user->socid) {
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -107,8 +107,8 @@ if (empty($dateop)) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$pageplusone = GETPOST("pageplusone", 'int'); $pageplusone = GETPOST("pageplusone", 'int');
if ($pageplusone) { if ($pageplusone) {
@ -1102,8 +1102,7 @@ if ($resql) {
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1); print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1);
print '</td>'; print '</td>';
} }
print '<td class="liste_titre" align="middle">'; // Actions and select
print '</td>';
print '<td class="liste_titre" align="middle">'; print '<td class="liste_titre" align="middle">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto; print $searchpicto;
@ -1160,7 +1159,7 @@ if ($resql) {
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'class="right"', $sortfield, $sortorder, 'maxwidthsearch '); // Actions and select
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -1279,7 +1278,7 @@ if ($resql) {
</script>'; </script>';
print '</td>'; print '</td>';
} }
print '<td colspan="'.($tmpnbfieldafterbalance + 2).'">'; print '<td colspan="'.($tmpnbfieldafterbalance + 1).'">';
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1664,7 +1663,7 @@ if ($resql) {
} }
} }
// Action edit/delete // Action edit/delete and select
print '<td class="nowraponall" align="center">'; print '<td class="nowraponall" align="center">';
// Transaction reconciliated or edit link // Transaction reconciliated or edit link
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
@ -1692,19 +1691,14 @@ if ($resql) {
print '</a>'; print '</a>';
} }
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
// Action column // 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) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0; $selected = 0;
if (in_array($obj->rowid, $arrayofselected)) { if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1; $selected = 1;
} }
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$obj->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>'; print '</td>';
if (!$i) { if (!$i) {

View File

@ -1060,19 +1060,19 @@ if ($action == 'create') {
// IBAN // IBAN
print '<tr><td>'.$langs->trans($ibankey).'</td>'; print '<tr><td>'.$langs->trans($ibankey).'</td>';
print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.$object->iban.'"></td></tr>'; print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET('iban') ? GETPOST('iban', 'alphanohtml') : $object->iban).'"></td></tr>';
print '<tr><td>'.$langs->trans($bickey).'</td>'; print '<tr><td>'.$langs->trans($bickey).'</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>'; print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET('bic') ? GETPOST('bic', 'alphanohtml') : $object->bic).'"></td></tr>';
if ($conf->prelevement->enabled) { if ($conf->prelevement->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')</td>'; print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("StandingOrder").')</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alpha') : $object->ics).'"></td></tr>'; print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET('ics') ? GETPOST('ics', 'alphanohtml') : $object->ics).'"></td></tr>';
} }
if ($conf->paymentbybanktransfer->enabled) { if ($conf->paymentbybanktransfer->enabled) {
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>'; print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alpha') : $object->ics_transfer).'"></td></tr>'; print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alphanohtml') : $object->ics_transfer).'"></td></tr>';
} }
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>'; print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';

View File

@ -50,8 +50,8 @@ if ($user->socid) {
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -79,8 +79,8 @@ if (!$allowed) {
$diroutputmassaction = $conf->bank->dir_output.'/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->bank->dir_output.'/temp/massgeneration/'.$user->id;
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -78,8 +78,8 @@ if ($user->rights->banque->consolidate && $action == 'dvprev' && !empty($dvid))
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$pageplusone = GETPOST("pageplusone", 'int'); $pageplusone = GETPOST("pageplusone", 'int');
if ($pageplusone) { if ($pageplusone) {

View File

@ -77,8 +77,8 @@ if (empty($search_datev_end)) {
$search_datev_end = GETPOST("search_datev_end", 'int'); $search_datev_end = GETPOST("search_datev_end", 'int');
} }
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -46,8 +46,8 @@ $smonth = (GETPOSTISSET('closemonth') ?GETPOST('closemonth', 'int') : dol_print_
$sday = (GETPOSTISSET('closeday') ?GETPOST('closeday', 'int') : dol_print_date($now, "%d")); $sday = (GETPOSTISSET('closeday') ?GETPOST('closeday', 'int') : dol_print_date($now, "%d"));
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -62,8 +62,8 @@ if (!$year) {
$search_account = GETPOST('search_account', 'int'); $search_account = GETPOST('search_account', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -45,8 +45,8 @@ $langs->load("companies");
$mode = GETPOST("mode"); $mode = GETPOST("mode");
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -38,8 +38,8 @@ if ($user->socid) {
$result = restrictedArea($user, 'deplacement', '', ''); $result = restrictedArea($user, 'deplacement', '', '');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -45,8 +45,8 @@ $search_ref = GETPOST('search_ref', 'int');
$search_name = GETPOST('search_name', 'alpha'); $search_name = GETPOST('search_name', 'alpha');
$search_company = GETPOST('search_company', 'alpha'); $search_company = GETPOST('search_company', 'alpha');
// $search_amount=GETPOST('search_amount','alpha'); // $search_amount=GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {

View File

@ -71,8 +71,8 @@ $year_date_when = GETPOST('year_date_when');
$month_date_when = GETPOST('month_date_when'); $month_date_when = GETPOST('month_date_when');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -130,6 +130,7 @@ $usercanread = $user->rights->facture->lire;
$usercancreate = $user->rights->facture->creer; $usercancreate = $user->rights->facture->creer;
$usercanissuepayment = $user->rights->facture->paiement; $usercanissuepayment = $user->rights->facture->paiement;
$usercandelete = $user->rights->facture->supprimer; $usercandelete = $user->rights->facture->supprimer;
$usercancreatecontract = $user->rights->contrat->creer;
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send)));
$usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen))); $usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen)));
@ -264,6 +265,8 @@ if (empty($reshook)) {
$result = $object->deleteline(GETPOST('lineid', 'int')); $result = $object->deleteline(GETPOST('lineid', 'int'));
if ($result > 0) { if ($result > 0) {
// reorder lines
$object->line_order(true);
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
@ -2889,6 +2892,7 @@ if ($action == 'create') {
} }
$currency_code = $conf->currency; $currency_code = $conf->currency;
$fk_account = 0;
// Load objectsrc // Load objectsrc
$remise_absolue = 0; $remise_absolue = 0;
@ -3414,6 +3418,10 @@ if ($action == 'create') {
$optionsav .= '<option value="'.$key.'"'; $optionsav .= '<option value="'.$key.'"';
if ($key == GETPOST('fac_avoir')) { if ($key == GETPOST('fac_avoir')) {
$optionsav .= ' selected'; $optionsav .= ' selected';
// pre-filled extra fields with selected credit note
$newinvoice_static->fetch_optionals($key);
$object->array_options = $newinvoice_static->array_options;
} }
$optionsav .= '>'; $optionsav .= '>';
$optionsav .= $newinvoice_static->ref; $optionsav .= $newinvoice_static->ref;
@ -3619,7 +3627,7 @@ if ($action == 'create') {
// Bank Account // Bank Account
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">';
$fk_account = GETPOST('fk_account', 'int'); $fk_account = GETPOSTISSET('fk_account') ? GETPOST('fk_account', 'int') : $fk_account;
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -5375,6 +5383,17 @@ if ($action == 'create') {
} }
} }
// Create contract
if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) {
if ($conf->contrat->enabled && $object->statut == Facture::STATUS_VALIDATED) {
$langs->load("contracts");
if ($usercancreatecontract) {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a>';
}
}
}
// Validate // Validate
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if ($usercanvalidate) { if ($usercanvalidate) {

View File

@ -470,11 +470,23 @@ class FactureRec extends CommonInvoice
$error = 0; $error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
$sql .= " fk_soc = ".((int) $this->fk_soc); $sql .= " entity = ".((int) $this->entity).",";
$sql .= " titre = '".$this->db->escape($this->title)."',";
$sql .= " suspended = ".((int) $this->suspended).",";
$sql .= " fk_soc = ".((int) $this->socid).",";
$sql .= " total_tva = ".((float) $this->total_tva).",";
$sql .= " localtax1 = ".((float) $this->localtax1).",";
$sql .= " localtax2 = ".((float) $this->localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " remise_percent = ".((float) $this->remise_percent);
// TODO Add missing fields // TODO Add missing fields
$sql .= " WHERE rowid = ".((int) $this->id); $sql .= " WHERE rowid = ".((int) $this->id);
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if (!$error) { if (!$error) {
@ -498,7 +510,7 @@ class FactureRec extends CommonInvoice
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -2; return -1;
} }
} }
@ -531,9 +543,9 @@ class FactureRec extends CommonInvoice
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
if ($rowid) { if ($rowid) {
$sql .= ' AND f.rowid='.((int) $rowid); $sql .= ' AND f.rowid = '.((int) $rowid);
} elseif ($ref) { } elseif ($ref) {
$sql .= " AND f.titre='".$this->db->escape($ref)."'"; $sql .= " AND f.titre = '".$this->db->escape($ref)."'";
} else { } else {
$sql .= ' AND f.rowid = 0'; $sql .= ' AND f.rowid = 0';
} }
@ -2130,6 +2142,7 @@ class FactureLigneRec extends CommonInvoiceLine
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::updateline", LOG_DEBUG); dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if (!$error) { if (!$error) {

View File

@ -527,9 +527,9 @@ class Facture extends CommonInvoice
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI // Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project; $this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public; $this->note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private; $this->note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
$this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf; $this->model_pdf = GETPOSTISSET('model') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id; $this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id; $this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account; $this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
@ -4263,10 +4263,10 @@ class Facture extends CommonInvoice
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut, f.total_ht"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut, f.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
if (empty($user->rights->societe->client->voir) && !$user->socid) { if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id); $sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND"; $clause = " AND";
} }
@ -4304,6 +4304,7 @@ class Facture extends CommonInvoice
} }
} }
$this->db->free($resql);
return $response; return $response;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
@ -5688,22 +5689,25 @@ class FactureLigne extends CommonInvoiceLine
} }
/** /**
* Delete line in database * Delete line in database
* TODO Add param User $user and notrigger (see skeleton)
* *
* @return int <0 if KO, >0 if OK * @param User $tmpuser User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, >0 if OK
*/ */
public function delete() public function delete($tmpuser = null, $notrigger = false)
{ {
global $user; global $user;
$this->db->begin(); $this->db->begin();
// Call trigger // Call trigger
$result = $this->call_trigger('LINEBILL_DELETE', $user); if (empty($notrigger)) {
if ($result < 0) { $result = $this->call_trigger('LINEBILL_DELETE', $user);
$this->db->rollback(); if ($result < 0) {
return -1; $this->db->rollback();
return -1;
}
} }
// End call triggers // End call triggers
@ -5715,7 +5719,7 @@ class FactureLigne extends CommonInvoiceLine
} }
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->rowid); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {
$this->db->commit(); $this->db->commit();
return 1; return 1;

View File

@ -50,8 +50,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -96,8 +96,8 @@ $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha');
$search_status = GETPOST('search_status', 'int'); $search_status = GETPOST('search_status', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -147,8 +147,8 @@ if ($option == 'late') {
$filtre = GETPOST('filtre', 'alpha'); $filtre = GETPOST('filtre', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$page = 0; $page = 0;

View File

@ -48,7 +48,7 @@ $paymentnum = GETPOST('num_paiement', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$amounts = array(); $amounts = array();

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