Merge branch 'develop' into parentprojects
This commit is contained in:
commit
10dc8cbba6
289 changed files with 3433 additions and 1835 deletions
|
|
@ -107,9 +107,9 @@ install:
|
|||
- |
|
||||
echo "Update Composer version and Install tools - PHP Unit, Parallel Lint, PHP CodeSniffer, PHP Vardump check - for $TRAVIS_PHP_VERSION"
|
||||
echo "(version 2.5 is bugged and generate phpunit error Exception: Serialization of 'Closure' is not allowed)"
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^6 \
|
||||
composer -n require phpunit/phpunit ^7.5 \
|
||||
php-parallel-lint/php-parallel-lint ^1 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
|
|
@ -117,7 +117,7 @@ install:
|
|||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
||||
composer self-update 2.2.18
|
||||
composer -n require phpunit/phpunit ^7 \
|
||||
composer -n require phpunit/phpunit ^7.5 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
php-parallel-lint/php-var-dump-check ~0.4 \
|
||||
|
|
|
|||
71
ChangeLog
71
ChangeLog
|
|
@ -9,15 +9,16 @@ For uses:
|
|||
---------
|
||||
|
||||
NEW: PHP 8.2 compatibility (test not yet completed).
|
||||
NEW: #22740 Add OpenID Connect impl
|
||||
NEW: #23436 Group social networks fields
|
||||
NEW: Accountancy - Add specific page to export accounting data rather than the journals page
|
||||
NEW: Accountancy - Add sub-account balance FPC22
|
||||
NEW: Accountancy - Manage customer retained warranty FPC21+
|
||||
NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22
|
||||
NEW: Can upload a file with drag and drop on purchase invoice, vats, salaries and social contributions
|
||||
NEW: adapt category and product pictures sizes on takepos
|
||||
NEW: Add ability of ODT support to supplier invoices
|
||||
NEW: authentication mode: #22740 Add OpenID Connect impl
|
||||
NEW: authentication mode: Add experimental support for Google OAuth2 connexion
|
||||
NEW: adapt category and product pictures sizes on TakePOS
|
||||
NEW: Supplier Invoices: add ability of ODT support to supplier invoices
|
||||
NEW: Add a public virtual card page for each user
|
||||
NEW: Add a status on supplier price ref (WIP to close a supplier ref)
|
||||
NEW: Add a trigger when create a shipping line batch and fix propagate missing errors
|
||||
|
|
@ -31,7 +32,7 @@ NEW: Add Customer Order delivered (ORDER_NEW) in module Notification
|
|||
NEW: add customize CSS in admin/ihm settings
|
||||
NEW: Add date due and labels into customer comm card
|
||||
NEW: Add dropdown button actions (example on Create button on project)
|
||||
NEW: added an option to display the progress of tickets on the public interface
|
||||
NEW: Tickets: added an option to display the progress of tickets on the public interface
|
||||
NEW: Add field reply-to in email collector as possible filter
|
||||
NEW: Add filter on nb of generation done in list of recurring invoices
|
||||
NEW: Add filters and sort on product unit column
|
||||
|
|
@ -41,7 +42,7 @@ NEW: add link to thirdparty tickets history
|
|||
NEW: add margin in paiement/card.php
|
||||
NEW: Add mass action delete on VAT
|
||||
NEW: Add more zip, town, country for owner of a bank account
|
||||
NEW: add numbering modules for members
|
||||
NEW: Members: add numbering modules for members
|
||||
NEW: add option keepspace into dol_string_nospecialchar()
|
||||
NEW: Add origin info when create a product batch when created from a movement stock
|
||||
NEW: Add possibility to choose format #21426
|
||||
|
|
@ -61,15 +62,15 @@ NEW: Can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT
|
|||
NEW: Can add the add now link on date into addfieldvalue()
|
||||
NEW: Can bin accounting line for a given month
|
||||
NEW: Can edit account on miscellaneous payment (if not transfered)
|
||||
NEW: Can edit inline the vat number from supplier tab
|
||||
NEW: Can edit inline the VAT number from supplier tab
|
||||
NEW: Can fill date of salary payment with date of start of salary
|
||||
NEW: Can filter on a custom group of accounts. Perf or ledger list.
|
||||
NEW: Can go back to draft on shipment when stock change not on validate
|
||||
NEW: Can modify bank account of sepa payment (if file not sent yet)
|
||||
NEW: Can modify margin rates in offers like VAT rates.
|
||||
NEW: Can modify the date of payment of a salary (if not reconciled)
|
||||
NEW: Can now edit service name for oauth token
|
||||
NEW: Can receive more than qty ordered on reception
|
||||
NEW: Proposals: Can modify margin rates in offers like VAT rates.
|
||||
NEW: Salary: Can modify the date of payment of a salary (if not reconciled)
|
||||
NEW: OAuth: Can now edit service name for oauth token
|
||||
NEW: Reception: Can receive more than qty ordered on reception
|
||||
NEW: Can select several warehouses into the view stock at date in past
|
||||
NEW: Can select the export format during export of journals
|
||||
NEW: Can set a checkbox in formconfirm by clicking on the label
|
||||
|
|
@ -78,8 +79,8 @@ NEW: Can set flag default value on email templates
|
|||
NEW: Can set the page "List of opportunities" as landing page
|
||||
NEW: Can show the sql request used on emailing selection
|
||||
NEW: can stay on edit field when errors occurs
|
||||
NEW: Can test a geoip conversion from the geoip setup page
|
||||
NEW: Captcha for public member's subscription form
|
||||
NEW: GeoIP: Can test a geoip conversion from the geoip setup page
|
||||
NEW: Members: Captcha for public member's subscription form
|
||||
NEW: category of operation for crabe PDF model
|
||||
NEW: color for start date and owner
|
||||
NEW: comment in api_mymodule for seperate methods
|
||||
|
|
@ -92,24 +93,24 @@ NEW: Disable bad reputation product price
|
|||
NEW: dolExplodeIntoArray can accept regex
|
||||
NEW: dol_sort_array can sort on alphabetical order even if val is num
|
||||
NEW: don't have closed contact proposed as receiver for the mails
|
||||
NEW: Dynamic choice of warehouse and batch in MO production.
|
||||
NEW: MO: Dynamic choice of warehouse and batch in MO production.
|
||||
NEW: element time integration code + sql
|
||||
NEW: events list with color
|
||||
NEW: expend/collapse list of social networks
|
||||
NEW: filter for Signed+Billed in proposals
|
||||
NEW: Proposals: filter for Signed+Billed in proposals
|
||||
NEW: Filter on amount and qty on list of service's contracts
|
||||
NEW: filter on entity in import
|
||||
NEW: Import: filter on entity in import
|
||||
NEW: formconfirm can support field with format datetime
|
||||
NEW: getCommonSubstitutionArray to have more substitute keys
|
||||
NEW: helper functions for dates + small demo case
|
||||
NEW: hook printFieldListFrom in contact list
|
||||
NEW: inc.php: handle parameters from argv
|
||||
NEW: Increment website counter on each page access in website module
|
||||
NEW: Website Module: Increment website counter on each page access in website module
|
||||
NEW: Invalidate all sessions of a user when password is modified.
|
||||
NEW: Invoice - Show Category of operations
|
||||
NEW: Invoice - show category of operations
|
||||
NEW: iSuiteExpert export model
|
||||
NEW: Keep a link between user created from recruitment and application
|
||||
NEW: limit load products in takepos
|
||||
NEW: limit load products in TakePOS
|
||||
NEW: List product in orders
|
||||
NEW: Make it possible to select hours and minutes in form_confirm
|
||||
NEW: map table to element for get entity in import
|
||||
|
|
@ -134,7 +135,7 @@ NEW: Possibility to link to German pages in help
|
|||
NEW: presend mass action in contact list
|
||||
NEW: product images on popup are cached
|
||||
NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key
|
||||
NEW: Quadratus export with attachments in accountancy export
|
||||
NEW: Accountancy: Quadratus export with attachments in accountancy export
|
||||
NEW: referential objects of batch
|
||||
NEW: remove default percentage for event creation url
|
||||
NEW: remove keys whose table element is the same as element in map list
|
||||
|
|
@ -145,8 +146,8 @@ NEW: Send an email when ticket assigned
|
|||
NEW: Send a notification email when ticket assigned
|
||||
NEW: sepaStripe now creates the payment mode with type pm_ using new API
|
||||
NEW: set payment default values when supplier order created from reception
|
||||
NEW: set ticket status to answered if the client has answered from the public interface
|
||||
NEW: set today start time at begining
|
||||
NEW: Tickets: set ticket status to answered if the client has answered from the public interface
|
||||
NEW: set today start time at beginning
|
||||
NEW: Setup emailcollector easier. Can also use ! for negative search.
|
||||
NEW: Show counter of access of website in website list
|
||||
NEW: Show main currency in company info user tooltip
|
||||
|
|
@ -171,23 +172,29 @@ NEW: use more recent model by default
|
|||
NEW: VAT can be modified during add of line
|
||||
NEW: write all fields and their properties in asciidoc format
|
||||
NEW: Can add an array of several links in date selector
|
||||
NEW: Implement MAIN_ACTIVATE_FILECACHE on bithday widget
|
||||
NEW: Add widget "The next upcoming events"
|
||||
NEW: Add widget of open opportunities
|
||||
NEW: Add option PDF_SHOW_PHONE_AFTER_USER_CONTACT to show phone after specific assigned contact on PDF
|
||||
NEW: Add option PDF_SHOW_EMAIL_AFTER_USER_CONTACT to show email after specific assigned contact on PDF
|
||||
NEW: Widgets: Implement MAIN_ACTIVATE_FILECACHE on birthday widget
|
||||
NEW: Widgets: Add widget "The next upcoming events"
|
||||
NEW: Widgets: Add widget of open opportunities
|
||||
NEW: Use an ajax component to swith prospection status on thidparty list
|
||||
NEW: Comment on survey is possible only after vote.
|
||||
NEW: Add partial payment reason "withholding tax"
|
||||
|
||||
For developers or integrators:
|
||||
------------------------------
|
||||
|
||||
NEW: triggers on mailing
|
||||
NEW: add triggers on mailing
|
||||
NEW: add function for listiong objects from directory
|
||||
NEW: Add helplist property to describe fields of obects
|
||||
NEW: Add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
|
||||
NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0
|
||||
NEW: add helplist property to describe fields of objects
|
||||
NEW: add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign
|
||||
NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0, jquery, Stripe.
|
||||
NEW: Support contact in post() document API
|
||||
NEW: updating in modulbuilder on tab Menu when adding object
|
||||
NEW: Add/Edit permissions in ModuleBuilder
|
||||
NEW: Better generated documentation for modulebuilder
|
||||
NEW: Add sent info in the parameters provided to the hook sendMailAfter
|
||||
NEW: More APIs (update currency rate, upload of supplier documents, ...)
|
||||
NEW: ModuleBuilder: updating in modulbuilder on tab Menu when adding object
|
||||
NEW: ModuleBuilder: add/edit permissions
|
||||
NEW: ModuleBuilder: better generated documentation
|
||||
NEW: add sent info in the parameters provided to the hook sendMailAfter
|
||||
NEW: add setAsSelectUser into factory for generic setup page
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# How to use it ?
|
||||
|
||||
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||
This docker image intended for developpement usage.
|
||||
The docker-compose.yml file is a sample of a config file to use to build and run Dolibarr in the current workspace with Docker.
|
||||
This docker image is intended for developpement usage.
|
||||
For production usage you should consider other contributor reference like https://hub.docker.com/r/tuxgasy/dolibarr
|
||||
|
||||
Before build/run, define the variable HOST_USER_ID as following:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ services:
|
|||
mariadb:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_ROOT_PASSWORD: rootpassfordev
|
||||
MYSQL_DATABASE: dolibarr
|
||||
ports:
|
||||
- "3306:3306"
|
||||
|
|
|
|||
|
|
@ -24,17 +24,16 @@
|
|||
"vendor-dir" : "htdocs/includes"
|
||||
},
|
||||
"require" : {
|
||||
"php" : ">=5.6.0",
|
||||
"ext-curl" : "*",
|
||||
"php" : ">=7.1.0",
|
||||
"ckeditor/ckeditor" : "4.12.1",
|
||||
"mike42/escpos-php" : "2.2",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.39",
|
||||
"phpoffice/phpexcel" : "1.8.2",
|
||||
"mike42/escpos-php" : "3.0",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.41",
|
||||
"phpoffice/phpspreadsheet" : "1.12",
|
||||
"restler/framework" : "3.0.0-RC6",
|
||||
"tecnickcom/tcpdf" : "6.3.2",
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1",
|
||||
"maximebf/debugbar" : "1.15.1",
|
||||
"nnnick/chartjs" : "^3.7.1",
|
||||
"stripe/stripe-php" : "10.7.0",
|
||||
"maximebf/debugbar" : "1.18.2",
|
||||
"symfony/var-dumper" : "3.2"
|
||||
},
|
||||
"require-dev" : {
|
||||
|
|
@ -43,13 +42,12 @@
|
|||
"phpunit/phpunit" : "^4",
|
||||
"squizlabs/php_codesniffer" : "^2",
|
||||
"phpunit/phpunit-selenium" : "^2"
|
||||
"rector/rector" : "^0.16.0"
|
||||
},
|
||||
"suggest" : {
|
||||
"ext-mysqlnd" : "To use with MySQL or MariaDB",
|
||||
"ext-mysqli" : "To use with MySQL or MariaDB",
|
||||
"ext-pgsql" : "To use with PostgreSQL",
|
||||
"ext-mssql" : "To use with MSSQL (experimental)",
|
||||
"ext-pdo_sqlite" : "To use with SQLite (experimental)",
|
||||
"ext-gd" : "Image manipulation (Required but maybe built-in PHP)",
|
||||
"ext-imagick" : "Generation of thumbs from PDF",
|
||||
"ext-mcrypt" : "(Required but maybe built-in PHP)",
|
||||
|
|
|
|||
|
|
@ -692,6 +692,9 @@ class Lettering extends BookKeeping
|
|||
|
||||
// Clean parameters
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
//remove empty entries
|
||||
$document_ids = array_filter($document_ids);
|
||||
|
||||
$doc_type = trim($doc_type);
|
||||
|
||||
if (empty($document_ids)) {
|
||||
|
|
@ -742,10 +745,13 @@ class Lettering extends BookKeeping
|
|||
// Clean parameters
|
||||
$document_ids = is_array($document_ids) ? $document_ids : array();
|
||||
$doc_type = trim($doc_type);
|
||||
//remove empty entries
|
||||
$document_ids = array_filter($document_ids);
|
||||
|
||||
if (empty($document_ids)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (!is_array(self::$doc_type_infos[$doc_type])) {
|
||||
$langs->load('errors');
|
||||
$this->errors[] = $langs->trans('ErrorBadParameters');
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -805,12 +806,6 @@ if (!$error && $action == 'writebookkeeping') {
|
|||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,13 +437,8 @@ if ($action == 'writebookkeeping') {
|
|||
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
||||
$lettering_static = new Lettering($db);
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
|
|
@ -465,13 +465,6 @@ if ($action == 'writebookkeeping') {
|
|||
$lettering_static = new Lettering($db);
|
||||
|
||||
$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
|
||||
|
||||
if ($nb_lettering < 0) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
$errorforinvoice[$key] = 'other';
|
||||
setEventMessages($lettering_static->error, $lettering_static->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
|
|||
$tmparray = dol_getdate($datetouseforfilename);
|
||||
$fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||
// Define end of month to use
|
||||
if ($tmparray['mon'] <= $fiscalmonth) {
|
||||
$tmparray['mon'] = $fiscalmonth;
|
||||
if ($tmparray['mon'] < $fiscalmonth || $fiscalmonth == 1) {
|
||||
$tmparray['mon'] = $fiscalmonth == 1 ? 12 : $fiscalmonth - 1;
|
||||
} else {
|
||||
$tmparray['mon'] = $fiscalmonth;
|
||||
$tmparray['mon'] = $fiscalmonth - 1;
|
||||
$tmparray['year']++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2510,8 +2510,8 @@ class Adherent extends CommonObject
|
|||
$labelStatusShort = $langs->trans("MemberStatusNoSubscriptionShort");
|
||||
} elseif (!$date_end_subscription) {
|
||||
$statusType = 'status1';
|
||||
$labelStatus = $langs->trans("MemberStatusActive");
|
||||
$labelStatusShort = $langs->trans("MemberStatusActiveShort");
|
||||
$labelStatus = $langs->trans("WaitingSubscription");
|
||||
$labelStatusShort = $langs->trans("WaitingSubscriptionShort");
|
||||
} elseif ($date_end_subscription < dol_now()) { // expired
|
||||
$statusType = 'status8';
|
||||
$labelStatus = $langs->trans("MemberStatusActiveLate");
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2023 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -172,15 +173,87 @@ class AdherentStats extends Stats
|
|||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return count of member by status group by adh type, total and average
|
||||
*
|
||||
* @param int $numberYears Number of years to scan (0 = all)
|
||||
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type
|
||||
*/
|
||||
public function countMembersByTypeAndStatus($numberYears = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$now = dol_now();
|
||||
$endYear = date('Y');
|
||||
$startYear = $endYear - $numberYears;
|
||||
|
||||
$sql = "SELECT t.rowid as fk_adherent_type, t.libelle as label";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
|
||||
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON t.rowid = d.fk_adherent_type AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
if ($numberYears) {
|
||||
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
|
||||
}
|
||||
$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " AND t.statut = 1";
|
||||
$sql .= " GROUP BY t.rowid";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
$MembersCountArray = [];
|
||||
$totalstatus = array(
|
||||
'label' => 'Total',
|
||||
'members_draft' => 0,
|
||||
'members_pending' => 0,
|
||||
'members_uptodate' => 0,
|
||||
'members_expired' => 0,
|
||||
'members_excluded' => 0,
|
||||
'members_resiliated' => 0
|
||||
);
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MembersCountArray[$objp->fk_adherent_type] = array(
|
||||
'label' => $objp->label,
|
||||
'members_draft' => (int) $objp->members_draft,
|
||||
'members_pending' => (int) $objp->members_pending,
|
||||
'members_uptodate' => (int) $objp->members_uptodate,
|
||||
'members_expired' => (int) $objp->members_expired,
|
||||
'members_excluded' => (int) $objp->members_excluded,
|
||||
'members_resiliated' => (int) $objp->members_resiliated
|
||||
);
|
||||
$totalrow = 0;
|
||||
foreach ($MembersCountArray[$objp->fk_adherent_type] as $key=>$nb) {
|
||||
if ($key!='label') {
|
||||
$totalrow += $nb;
|
||||
$totalstatus[$key] += $nb;
|
||||
}
|
||||
}
|
||||
$MembersCountArray[$objp->fk_adherent_type]['total_adhtype'] = $totalrow;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$MembersCountArray['total'] = $totalstatus;
|
||||
$MembersCountArray['total']['all'] = array_sum($totalstatus);
|
||||
}
|
||||
return $MembersCountArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return count of member by status group by adh type, total and average
|
||||
*
|
||||
* @param int $numberYears Years to scan
|
||||
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
|
||||
* @param int $numberYears Number of years to scan (0 = all)
|
||||
* @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag
|
||||
*/
|
||||
public function countMembersByTagAndStatus($numberYears = 2)
|
||||
public function countMembersByTagAndStatus($numberYears = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
|
|
@ -202,9 +275,11 @@ class AdherentStats extends Stats
|
|||
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
|
||||
if ($numberYears) {
|
||||
$sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'";
|
||||
}
|
||||
$sql .= " AND c.fk_parent = 0";
|
||||
$sql .= " GROUP BY c.rowid";
|
||||
$sql .= " GROUP BY c.rowid ORDER BY label ASC";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -240,7 +315,7 @@ class AdherentStats extends Stats
|
|||
$totalstatus[$key] += $nb;
|
||||
}
|
||||
}
|
||||
$MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow;
|
||||
$MembersCountArray[$objp->fk_categorie]['total_adhtag'] = $totalrow;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlgic.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlgic.fr>
|
||||
* Copyright (C) 2021-2023 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
* \brief Home page of membership module
|
||||
*/
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
|
|
@ -54,11 +53,11 @@ $result = restrictedArea($user, 'adherent');
|
|||
* Actions
|
||||
*/
|
||||
|
||||
$userid = GETPOST('userid', 'int');
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
|
|
@ -85,173 +84,34 @@ $subscriptionstatic = new Subscription($db);
|
|||
|
||||
print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members');
|
||||
|
||||
$MembersValidated = array();
|
||||
$MembersToValidate = array();
|
||||
$MembersWaitingSubscription = array();
|
||||
$MembersUpToDate = array();
|
||||
$MembersExpired = array();
|
||||
$MembersExcluded = array();
|
||||
$MembersResiliated = array();
|
||||
|
||||
$AdherentType = array();
|
||||
|
||||
// Type of membership
|
||||
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
|
||||
$sql .= " d.statut, count(d.rowid) as somme";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql .= " ON t.rowid = d.fk_adherent_type";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
|
||||
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$adhtype = new AdherentType($db);
|
||||
$adhtype->id = $objp->rowid;
|
||||
$adhtype->subscription = $objp->subscription;
|
||||
$adhtype->label = $objp->label;
|
||||
$AdherentType[$objp->rowid] = $adhtype;
|
||||
|
||||
if ($objp->statut == -1) {
|
||||
$MembersToValidate[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 1) {
|
||||
$MembersValidated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == -2) {
|
||||
$MembersExcluded[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 0) {
|
||||
$MembersResiliated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
// Members waiting subscription
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin IS NULL AND t.subscription = '1')";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersWaitingSubscription[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Members up to date list
|
||||
// current rule: uptodate = the end date is in future or no subcription required
|
||||
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = '0')"; // end date in future
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Members expired list
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND d.statut = 1"; // validated
|
||||
$sql .= " AND (d.datefin < '".$db->idate($now)."' AND t.subscription = '1')";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$MembersExpired[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
/*
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
$boxgraph = '';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$year = date('Y');
|
||||
$numberyears = getDolGlobalInt("MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH");
|
||||
|
||||
$boxgraph .='<div class="div-table-responsive-no-min">';
|
||||
$boxgraph .='<table class="noborder nohover centpercent">';
|
||||
$boxgraph .='<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
$boxgraph .='<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").($numberyears ? ' ('.($year-$numberyears).' - '.$year.')' : '').'</th></tr>';
|
||||
$boxgraph .='<tr><td class="center" colspan="2">';
|
||||
|
||||
$SumToValidate = 0;
|
||||
$SumWaitingSubscription = 0;
|
||||
$SumUpToDate = 0;
|
||||
$SumExpired = 0;
|
||||
$SumResiliated = 0;
|
||||
$SumExcluded = 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
$stats = new AdherentStats($db, 0, $userid);
|
||||
|
||||
$total = 0;
|
||||
$dataval = array();
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
||||
$dataval['waitingsubscription'][] = array($i, isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
||||
$dataval['expired'][] = array($i, isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0);
|
||||
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
||||
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||
// Show array
|
||||
$sumMembers = $stats->countMembersByTypeAndStatus($numberyears);
|
||||
$total = $sumMembers['total']['members_draft'] + $sumMembers['total']['members_pending'] + $sumMembers['total']['members_uptodate'] + $sumMembers['total']['members_expired'] + $sumMembers['total']['members_excluded'] + $sumMembers['total']['members_resiliated'];
|
||||
|
||||
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
|
||||
$SumWaitingSubscription += isset($MembersWaitingSubscription[$key]) ? $MembersWaitingSubscription[$key] : 0;
|
||||
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
|
||||
$SumExpired += isset($MembersExpired[$key]) ? $MembersExpired[$key] : 0;
|
||||
$SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
|
||||
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
||||
$i++;
|
||||
}
|
||||
$total = $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
|
||||
$dataseries = array();
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate)); // Draft, not yet validated
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("WaitingSubscription"), round($SumWaitingSubscription));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumExpired));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), $sumMembers['total']['members_draft']); // Draft, not yet validated
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("WaitingSubscription"), $sumMembers['total']['members_pending']);
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), $sumMembers['total']['members_uptodate']);
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), $sumMembers['total']['members_expired']);
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), $sumMembers['total']['members_excluded']);
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), $sumMembers['total']['members_resiliated']);
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
|
|
@ -268,7 +128,7 @@ if ($conf->use_javascript_ajax) {
|
|||
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
$boxgraph .= $SumToValidate + $SumWaitingSubscription + $SumUpToDate + $SumExpired + $SumExcluded + $SumResiliated;
|
||||
$boxgraph .= $total;
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '</table>';
|
||||
$boxgraph .= '</div>';
|
||||
|
|
|
|||
|
|
@ -584,6 +584,19 @@ if ($rowid > 0) {
|
|||
// Birth Date
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||
|
||||
// Default language
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>';
|
||||
//$s=picto_from_langcode($object->default_lang);
|
||||
//print ($s?$s.' ':'');
|
||||
$langs->load("languages");
|
||||
$labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
|
||||
print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||
print $labellang;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||
|
||||
|
|
@ -755,7 +768,7 @@ if ($rowid > 0) {
|
|||
print '</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
|
||||
print '<td class="right">'.price($objp->subscription).'</td>';
|
||||
print '<td class="right amount">'.price($objp->subscription).'</td>';
|
||||
if (isModEnabled('banque')) {
|
||||
print '<td class="right">';
|
||||
if ($objp->bid) {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.
|
|||
$sql .= " d.gender, d.email, d.morphy,";
|
||||
$sql .= " c.rowid as crowid, c.fk_type, c.subscription,";
|
||||
$sql .= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
|
||||
$sql .= " c.fk_bank as bank, c.note,";
|
||||
$sql .= " c.fk_bank as bank, c.note as note_private,";
|
||||
$sql .= " b.fk_account";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
|
|
@ -471,7 +471,7 @@ if (!empty($arrayfields['t.libelle']['checked'])) {
|
|||
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
|
||||
$form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
|
@ -692,14 +692,14 @@ while ($i < $imaxinloop) {
|
|||
|
||||
// Lastname
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
|
||||
print '<td class="tdoverflowmax125">'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Firstname
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
|
||||
print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($adherent->firstname).'">'.dol_escape_htmltag($adherent->firstname).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
@ -707,7 +707,7 @@ while ($i < $imaxinloop) {
|
|||
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.dol_escape_htmltag($adherent->login).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
@ -716,7 +716,7 @@ while ($i < $imaxinloop) {
|
|||
// Label
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) {
|
||||
print '<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note).'">';
|
||||
print $obj->note;
|
||||
print dol_escape_htmltag(dolGetFirstLineOfText($obj->note_private));
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -725,7 +725,7 @@ while ($i < $imaxinloop) {
|
|||
|
||||
// Banque
|
||||
if (!empty($arrayfields['d.bank']['checked'])) {
|
||||
print '<td class="tdmaxoverflow150">';
|
||||
print '<td class="tdmaxoverflow100">';
|
||||
if ($obj->fk_account > 0) {
|
||||
$accountstatic->id = $obj->fk_account;
|
||||
$accountstatic->fetch($obj->fk_account);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ if ($action == 'set') {
|
|||
if ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->DELIVERY_ADDON_PDF == "$value") {
|
||||
if (getDolGlobalString('DELIVERY_ADDON_PDF') == $value) {
|
||||
dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
|
|||
|
||||
// Default
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->DELIVERY_ADDON_PDF == "$name") {
|
||||
if (getDolGlobalString('DELIVERY_ADDON_PDF') == "$name") {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
|
|
|
|||
|
|
@ -1250,6 +1250,8 @@ if ($id > 0) {
|
|||
$sql .= natural_search("f.code", $search_code);
|
||||
} elseif ($search_code != '' && $id == 2) {
|
||||
$sql .= natural_search("d.code_departement", $search_code);
|
||||
} elseif ($search_code != '' && $id == 14) {
|
||||
$sql .= natural_search("e.code", $search_code);
|
||||
} elseif ($search_code != '' && $id != 9) {
|
||||
$sql .= natural_search("code", $search_code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ class Documents extends DolibarrApi
|
|||
*
|
||||
* Test sample 1: { "modulepart": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.
|
||||
*
|
||||
* Supported modules: invoice, order, proposal, contract
|
||||
*
|
||||
* @param string $modulepart Name of module or area concerned by file download ('thirdparty', 'member', 'proposal', 'supplier_proposal', 'order', 'supplier_order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
|
||||
* @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template).
|
||||
|
|
@ -198,6 +200,19 @@ class Documents extends DolibarrApi
|
|||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
$this->supplier_invoice = new FactureFournisseur($this->db);
|
||||
$result = $this->supplier_invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
$templateused = $doctemplate ? $doctemplate : $this->supplier_invoice->model_pdf;
|
||||
$result = $this->supplier_invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
|
|
@ -256,6 +271,8 @@ class Documents extends DolibarrApi
|
|||
/**
|
||||
* Return the list of documents of a dedicated element (from its ID or Ref)
|
||||
*
|
||||
* Supported modules: thirdparty, user, member, proposal, order, supplier_order, shipment, invoice, supplier_invoice, product, event, expensereport, knowledgemanagement, category, contract
|
||||
*
|
||||
* @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...)
|
||||
* @param int $id ID of element
|
||||
* @param string $ref Ref of element
|
||||
|
|
@ -583,6 +600,8 @@ class Documents extends DolibarrApi
|
|||
* Test sample for supplier invoice: { "filename": "mynewfile.txt", "modulepart": "supplier_invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
|
||||
*
|
||||
* Supported modules: invoice, order, supplier_order, task/project_task, product/service, expensereport, fichinter, member, propale, agenda, contact
|
||||
*
|
||||
* @param string $filename Name of file to create ('FA1705-0123.txt')
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...)
|
||||
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use Luracast\Restler\RestException;
|
|||
|
||||
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/cregion.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php';
|
||||
|
||||
|
|
@ -236,6 +237,107 @@ class Setup extends DolibarrApi
|
|||
|
||||
return $list;
|
||||
}
|
||||
/**
|
||||
* Get the list of regions.
|
||||
*
|
||||
* The returned list is sorted by region ID.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $country To filter on country
|
||||
* @param string $filter To filter the regions by name
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of regions
|
||||
*
|
||||
* @url GET dictionary/regions
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfRegions($sortfield = "code_region", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
// Note: The filter is not applied in the SQL request because it must
|
||||
// be applied to the translated names, not to the names in database.
|
||||
$sql = "SELECT t.rowid FROM ".MAIN_DB_PREFIX."c_regions as t";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
if ($country) {
|
||||
$sql .= " AND t.fk_pays = ".((int) $country);
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$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++) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$region = new Cregion($this->db);
|
||||
if ($region->fetch($obj->rowid) > 0) {
|
||||
if (empty($filter) || stripos($region->name, $filter) !== false) {
|
||||
$list[] = $this->_cleanObjectDatas($region);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of regions');
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get region by ID.
|
||||
*
|
||||
* @param int $id ID of region
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @url GET dictionary/regions/{id}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getRegionByID($id)
|
||||
{
|
||||
return $this->_fetchCregion($id, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get region by Code.
|
||||
*
|
||||
* @param string $code Code of region
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @url GET dictionary/regions/byCode/{code}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getRegionByCode($code)
|
||||
{
|
||||
return $this->_fetchCregion('', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of states/provinces.
|
||||
*
|
||||
|
|
@ -464,6 +566,29 @@ class Setup extends DolibarrApi
|
|||
return $this->_fetchCcountry('', '', $iso, $lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get region.
|
||||
*
|
||||
* @param int $id ID of region
|
||||
* @param string $code Code of region
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetchCregion($id, $code = '')
|
||||
{
|
||||
$region = new Cregion($this->db);
|
||||
|
||||
$result = $region->fetch($id, $code);
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when retrieving region : '.$region->error);
|
||||
} elseif ($result == 0) {
|
||||
throw new RestException(404, 'Region not found');
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($region);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get state.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ function printDropdownBookmarksList()
|
|||
';
|
||||
|
||||
$html .= '
|
||||
<!-- Menu Body -->
|
||||
<!-- Menu Body bookmarks -->
|
||||
<div class="bookmark-body dropdown-body">'.$bookmarkList.'
|
||||
<span id="top-bookmark-search-nothing-found" class="'.($bookmarkNb ? 'hidden-search-result ' : '').'opacitymedium">'.dol_escape_htmltag($langs->trans("NoBookmarkFound")).'</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ while ($i < $imaxinloop) {
|
|||
print "</td>\n";
|
||||
|
||||
// Target
|
||||
print '<td class="center">';
|
||||
print '<td class="tdoverflowmax100 center">';
|
||||
if ($obj->target == 0) {
|
||||
print $langs->trans("BookmarkTargetReplaceWindowShort");
|
||||
}
|
||||
|
|
@ -418,7 +418,7 @@ while ($i < $imaxinloop) {
|
|||
print "</td>\n";
|
||||
|
||||
// Author
|
||||
print '<td class="center">';
|
||||
print '<td class="tdoverflowmax100 center">';
|
||||
if ($obj->fk_user > 0) {
|
||||
if (empty($conf->cache['users'][$obj->fk_user])) {
|
||||
$tmpuser = new User($db);
|
||||
|
|
|
|||
|
|
@ -1221,7 +1221,7 @@ if ($action == 'create') {
|
|||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'><label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
|
||||
|
||||
// Recurring event
|
||||
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
|
||||
$userepeatevent = (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 ? 1 : 0);
|
||||
if ($userepeatevent) {
|
||||
// Repeat
|
||||
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
|
||||
|
|
@ -1477,6 +1477,7 @@ if ($action == 'create') {
|
|||
|
||||
print '</td></tr>';
|
||||
|
||||
// Task
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Task").'</td><td id="project-task-input-container" >';
|
||||
print img_picto('', 'projecttask', 'class="paddingrightonly"');
|
||||
$projectsListId = false;
|
||||
|
|
@ -1486,7 +1487,7 @@ if ($action == 'create') {
|
|||
|
||||
$tid = GETPOSTISSET("projecttaskid") ? GETPOST("projecttaskid", 'int') : (GETPOSTISSET("taskid") ? GETPOST("taskid", 'int') : '');
|
||||
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', $projectsListId);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -454,15 +454,15 @@ class ActionComm extends CommonObject
|
|||
if ($this->percentage > 100) {
|
||||
$this->percentage = 100;
|
||||
}
|
||||
//if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date;
|
||||
if (empty($this->datep) && $this->datep != '0') { // We should not insert event in calendar without a start date
|
||||
$this->datep = $now;
|
||||
}
|
||||
if (!empty($this->datep) && !empty($this->datef)) {
|
||||
$this->durationp = ($this->datef - $this->datep); // deprecated
|
||||
}
|
||||
//if (!empty($this->date) && !empty($this->dateend)) $this->durationa=($this->dateend - $this->date);
|
||||
if (!empty($this->datep) && !empty($this->datef) && $this->datep > $this->datef) {
|
||||
$this->datef = $this->datep;
|
||||
}
|
||||
//if (!empty($this->date) && !empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date;
|
||||
if (!isset($this->fk_project) || $this->fk_project < 0) {
|
||||
$this->fk_project = 0;
|
||||
}
|
||||
|
|
@ -559,8 +559,8 @@ class ActionComm extends CommonObject
|
|||
$sql .= "ip";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'(PROV)', ";
|
||||
$sql .= "'".$this->db->idate($now)."', ";
|
||||
$sql .= (strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : "null").", ";
|
||||
$sql .= "'".$this->db->idate($now)."', "; // date creation
|
||||
$sql .= "'".$this->db->idate($this->datep)."', "; // date start event
|
||||
$sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", ";
|
||||
$sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated
|
||||
$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
|
||||
|
|
|
|||
|
|
@ -584,8 +584,16 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
|||
// Local calendar
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// Holiday calendar
|
||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"'.($check_holiday ? ' checked' : '').'><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
||||
if ($user->rights->holiday->read) {
|
||||
// Holiday calendar
|
||||
$s .= '
|
||||
<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
|
||||
? ' checked' : '') . '>
|
||||
<label for="check_holiday">
|
||||
<span class="check_holiday_text">' . $langs->trans("Holidays") . '</span>
|
||||
</label>
|
||||
</div>';
|
||||
}
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0) {
|
||||
|
|
@ -1003,80 +1011,82 @@ if ($showbirthday) {
|
|||
}
|
||||
}
|
||||
|
||||
// LEAVE-HOLIDAY CALENDAR
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
if ($user->rights->holiday->read) {
|
||||
// LEAVE-HOLIDAY CALENDAR
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||
|
||||
if ($mode == 'show_day') {
|
||||
// Request only leaves for the current selected day
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
|
||||
} elseif ($mode == 'show_week') {
|
||||
// Restrict on current month (we get more, but we will filter later)
|
||||
$sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
|
||||
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
|
||||
} elseif ($mode == 'show_month') {
|
||||
// Restrict on current month
|
||||
$sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'";
|
||||
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
|
||||
}
|
||||
if ($mode == 'show_day') {
|
||||
// Request only leaves for the current selected day
|
||||
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
|
||||
} elseif ($mode == 'show_week') {
|
||||
// Restrict on current month (we get more, but we will filter later)
|
||||
$sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
|
||||
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
|
||||
} elseif ($mode == 'show_month') {
|
||||
// Restrict on current month
|
||||
$sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'";
|
||||
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$event = new ActionComm($db);
|
||||
$event = new ActionComm($db);
|
||||
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
$event->ref = $event->id;
|
||||
// Need the id of the leave object for link to it
|
||||
$event->id = $obj->rowid;
|
||||
$event->ref = $event->id;
|
||||
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->type_label = '';
|
||||
$event->type_color = '';
|
||||
$event->type = 'holiday';
|
||||
$event->type_picto = 'holiday';
|
||||
$event->type_code = 'HOLIDAY';
|
||||
$event->type_label = '';
|
||||
$event->type_color = '';
|
||||
$event->type = 'holiday';
|
||||
$event->type_picto = 'holiday';
|
||||
|
||||
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||
$event->date_start_in_calendar = $event->datep;
|
||||
$event->date_end_in_calendar = $event->datef;
|
||||
|
||||
if ($obj->status == 3) {
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
} elseif ($obj->status == 2) {
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
if ($obj->status == 3) {
|
||||
// Show no symbol for leave with state "leave approved"
|
||||
$event->percentage = -1;
|
||||
} elseif ($obj->status == 2) {
|
||||
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||
$event->percentage = 0;
|
||||
}
|
||||
|
||||
if ($obj->halfday == 1) {
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
} elseif ($obj->halfday == -1) {
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
} else {
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
do {
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60 * 60 * 24;
|
||||
} while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($obj->halfday == 1) {
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||
} elseif ($obj->halfday == -1) {
|
||||
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||
} else {
|
||||
$event->label = $obj->lastname;
|
||||
}
|
||||
|
||||
$daycursor = $event->date_start_in_calendar;
|
||||
$annee = dol_print_date($daycursor, '%Y', 'tzuserrel');
|
||||
$mois = dol_print_date($daycursor, '%m', 'tzuserrel');
|
||||
$jour = dol_print_date($daycursor, '%d', 'tzuserrel');
|
||||
|
||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
|
||||
do {
|
||||
$eventarray[$daykey][] = $event;
|
||||
|
||||
$daykey += 60 * 60 * 24;
|
||||
} while ($daykey <= $event->date_end_in_calendar);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Payment terms of the settlement
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer) {
|
||||
if ($action == 'setconditions' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -179,7 +179,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Payment mode
|
||||
if ($action == 'setmode' && $user->rights->societe->creer) {
|
||||
if ($action == 'setmode' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -188,7 +188,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Transport mode
|
||||
if ($action == 'settransportmode' && $user->rights->societe->creer) {
|
||||
if ($action == 'settransportmode' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -197,7 +197,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->societe->creer) {
|
||||
if ($action == 'setbankaccount' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -206,7 +206,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer) {
|
||||
if ($action == 'setshippingmethod' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -215,7 +215,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer) {
|
||||
if ($action == 'setassujtva' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$object->tva_assuj = GETPOST('assujtva_value');
|
||||
$result = $object->update($object->id);
|
||||
|
|
@ -225,7 +225,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer) {
|
||||
if ($action == 'setprospectlevel' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel = GETPOST('prospect_level_id', 'alpha');
|
||||
$result = $object->update($object->id, $user);
|
||||
|
|
@ -267,7 +267,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Set sales representatives
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer) {
|
||||
if ($action == 'set_salesrepresentatives' && $user->hasRight('societe', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// warehouse
|
||||
if ($action == 'setwarehouse' && $user->rights->societe->creer) {
|
||||
if ($action == 'setwarehouse' && $user->hasRight('societe', 'creer')) {
|
||||
$result = $object->setWarehouse(GETPOST('fk_warehouse', 'int'));
|
||||
}
|
||||
}
|
||||
|
|
@ -360,9 +360,9 @@ if ($object->id > 0) {
|
|||
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->hasRight('societe', 'creer'));
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->hasRight('societe', 'creer'));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('PaymentConditions');
|
||||
print '<td>';
|
||||
if (($action != 'editconditions') && $user->rights->societe->creer) {
|
||||
if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -426,7 +426,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '<td>';
|
||||
if (($action != 'editmode') && $user->rights->societe->creer) {
|
||||
if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -445,7 +445,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentBankAccount');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
|
||||
if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -467,7 +467,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0) {
|
||||
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
|
@ -480,7 +480,7 @@ if ($object->id > 0) {
|
|||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0) {
|
||||
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
|
@ -502,10 +502,10 @@ if ($object->id > 0) {
|
|||
if ($object->client) {
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer'));
|
||||
print '</td><td>';
|
||||
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer'), $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -515,9 +515,9 @@ if ($object->id > 0) {
|
|||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->hasRight('societe', 'creer'));
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->hasRight('societe', 'creer'), $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -530,7 +530,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("PriceLevel");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer) {
|
||||
if ($user->hasRight('societe', 'creer')) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
|
@ -551,7 +551,7 @@ if ($object->id > 0) {
|
|||
$formproduct = new FormProduct($db);
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->rights->societe->creer);
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer'));
|
||||
print '</td><td>';
|
||||
if ($action == 'editwarehouse') {
|
||||
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
|
||||
|
|
@ -571,7 +571,7 @@ if ($object->id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) {
|
||||
if (($action != 'editshipping') && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -591,7 +591,7 @@ if ($object->id > 0) {
|
|||
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('IntracommReportTransportMode');
|
||||
print '<td>';
|
||||
if (($action != 'edittransportmode') && $user->rights->societe->creer) {
|
||||
if (($action != 'edittransportmode') && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -654,7 +654,7 @@ if ($object->id > 0) {
|
|||
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) {
|
||||
if ($action != 'editlevel' && $user->hasRight('societe', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -695,7 +695,7 @@ if ($object->id > 0) {
|
|||
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
// Lien recap
|
||||
$boxstat .= '<div class="box box-halfright">';
|
||||
$boxstat .= '<div class="box divboxtable box-halfright">';
|
||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop boxtablenomarginbottom centpercent">';
|
||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ if ($object->id > 0) {
|
|||
/*
|
||||
* Latest shipments
|
||||
*/
|
||||
if (isModEnabled("expedition") && $user->rights->expedition->lire) {
|
||||
if (isModEnabled("expedition") && $user->hasRight('expedition', 'lire')) {
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql .= ', e.ref, e.entity';
|
||||
$sql .= ', e.date_creation';
|
||||
|
|
|
|||
|
|
@ -1289,6 +1289,10 @@ class Propal extends CommonObject
|
|||
dol_print_error($this->db);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the id on created row
|
||||
$line->id = $result;
|
||||
|
||||
// Defined the new fk_parent_line
|
||||
if ($result > 0 && $line->product_type == 9) {
|
||||
$fk_parent_line = $result;
|
||||
|
|
@ -1423,6 +1427,8 @@ class Propal extends CommonObject
|
|||
}
|
||||
|
||||
foreach ($object->lines as $line) {
|
||||
$line->id = 0;
|
||||
|
||||
if ($line->fk_product > 0) {
|
||||
$prod = new Product($this->db);
|
||||
$res = $prod->fetch($line->fk_product);
|
||||
|
|
|
|||
|
|
@ -245,10 +245,10 @@ $arrayfields = array(
|
|||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
|
||||
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
|
||||
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
|
||||
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
|
||||
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
|
|
@ -285,17 +285,17 @@ foreach ($object->fields as $key => $val) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
// Permissions
|
||||
$permissiontoread = $user->rights->propal->lire;
|
||||
$permissiontoadd = $user->rights->propal->creer;
|
||||
$permissiontodelete = $user->rights->propal->supprimer;
|
||||
$permissiontoread = $user->hasRight('propal', 'lire');
|
||||
$permissiontoadd = $user->hasRight('propal', 'creer');
|
||||
$permissiontodelete = $user->hasRight('propal', 'supprimer');
|
||||
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
|
||||
$permissiontovalidate = $user->rights->propal->propal_advance->validate;
|
||||
$permissiontoclose = $user->rights->propal->propal_advance->close;
|
||||
$permissiontosendbymail = $user->rights->propal->propal_advance->send;
|
||||
$permissiontovalidate = $user->hasRight('propal', 'propal_advance', 'validate');
|
||||
$permissiontoclose = $user->hasRight('propal', 'propal_advance', 'close');
|
||||
$permissiontosendbymail = $user->hasRight('propal', 'propal_advance', 'send');
|
||||
} else {
|
||||
$permissiontovalidate = $user->rights->propal->creer;
|
||||
$permissiontoclose = $user->rights->propal->creer;
|
||||
$permissiontosendbymail = $user->rights->propal->lire;
|
||||
$permissiontovalidate = $user->hasRight('propal', 'creer');
|
||||
$permissiontoclose = $user->hasRight('propal', 'creer');
|
||||
$permissiontosendbymail = $user->hasRight('propal', 'lire');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1082,7 +1082,7 @@ if ($resql) {
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->rights->propal->creer);
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('propal', 'creer'));
|
||||
|
||||
// Fields title search
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
|
@ -1151,7 +1151,7 @@ if ($resql) {
|
|||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, array($search_product_category), 'maxwidth300', $searchCategoryProductOperator, 0, 0, $tmptitle);
|
||||
}
|
||||
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
|
||||
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
|
||||
|
|
@ -2335,8 +2335,8 @@ if ($resql) {
|
|||
$urlsource .= str_replace('&', '&', $param);
|
||||
|
||||
$filedir = $diroutputmassaction;
|
||||
$genallowed = $user->rights->propal->lire;
|
||||
$delallowed = $user->rights->propal->creer;
|
||||
$genallowed = $user->hasRight('propal', 'lire');
|
||||
$delallowed = $user->hasRight('propal', 'creer');
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2692,52 +2692,65 @@ if ($action == 'create' && $usercancreate) {
|
|||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Total HT
|
||||
$alert = '';
|
||||
if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) {
|
||||
$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
|
||||
$alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->order_min_amount));
|
||||
}
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->total_ht, 1, '', 1, -1, -1, $conf->currency).$alert.'</td>';
|
||||
|
||||
// Total VAT
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_tva, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount VAT
|
||||
print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
// Amount Local Taxes
|
||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
|
||||
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Total TTC
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="valuefield nowrap right amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount TTC
|
||||
print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Statut
|
||||
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Margin Infos
|
||||
if (isModEnabled('margin')) {
|
||||
$formmargin->displayMarginInfos($object);
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class Orders extends DolibarrApi
|
|||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture AS t LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande AS t LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'multicurrency'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$hookmanager->initHooks(array('banktransfer'));
|
||||
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
|
|
@ -45,12 +49,10 @@ if (!$user->rights->banque->transfer) {
|
|||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$hookmanager->initHooks(array('banktransfer'));
|
||||
|
||||
$MAXLINES = 10;
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -61,10 +63,20 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
|||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if ($action == 'add') {
|
||||
if ($action == 'add' && !empty($user->rights->banque->transfer)) {
|
||||
$langs->load('errors');
|
||||
$i = 1;
|
||||
|
||||
$dateo = array();
|
||||
$label = array();
|
||||
$amount = array();
|
||||
$amountto = array();
|
||||
$accountfrom = array();
|
||||
$accountto = array();
|
||||
$type = array();
|
||||
$tabnum = array();
|
||||
$maxtab = 1;
|
||||
|
||||
while ($i < $MAXLINES) {
|
||||
$dateo[$i] = dol_mktime(12, 0, 0, GETPOST($i.'_month', 'int'), GETPOST($i.'_day', 'int'), GETPOST($i.'_year', 'int'));
|
||||
$label[$i] = GETPOST($i.'_label', 'alpha');
|
||||
|
|
@ -73,75 +85,71 @@ if ($action == 'add') {
|
|||
$accountfrom[$i] = intval(GETPOST($i.'_account_from', 'int'));
|
||||
$accountto[$i] = intval(GETPOST($i.'_account_to', 'int'));
|
||||
$type[$i] = GETPOST($i.'_type', 'int');
|
||||
$errori[$i] = 0;
|
||||
|
||||
$tabnum[$i] = 0;
|
||||
if (!empty($label[$i]) || !($amount[$i] <= 0) || !($accountfrom[$i] < 0) || !($accountto[$i] < 0)) {
|
||||
$tabnum[$i] = 1;
|
||||
$maxtab = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
||||
$n = 1;
|
||||
while ($n < $MAXLINES) {
|
||||
if ($tabnum[$n] === 1) {
|
||||
if ($accountfrom[$n] < 0) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("TransferFrom")), null, 'errors');
|
||||
}
|
||||
if ($accountto[$n] < 0) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("TransferTo")), null, 'errors');
|
||||
}
|
||||
if (!$type[$n]) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Type")), null, 'errors');
|
||||
}
|
||||
if (!$dateo[$n]) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Date")), null, 'errors');
|
||||
}
|
||||
|
||||
if (!($label[$n])) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' . $langs->transnoentities("Description")), null, 'errors');
|
||||
}
|
||||
if (!($amount[$n])) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n. ' ' .$langs->transnoentities("Amount")), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errori[$n]) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$tmpaccountfrom = new Account($db);
|
||||
$tmpaccountfrom->fetch(GETPOST($n.'_account_from', 'int'));
|
||||
|
||||
$tmpaccountfrom = new Account($db);
|
||||
$tmpaccountfrom->fetch(GETPOST($n.'_account_from', 'int'));
|
||||
$tmpaccountto = new Account($db);
|
||||
$tmpaccountto->fetch(GETPOST($n.'_account_to', 'int'));
|
||||
|
||||
$tmpaccountto = new Account($db);
|
||||
$tmpaccountto->fetch(GETPOST($n.'_account_to', 'int'));
|
||||
|
||||
if ($tmpaccountto->currency_code == $tmpaccountfrom->currency_code) {
|
||||
$amountto[$n] = $amount[$n];
|
||||
} else {
|
||||
if (!$amountto[$n]) {
|
||||
$errori[$n]++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AmountTo")).' #'.$n, null, 'errors');
|
||||
}
|
||||
}
|
||||
if ($amountto[$n] < 0) {
|
||||
$errori[$n]++;
|
||||
setEventMessages($langs->trans("AmountMustBePositive").' #'.$n, null, 'errors');
|
||||
}
|
||||
|
||||
if ($tmpaccountto->id == $tmpaccountfrom->id) {
|
||||
$errori[$n]++;
|
||||
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers").' #'.$n, null, 'errors');
|
||||
if ($tmpaccountto->currency_code == $tmpaccountfrom->currency_code) {
|
||||
$amountto[$n] = $amount[$n];
|
||||
} else {
|
||||
if (!$amountto[$n]) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", '#'.$n.' '.$langs->transnoentities("AmountToOthercurrency")), null, 'errors');
|
||||
}
|
||||
}
|
||||
if ($amountto[$n] < 0) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("AmountMustBePositive").' #'.$n, null, 'errors');
|
||||
}
|
||||
|
||||
if ($errori[$n] == 0) {
|
||||
$db->begin();
|
||||
if ($tmpaccountto->id == $tmpaccountfrom->id) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers").' #'.$n, null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$bank_line_id_from = 0;
|
||||
$bank_line_id_to = 0;
|
||||
$result = 0;
|
||||
|
|
@ -155,47 +163,56 @@ if ($action == 'add') {
|
|||
$typeto = 'LIQ';
|
||||
}
|
||||
|
||||
if (!$errori[$n]) {
|
||||
if (!$error) {
|
||||
$bank_line_id_from = $tmpaccountfrom->addline($dateo[$n], $typefrom, $label[$n], price2num(-1 * $amount[$n]), '', '', $user);
|
||||
}
|
||||
if (!($bank_line_id_from > 0)) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
}
|
||||
if (!$errori[$n]) {
|
||||
if (!$error) {
|
||||
$bank_line_id_to = $tmpaccountto->addline($dateo[$n], $typeto, $label[$n], $amountto[$n], '', '', $user);
|
||||
}
|
||||
if (!($bank_line_id_to > 0)) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$errori[$n]) {
|
||||
if (!$error) {
|
||||
$result = $tmpaccountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
}
|
||||
if (!($result > 0)) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
}
|
||||
if (!$errori[$n]) {
|
||||
if (!$error) {
|
||||
$result = $tmpaccountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
}
|
||||
if (!($result > 0)) {
|
||||
$errori[$n]++;
|
||||
$error++;
|
||||
}
|
||||
if (!$errori[$n]) {
|
||||
if (!$error) {
|
||||
$mesgs = $langs->trans("TransferFromToDone", '{s1}', '{s2}', $amount[$n], $langs->transnoentitiesnoconv("Currency".$conf->currency));
|
||||
$mesgs = str_replace('{s1}', '<a href="bankentries_list.php?id='.$tmpaccountfrom->id.'&sortfield=b.datev,b.dateo,b.rowid&sortorder=desc">'.$tmpaccountfrom->label.'</a>', $mesgs);
|
||||
$mesgs = str_replace('{s2}', '<a href="bankentries_list.php?id='.$tmpaccountto->id.'">'.$tmpaccountto->label.'</a>', $mesgs);
|
||||
setEventMessages($mesgs, null, 'mesgs');
|
||||
$db->commit();
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($tmpaccountfrom->error.' '.$tmpaccountto->error, null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/bank/transfer.php');
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -208,7 +225,7 @@ $title = $langs->trans('MenuBankInternalTransfer');
|
|||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
print ' <script type="text/javascript">
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(".selectbankaccount").change(function() {
|
||||
console.log("We change bank account. We check if currency differs. If yes, we show multicurrency field");
|
||||
|
|
@ -218,28 +235,38 @@ print ' <script type="text/javascript">
|
|||
});
|
||||
|
||||
function init_page(i) {
|
||||
// TODO Scan all line i and set atleast2differentcurrency if there is 2 different values among all lines
|
||||
var account1 = $("#select"+i+"_account_from").val();
|
||||
var account2 = $("#select"+i+"_account_to").val();
|
||||
var currencycode1 = $("#select"+i+"_account_from option:selected").attr("data-currency-code");
|
||||
var currencycode2 = $("#select"+i+"_account_to option:selected").attr("data-currency-code");
|
||||
console.log("Set fields according to currencycode found currencycode1="+currencycode1+" currencycode2="+currencycode2);
|
||||
var atleast2differentcurrency = false;
|
||||
|
||||
$(".selectbankaccount").each(function( index ) {
|
||||
// Scan all line i and set atleast2differentcurrency if there is 2 different values among all lines
|
||||
var account1 = $("#select"+index+"_account_from").val();
|
||||
var account2 = $("#select"+index+"_account_to").val();
|
||||
var currencycode1 = $("#select"+index+"_account_from option:selected").attr("data-currency-code");
|
||||
var currencycode2 = $("#select"+index+"_account_to option:selected").attr("data-currency-code");
|
||||
console.log("Set atleast2differentcurrency according to currencycode found for index="+index+" currencycode1="+currencycode1+" currencycode2="+currencycode2);
|
||||
|
||||
atleast2differentcurrency = (currencycode2!==currencycode1 && currencycode1 !== undefined && currencycode2 !== undefined && currencycode2!=="" && currencycode1!=="");
|
||||
if (atleast2differentcurrency) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var atleast2differentcurrency = (currencycode2!==currencycode1 && currencycode1 !== undefined && currencycode2 !== undefined && currencycode2!=="" && currencycode1!=="");
|
||||
|
||||
if (atleast2differentcurrency) {
|
||||
console.log("We show multucurrency field");
|
||||
console.log("We show multicurrency field");
|
||||
$(".multicurrency").show();
|
||||
} else {
|
||||
console.log("We hide multucurrency field");
|
||||
console.log("We hide multicurrency field");
|
||||
$(".multicurrency").hide();
|
||||
}
|
||||
|
||||
// Show all linew with view=view
|
||||
$("select").each(function() {
|
||||
if( $(this).attr("view")){
|
||||
$(this).closest("tr").removeClass("hidejs").removeClass("hideobject");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
init_page(1);
|
||||
|
|
@ -274,36 +301,36 @@ print '</tr>';
|
|||
for ($i = 1 ; $i < $MAXLINES; $i++) {
|
||||
$label = '';
|
||||
$amount = '';
|
||||
$amounto = '';
|
||||
$amountto = '';
|
||||
|
||||
if ($errori[$i]) {
|
||||
if ($error) {
|
||||
$label = GETPOST($i.'_label', 'alpha');
|
||||
$amount = GETPOST($i.'_amount', 'alpha');
|
||||
$amountto = GETPOST($i.'_amountto', 'alpha');
|
||||
}
|
||||
|
||||
if ($i == 1) {
|
||||
$classi = 'numvir number'. $i;
|
||||
$classi = 'numvir number'.$i;
|
||||
$classi .= ' active';
|
||||
} else {
|
||||
$classi = 'numvir number'. $i;
|
||||
$classi = 'numvir number'.$i;
|
||||
$classi .= ' hidejs hideobject';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven nowraponall '.$classi.'"><td>';
|
||||
print img_picto('', 'bank_account', 'class="paddingright"');
|
||||
$form->select_comptes(($errori[$i] ? GETPOST($i.'_account_from', 'int') : ''), $i.'_account_from', 0, '', 1, ($errori[$i] ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
|
||||
$form->select_comptes(($error ? GETPOST($i.'_account_from', 'int') : ''), $i.'_account_from', 0, '', 1, ($i <= $maxtab ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowraponall">';
|
||||
print img_picto('', 'bank_account', 'class="paddingright"');
|
||||
$form->select_comptes(($errori[$i] ? GETPOST($i.'_account_to', 'int') : ''), $i.'_account_to', 0, '', 1, ($errori[$i] ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
|
||||
$form->select_comptes(($error ? GETPOST($i.'_account_to', 'int') : ''), $i.'_account_to', 0, '', 1, ($i <= $maxtab ? 'view=view' : ''), isModEnabled('multicurrency') ? 1 : 0, 'minwidth100');
|
||||
print "</td>\n";
|
||||
|
||||
// Payment mode
|
||||
print '<td class="nowraponall">';
|
||||
$idpaymentmodetransfer = dol_getIdFromCode($db, 'VIR', 'c_paiement');
|
||||
$form->select_types_paiements(($errori[$i] ? GETPOST($i.'_type', 'aZ09') : $idpaymentmodetransfer), $i.'_type', '', 0, 1, 0, 0, 1, 'minwidth100');
|
||||
$form->select_types_paiements(($error ? GETPOST($i.'_type', 'aZ09') : $idpaymentmodetransfer), $i.'_type', '', 0, 1, 0, 0, 1, 'minwidth100');
|
||||
print "</td>\n";
|
||||
|
||||
// Date
|
||||
|
|
@ -318,7 +345,7 @@ for ($i = 1 ; $i < $MAXLINES; $i++) {
|
|||
print '<td class="right"><input name="'.$i.'_amount" class="flat right selectjs" type="text" size="6" value="'.dol_escape_htmltag($amount).'"></td>';
|
||||
|
||||
// AmountToOthercurrency
|
||||
print '<td class="hideobject multicurrency right"><input name="'.$i.'_amountto" class="flat" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
|
||||
print '<td class="hideobject multicurrency right"><input name="'.$i.'_amountto" class="flat right" type="text" size="6" value="'.dol_escape_htmltag($amountto).'"></td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
|
@ -336,16 +363,12 @@ print '</div>';
|
|||
|
||||
print '</form>';
|
||||
|
||||
print ' <script type="text/javascript">
|
||||
print '<script type="text/javascript">
|
||||
function increment() {
|
||||
console.log("We click to show next line");
|
||||
$(".numvir").nextAll(".hidejs:first").removeClass("hidejs").removeClass("hideobject").addClass("active").show();
|
||||
}
|
||||
$(".number1").on("click",(function() {
|
||||
console.log("We click on number1");
|
||||
$(".hidejs").each(function (){$(this).hide()});
|
||||
$("#btncont").show();
|
||||
}))
|
||||
</script>
|
||||
</script>
|
||||
';
|
||||
|
||||
// End of page
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ if ($object->id > 0) {
|
|||
$out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id);
|
||||
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$out .= '&backtopage='.urlencode($urlbacktopage);
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
$permok = $user->hasRight('paymentbagendaybanktransfer', 'myactions', 'create');
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') {
|
||||
|
|
|
|||
|
|
@ -4248,6 +4248,8 @@ if ($action == 'create') {
|
|||
$i++;
|
||||
$close[$i]['code'] = 'bankcharge';
|
||||
$i++;
|
||||
$close[$i]['code'] = 'withholdingtax';
|
||||
$i++;
|
||||
$close[$i]['code'] = 'other';
|
||||
$i++;
|
||||
// Help
|
||||
|
|
@ -4258,6 +4260,8 @@ if ($action == 'create') {
|
|||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBankChargeDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonWithholdingTaxDesc");
|
||||
$i++;
|
||||
$close[$i]['label'] = $langs->trans("Other");
|
||||
$i++;
|
||||
// Texte
|
||||
|
|
@ -4268,6 +4272,8 @@ if ($action == 'create') {
|
|||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBankCharge", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonWithholdingTax"), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
|
||||
$i++;
|
||||
// arrayreasons[code]=reason
|
||||
|
|
@ -4278,7 +4284,7 @@ if ($action == 'create') {
|
|||
// Cree un tableau formulaire
|
||||
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'morecss' => 'minwidth300'));
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 340, 600);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 380, 600);
|
||||
}
|
||||
|
||||
// Confirmation du classement abandonne
|
||||
|
|
@ -4788,6 +4794,7 @@ if ($action == 'create') {
|
|||
|
||||
print '<!-- amounts -->'."\n";
|
||||
print '<div class="underbanner clearboth"></div>'."\n";
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
$sign = 1;
|
||||
|
|
@ -4795,44 +4802,61 @@ if ($action == 'create') {
|
|||
$sign = -1; // We invert sign for output
|
||||
}
|
||||
|
||||
if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) {
|
||||
print '<tr>';
|
||||
// Amount HT
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_tva, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ttc, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||
print '</tr>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Vat
|
||||
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3" class="nowrap right amountcard">'.price($sign * $object->total_tva, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
print '<tr>';
|
||||
// Amount VAT
|
||||
print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount VAT
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Amount Local Taxes
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { // Localtax1
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
}
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2
|
||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||
print '<td class="nowrap right amountcard">'.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if ($selleruserevenustamp) { // Test company use revenue stamp
|
||||
print '<tr><td>';
|
||||
print '<tr>';
|
||||
// Amount TTC
|
||||
print '<td>' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
|
||||
if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
|
||||
// Multicurrency Amount TTC
|
||||
print '<td class="nowrap amountcard right">' . price($sign * $object->total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Ajouter la première condition
|
||||
if ($selleruserevenustamp) {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RevenueStamp');
|
||||
print '</td>';
|
||||
|
|
@ -4852,43 +4876,37 @@ if ($action == 'create') {
|
|||
print ' <input type="submit" class="button buttongen button-save" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
print " <script>
|
||||
$(document).ready(function(){
|
||||
js_recalculate_revenuestamp();
|
||||
$('select[name=revenuestamp_type]').on('change',function(){
|
||||
js_recalculate_revenuestamp();
|
||||
});
|
||||
});
|
||||
function js_recalculate_revenuestamp(){
|
||||
var valselected = $('select[name=revenuestamp_type]').val();
|
||||
console.log('Calculate revenue stamp from '+valselected);
|
||||
var revenue = 0;
|
||||
if (valselected.indexOf('%') == -1)
|
||||
{
|
||||
revenue = valselected;
|
||||
}
|
||||
else
|
||||
{
|
||||
$(document).ready(function(){
|
||||
js_recalculate_revenuestamp();
|
||||
$('select[name=revenuestamp_type]').on('change',function(){
|
||||
js_recalculate_revenuestamp();
|
||||
});
|
||||
});
|
||||
function js_recalculate_revenuestamp(){
|
||||
var valselected = $('select[name=revenuestamp_type]').val();
|
||||
console.log('Calculate revenue stamp from '+valselected);
|
||||
var revenue = 0;
|
||||
if (valselected.indexOf('%') == -1)
|
||||
{
|
||||
revenue = valselected;
|
||||
}
|
||||
else
|
||||
{
|
||||
var revenue_type = parseFloat(valselected);
|
||||
var amount_net = ".round($object->total_ht, 2).";
|
||||
revenue = revenue_type * amount_net / 100;
|
||||
revenue = revenue.toFixed(2);
|
||||
}
|
||||
$('#revenuestamp_val').val(revenue);
|
||||
$('#revenuestamp_span').html(revenue);
|
||||
}
|
||||
</script>";
|
||||
}
|
||||
$('#revenuestamp_val').val(revenue);
|
||||
$('#revenuestamp_span').html(revenue);
|
||||
}
|
||||
</script>";
|
||||
} else {
|
||||
print price($object->revenuestamp, 1, '', 1, - 1, - 1, $conf->currency);
|
||||
print price($object->revenuestamp, 1, '', 1, -1, -1, $conf->currency);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total with tax
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap right amountcard">'.price($sign * $object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
$nbrows = 8;
|
||||
$nbcols = 3;
|
||||
if (isModEnabled('project')) {
|
||||
|
|
@ -5111,7 +5129,7 @@ if ($action == 'create') {
|
|||
}
|
||||
print '</td>';
|
||||
$label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label;
|
||||
print '<td>'.$label.' '.$objp->num_payment.'</td>';
|
||||
print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($label.' '.$objp->num_payment).'">'.dol_escape_htmltag($label.' '.$objp->num_payment).'</td>';
|
||||
if (isModEnabled("banque")) {
|
||||
$bankaccountstatic->id = $objp->baid;
|
||||
$bankaccountstatic->ref = $objp->baref;
|
||||
|
|
|
|||
|
|
@ -5698,7 +5698,11 @@ class Facture extends CommonInvoice
|
|||
$resql = $this->db->query($sql);
|
||||
|
||||
$stmpidate = dol_print_date($tmpidate, 'day', 'gmt');
|
||||
$this->output .= $langs->transnoentitiesnoconv("SearchUnpaidInvoicesWithDueDate", $stmpidate);
|
||||
if ($datetouse == 'invoicedate') {
|
||||
$this->output .= $langs->transnoentitiesnoconv("SearchValidatedInvoicesWithDate", $stmpidate);
|
||||
} else {
|
||||
$this->output .= $langs->transnoentitiesnoconv("SearchUnpaidInvoicesWithDueDate", $stmpidate);
|
||||
}
|
||||
if (!empty($paymentmode) && $paymentmode != 'all') {
|
||||
$this->output .= ' ('.$langs->transnoentitiesnoconv("PaymentMode").' '.$paymentmode.')';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -747,10 +747,10 @@ if ($object->id > 0) {
|
|||
print "\n".'<div class="tabsAction">'."\n";
|
||||
|
||||
$buttonlabel = $langs->trans("MakeWithdrawRequest");
|
||||
$user_perms = $user->rights->prelevement->bons->creer;
|
||||
$user_perms = $user->hasRight('prelevement', 'bons', 'creer');
|
||||
if ($type == 'bank-transfer') {
|
||||
$buttonlabel = $langs->trans("MakeBankTransferOrder");
|
||||
$user_perms = $user->rights->paymentbybanktransfer->create;
|
||||
$user_perms = $user->hasRight('paymentbybanktransfer', 'create');
|
||||
}
|
||||
|
||||
// Add a transfer request
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -223,6 +224,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$multicurrency_code = array();
|
||||
$multicurrency_tx = array();
|
||||
|
||||
// Clean parameters amount if payment is for a credit note
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -233,6 +235,7 @@ if (empty($reshook)) {
|
|||
$amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
||||
|
|
@ -243,6 +246,7 @@ if (empty($reshook)) {
|
|||
$multicurrency_amounts[$key] = - abs($newvalue);
|
||||
}
|
||||
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||
$multicurrency_tx[$key] = $tmpinvoice->multicurrency_tx;
|
||||
}
|
||||
|
||||
if (isModEnabled("banque")) {
|
||||
|
|
@ -259,6 +263,7 @@ if (empty($reshook)) {
|
|||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||
$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
|
||||
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
|
||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||
|
|
@ -470,6 +475,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
|
||||
print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">';
|
||||
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->thirdparty->name).'">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print dol_get_fiche_head();
|
||||
|
||||
|
|
@ -863,7 +869,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||
$langs->load("withdrawals");
|
||||
if (!empty($conf->global->WITHDRAW_DISABLE_AUTOCREATE_ONPAYMENTS)) print '<br>'.$langs->trans("IfInvoiceNeedOnWithdrawPaymentWontBeClosed");
|
||||
}*/
|
||||
print '<br><input type="submit" class="button" value="'.dol_escape_htmltag($buttontitle).'"><br><br>';
|
||||
print '<br><input type="submit" class="button reposition" value="'.dol_escape_htmltag($buttontitle).'"><br><br>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
|
||||
* Copyright (C) 2021 OpenDsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -76,6 +77,7 @@ class Paiement extends CommonObject
|
|||
public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
|
||||
public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)
|
||||
public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)
|
||||
public $multicurrency_tx = array(); // array: invoice ID => currency tx for that invoice
|
||||
public $multicurrency_code = array(); // array: invoice ID => currency code for that invoice
|
||||
|
||||
public $pos_change = 0; // Excess received in TakePOS cash payment
|
||||
|
|
@ -262,8 +264,9 @@ class Paiement extends CommonObject
|
|||
}
|
||||
|
||||
$currencyofpayment = '';
|
||||
$currencytxofpayment = '';
|
||||
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatch
|
||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -282,6 +285,9 @@ class Paiement extends CommonObject
|
|||
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||
return -1;
|
||||
}
|
||||
if (empty($currencytxofpayment)) {
|
||||
$currencytxofpayment = isset($this->multicurrency_tx[$key]) ? $this->multicurrency_tx[$key] : "";
|
||||
}
|
||||
|
||||
$totalamount_converted += $value_converted;
|
||||
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
||||
|
|
@ -294,6 +300,10 @@ class Paiement extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($currencyofpayment)) { // Should not happen. For the case the multicurrency_code was not saved into invoices
|
||||
$currencyofpayment = $conf->currency;
|
||||
}
|
||||
|
||||
if (!empty($currencyofpayment)) {
|
||||
// We must check that the currency of invoices is the same than the currency of the bank
|
||||
$bankaccount = new Account($this->db);
|
||||
|
|
@ -351,9 +361,8 @@ class Paiement extends CommonObject
|
|||
$facid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0) {
|
||||
$amount = price2num($amount);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)";
|
||||
// TODO Add multicurrency_code and multicurrency_tx
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount, multicurrency_code, multicurrency_tx)";
|
||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).", ".($currencyofpayment ? "'".$this->db->escape($currencyofpayment)."'" : 'NULL').", ".(!empty($this->multicurrency_tx) ? (double) $currencytxofpayment : 1).")";
|
||||
|
||||
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -80,9 +80,7 @@ if (empty($action) && empty($id) && empty($ref)) {
|
|||
}
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || $ref) {
|
||||
$object->fetch($id, $ref);
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
||||
|
||||
$permissiontoread = $user->rights->tax->charges->lire;
|
||||
$permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
|
||||
|
|
@ -93,7 +91,7 @@ $upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->enti
|
|||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'tax', $object->id, 'tva', 'charges');
|
||||
|
|
|
|||
|
|
@ -215,6 +215,8 @@ $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62';
|
|||
// $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator.
|
||||
// $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser';
|
||||
// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com
|
||||
// $dolibarr_main_authentication='openid_connect'; // See https://wiki.dolibarr.org/index.php?title=Authentication,_SSO_and_SSL
|
||||
// $dolibarr_main_authentication='googleoauth'; // See https://wiki.dolibarr.org/index.php?title=Authentication,_SSO_and_SSL
|
||||
//
|
||||
$dolibarr_main_authentication='dolibarr';
|
||||
|
||||
|
|
|
|||
|
|
@ -1537,7 +1537,7 @@ class Contact extends CommonObject
|
|||
$linkend = '</a>';
|
||||
}
|
||||
|
||||
$result .= $linkstart;
|
||||
$result .= (($option == 'nolink') ? '' : $linkstart);
|
||||
if ($withpicto) {
|
||||
if ($withpicto < 0) {
|
||||
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
|
||||
|
|
@ -1548,7 +1548,7 @@ class Contact extends CommonObject
|
|||
if ($withpicto != 2 && $withpicto != -2) {
|
||||
$result .= '<span class="valigmiddle">'.($maxlen ? dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)).'</span>';
|
||||
}
|
||||
$result .= $linkend;
|
||||
$result .= (($option == 'nolink') ? '' : $linkend);
|
||||
|
||||
global $action;
|
||||
$hookmanager->initHooks(array('contactdao'));
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ if ($action == 'create') {
|
|||
|
||||
// Area with status and activation info of line
|
||||
if ($object->statut > 0) {
|
||||
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
print '<table class="notopnoleftnoright tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').' centpercent">';
|
||||
|
||||
print '<tr class="oddeven" '.$moreparam.'>';
|
||||
print '<td><span class="valignmiddle hideonsmartphone">'.$langs->trans("ServiceStatus").':</span> '.$object->lines[$cursorline - 1]->getLibStatut(4).'</td>';
|
||||
|
|
@ -1938,7 +1938,7 @@ if ($action == 'create') {
|
|||
print '<input type="hidden" name="ligne" value="'.GETPOST('ligne', 'int').'">';
|
||||
print '<input type="hidden" name="confirm" value="yes">';
|
||||
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').' centpercent">';
|
||||
|
||||
// Definie date debut et fin par defaut
|
||||
$dateactstart = $objp->date_start;
|
||||
|
|
@ -1995,7 +1995,7 @@ if ($action == 'create') {
|
|||
print '<input type="hidden" name="action" value="confirm_closeline">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').'" width="100%">';
|
||||
print '<table class="noborder tableforservicepart2'.($cursorline < $nbofservices ? ' boxtablenobottom' : '').' centpercent">';
|
||||
|
||||
// Definie date debut et fin par defaut
|
||||
$dateactstart = $objp->date_start_real;
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ if ($action == 'update') {
|
|||
$computedvalue,
|
||||
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
|
||||
GETPOST('langfile'),
|
||||
GETPOST('enabled', 'alpha'),
|
||||
GETPOST('enabled', 'nohtml'),
|
||||
(GETPOST('totalizable', 'alpha') ? 1 : 0),
|
||||
GETPOST('printable', 'alpha'),
|
||||
array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist)
|
||||
|
|
|
|||
|
|
@ -554,9 +554,13 @@ if (!$error && $massaction == 'confirm_presend') {
|
|||
$sendcontext = 'standard';
|
||||
}
|
||||
|
||||
// Set tmp user directory (used to convert images embedded as img src=data:image)
|
||||
$vardir = $conf->user->dir_output."/".$user->id;
|
||||
$upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
|
||||
// Send mail (substitutionarray must be done just before this)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext);
|
||||
$mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp);
|
||||
if ($mailfile->error) {
|
||||
$resaction .= '<div class="error">'.$mailfile->error.'</div>';
|
||||
} else {
|
||||
|
|
|
|||
76
htdocs/core/ajax/ajaxstatusprospect.php
Normal file
76
htdocs/core/ajax/ajaxstatusprospect.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/ajaxstatusprospect.php
|
||||
* \brief File to return Ajax response on third parties request
|
||||
*/
|
||||
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
|
||||
$idstatus = GETPOST('id', 'int');
|
||||
$idprospect = GETPOST('prospectid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
if ($idprospect != $user->socid) {
|
||||
accessforbidden('Not allowed on this thirdparty');
|
||||
}
|
||||
}
|
||||
|
||||
// var_dump( $user, 'societe', $idprospect, '&societe');
|
||||
$result = restrictedArea($user, 'societe', $idprospect, '&societe');
|
||||
|
||||
$permisstiontoupdate = $user->hasRight('societe', 'creer');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
top_httphead();
|
||||
|
||||
|
||||
if ($action === "updatestatusprospect" && $permisstiontoupdate) {
|
||||
$response = '';
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql .= "fk_stcomm=".(int) $db->escape($idstatus);
|
||||
$sql .= " WHERE rowid = ".(int) $db->escape($idprospect);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
} else {
|
||||
$num = $db->affected_rows($resql);
|
||||
$response = http_response_code(200);
|
||||
}
|
||||
|
||||
$response =json_encode($response);
|
||||
echo $response;
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021-2022 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2021-2023 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -79,7 +79,7 @@ class box_members_by_tags extends ModeleBoxes
|
|||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
global $user, $langs;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max = $max;
|
||||
|
|
@ -89,9 +89,9 @@ class box_members_by_tags extends ModeleBoxes
|
|||
|
||||
$now = dol_now();
|
||||
$year = date('Y');
|
||||
$numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH");
|
||||
$numberyears = getDolGlobalInt("MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH", 0);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.($year - $numberyears).' - '.$year.')');
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").($numberyears ? ' ('.($year - $numberyears).' - '.$year.')' : ''));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
|
|
@ -119,13 +119,13 @@ class box_members_by_tags extends ModeleBoxes
|
|||
'text' => $labelstatus,
|
||||
);
|
||||
// Up to date
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now + 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus,
|
||||
);
|
||||
// Expired
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now - 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
|
|
@ -143,25 +143,24 @@ class box_members_by_tags extends ModeleBoxes
|
|||
'text' => $labelstatus
|
||||
);
|
||||
// Total row
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"',
|
||||
'text' => $langs->trans("Total")
|
||||
);
|
||||
$line++;
|
||||
foreach ($sumMembers as $key => $data) {
|
||||
$adhtype = new AdherentType($this->db);
|
||||
$adhtype->id = $key;
|
||||
$adhtag = new Categorie($this->db);
|
||||
$adhtag->id = $key;
|
||||
|
||||
if ($key=='total') {
|
||||
break;
|
||||
}
|
||||
$adhtype->label = $data['label'];
|
||||
$AdherentType[$key] = $adhtype;
|
||||
$adhtag->label = $data['label'];
|
||||
$AdherentTag[$key] = $adhtag;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $adhtype->getNomUrl(1, dol_size(32)),
|
||||
'text' => '<a href="'.$DOL_MAIN_URL_ROOT.'/adherents/list.php?search_categ='.$adhtag->id.'&sortfield=d.datefin,t.subscription&sortorder=desc,desc&backtopage='.urlencode($_SERVER['PHP_SELF']).'">'.dol_trunc(($adhtag->ref ? $adhtag->ref : $adhtag->label), dol_size(32)).'</a>',
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
|
@ -171,17 +170,17 @@ class box_members_by_tags extends ModeleBoxes
|
|||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
|
||||
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, $now + 86400, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now - 86400, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
|
@ -196,7 +195,7 @@ class box_members_by_tags extends ModeleBoxes
|
|||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''),
|
||||
'text' => (isset($data['total_adhtag']) && $data['total_adhtag'] > 0 ? $data['total_adhtag'] : ''),
|
||||
'asis' => 1,
|
||||
);
|
||||
$line++;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2015-2023 Frederic France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021-2023 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes
|
|||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->hasRight('adherent', 'lire'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,7 +79,7 @@ class box_members_by_type extends ModeleBoxes
|
|||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
global $user, $langs;
|
||||
$langs->loadLangs(array("boxes", "members"));
|
||||
|
||||
$this->max = $max;
|
||||
|
|
@ -88,160 +88,75 @@ class box_members_by_type extends ModeleBoxes
|
|||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
|
||||
$staticmember = new Adherent($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType", $max));
|
||||
$now = dol_now();
|
||||
$year = date('Y');
|
||||
$numberyears = getDolGlobalInt("MAIN_NB_OF_YEAR_IN_MEMBERSHIP_WIDGET_GRAPH");
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType").($numberyears ? ' ('.($year-$numberyears).' - '.$year.')' : ''));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
$MembersToValidate = array();
|
||||
$MembersPending = array();
|
||||
$MembersValidated = array();
|
||||
$MembersUpToDate = array();
|
||||
$MembersExcluded = array();
|
||||
$MembersResiliated = array();
|
||||
|
||||
$SumToValidate = 0;
|
||||
$SumPending = 0;
|
||||
$SumExpired = 0;
|
||||
$SumUpToDate = 0;
|
||||
$SumResiliated = 0;
|
||||
$SumExcluded = 0;
|
||||
|
||||
$AdherentType = array();
|
||||
|
||||
// Type of membership
|
||||
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
|
||||
$sql .= " d.statut, count(d.rowid) as somme";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "adherent as d";
|
||||
$sql .= " ON t.rowid = d.fk_adherent_type";
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " WHERE t.entity IN (" . getEntity('member_type') . ")";
|
||||
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$adhtype = new AdherentType($this->db);
|
||||
$adhtype->id = $objp->rowid;
|
||||
$adhtype->subscription = $objp->subscription;
|
||||
$adhtype->label = $objp->label;
|
||||
$AdherentType[$objp->rowid] = $adhtype;
|
||||
|
||||
if ($objp->statut == Adherent::STATUS_DRAFT) {
|
||||
$MembersToValidate[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == Adherent::STATUS_VALIDATED) {
|
||||
$MembersValidated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == Adherent::STATUS_EXCLUDED) {
|
||||
$MembersExcluded[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == Adherent::STATUS_RESILIATED) {
|
||||
$MembersResiliated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$now = dol_now();
|
||||
|
||||
// Members up to date list
|
||||
// current rule: uptodate = the end date is in future whatever is type
|
||||
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.statut = 1 AND (d.datefin >= '" . $this->db->idate($now) . "' OR t.subscription = 0)";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num2 = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num2) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
// Members pendding (Waiting for first subscription)
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.statut = 1 AND (d.datefin IS NULL AND t.subscription = 1)";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num2 = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num2) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MembersPending[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
|
||||
$stats = new AdherentStats($this->db, $user->socid, $user->id);
|
||||
// Show array
|
||||
$sumMembers = $stats->countMembersByTypeAndStatus($numberyears);
|
||||
if ($sumMembers) {
|
||||
$line = 0;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class=""',
|
||||
'text' => '',
|
||||
);
|
||||
// Draft
|
||||
// Members Status To Valid
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Pending (Waiting for first subscription)
|
||||
// Waiting for subscription
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus,
|
||||
);
|
||||
// Up to date
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1);
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now + 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus,
|
||||
);
|
||||
// Expired
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1);
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, $now - 86400, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Excluded
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Resiliated
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="15%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"',
|
||||
'text' => $labelstatus
|
||||
);
|
||||
// Total row
|
||||
$labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"',
|
||||
'text' => $langs->trans("Total")
|
||||
);
|
||||
$line++;
|
||||
foreach ($sumMembers as $key => $data) {
|
||||
$adhtype = new AdherentType($this->db);
|
||||
$adhtype->id = $key;
|
||||
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
|
||||
$SumPending += isset($MembersPending[$key]) ? $MembersPending[$key] : 0;
|
||||
$SumExpired += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) - (isset($MembersPending[$key]) ? $MembersPending[$key] : 0): 0;
|
||||
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
|
||||
$SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
|
||||
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
||||
if ($key=='total') {
|
||||
break;
|
||||
}
|
||||
$adhtype->label = $data['label'];
|
||||
$AdherentType[$key] = $adhtype;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
|
|
@ -250,39 +165,43 @@ class box_members_by_type extends ModeleBoxes
|
|||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersPending[$key]) && $MembersPending[$key] > 0 ? $MembersPending[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
|
||||
'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3),
|
||||
'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
if (count($sumMembers) == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'colspan="7" class="center"',
|
||||
'text' => $langs->trans("NoRecordedMembersByType")
|
||||
|
|
@ -295,32 +214,37 @@ class box_members_by_type extends ModeleBoxes
|
|||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumToValidate.' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumPending.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3),
|
||||
'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3),
|
||||
'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumExpired.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumExcluded.' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3),
|
||||
'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SumResiliated.' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3),
|
||||
'asis' => 1
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $sumMembers['total']['all'],
|
||||
'asis' => 1
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes
|
|||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->hasRight('adherent', 'lire'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
|||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->hasRight('adherent', 'lire'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -146,9 +146,10 @@ class box_members_last_subscriptions extends ModeleBoxes
|
|||
'asis' => 1,
|
||||
);
|
||||
|
||||
$daterange = get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end)),
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone" title="'.dol_escape_htmltag($daterange).'"',
|
||||
'text' => $daterange,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
|
@ -157,7 +158,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
|||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'td' => 'class="right tdoverflowmax150 maxwidth150onsmartphone" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($obj->datem, 'dayhour', 'tzuserrel')).'"',
|
||||
'text' => dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour', 'tzuserrel'),
|
||||
);
|
||||
|
||||
|
|
@ -167,7 +168,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
|||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedCustomers"),
|
||||
'text'=> '<span class="opacitymedium">'.$langs->trans("NoRecordedMembers").'</span>',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
|||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire);
|
||||
$this->hidden = !(isModEnabled('adherent') && $user->hasRight('adherent', 'lire'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -191,8 +191,8 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
|||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'colspan="4"',
|
||||
'text' => $langs->trans("NoRecordedMembers"),
|
||||
'td' => 'colspan="4" class="center"',
|
||||
'text' => '<span class="opacitymedium">'.$langs->trans("NoRecordedMembers").'</span>',
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class box_project extends ModeleBoxes
|
|||
$i++;
|
||||
}
|
||||
if ($max < $num) {
|
||||
$this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$this->info_box_contents[$i][] = array('td' => 'colspan="6"', 'text' => '...');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -207,6 +207,10 @@ class box_project extends ModeleBoxes
|
|||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class box_project_opportunities extends ModeleBoxes
|
|||
$i++;
|
||||
}
|
||||
if ($max < $num) {
|
||||
$this->info_box_contents[$i][] = array('td' => 'colspan="5"', 'text' => '...');
|
||||
$this->info_box_contents[$i][] = array('td' => 'colspan="6"', 'text' => '...');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
|
@ -196,6 +196,10 @@ class box_project_opportunities extends ModeleBoxes
|
|||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => " ",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
|||
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = !($user->hasRight('service', 'lire') && $user->hasRight('contrat', 'lire'));
|
||||
$this->hidden = !($user->hasRight('cron', 'read'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,7 +79,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
|||
$langs->load("cron");
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxScheduledJobs", $max));
|
||||
|
||||
if ($user->rights->cron->read) {
|
||||
if ($user->hasRight('cron', 'read')) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/cron/class/cronjob.class.php';
|
||||
$cronstatic = new Cronjob($this->db);
|
||||
$resultarray = array();
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
|
|||
|
||||
$out .= "\n<!-- Box ".get_class($this)." start -->\n";
|
||||
|
||||
$out .= '<div class="box boxdraggable" id="boxto_'.$this->box_id.'">'."\n";
|
||||
$out .= '<div class="box divboxtable boxdraggable" id="boxto_'.$this->box_id.'">'."\n";
|
||||
|
||||
if (!empty($head['text']) || !empty($head['sublink']) || !empty($head['subpicto']) || $nblines) {
|
||||
$out .= '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder boxtable">'."\n";
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -512,7 +512,7 @@ class CMailFile
|
|||
|
||||
// Give the message a subject
|
||||
try {
|
||||
$result = $this->message->setSubject($this->subject);
|
||||
$this->message->setSubject($this->subject);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
|
|
@ -557,6 +557,14 @@ class CMailFile
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($this->errors_to)) {
|
||||
try {
|
||||
$headers->addTextHeader('Errors-To', $this->getArrayAddress($this->errors_to));
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$this->message->setCharSet($conf->file->character_set_client);
|
||||
} catch (Exception $e) {
|
||||
|
|
@ -1237,8 +1245,8 @@ class CMailFile
|
|||
$encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047
|
||||
return $encoded;
|
||||
} else {
|
||||
$this->error = "Error: Can't read file '".$sourcefile."' into _encode_file";
|
||||
dol_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR);
|
||||
$this->error = "Error in _encode_file() method: Can't read file '".$sourcefile."'";
|
||||
dol_syslog("CMailFile::_encode_file: ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1001,6 +1001,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
// Create a prelevement_bon
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
$bon = new BonPrelevement($this->db);
|
||||
if (!$error) {
|
||||
if (empty($obj->fk_prelevement_bons)) {
|
||||
|
|
|
|||
328
htdocs/core/class/cregion.class.php
Normal file
328
htdocs/core/class/cregion.class.php
Normal file
|
|
@ -0,0 +1,328 @@
|
|||
<?php
|
||||
/* Copyright (C) Richard Rondu <rondu.richard@lainwir3d.net>
|
||||
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/cregion.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is a CRUD class file (Create/Read/Update/Delete) for c_regions dictionary
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to manage dictionary Regions
|
||||
*/
|
||||
class Cregion
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
//public $element = 'cregion'; //!< Id that identify managed objects
|
||||
//public $table_element = 'c_regions'; //!< Name of table without prefix where object is stored
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
|
||||
public $code_region;
|
||||
public $fk_pays;
|
||||
|
||||
/**
|
||||
* @var string Region name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string Region chef lieu
|
||||
*/
|
||||
public $cheflieu;
|
||||
|
||||
public $active;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code_region)) {
|
||||
$this->code_region = trim($this->code_region);
|
||||
}
|
||||
if (isset($this->fk_pays)) {
|
||||
$this->fk_pays = trim($this->fk_pays);
|
||||
}
|
||||
if (isset($this->nom)) {
|
||||
$this->nom = trim($this->nom);
|
||||
}
|
||||
if (isset($this->cheflieu)) {
|
||||
$this->cheflieu = trim($this->cheflieu);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_regions(";
|
||||
$sql .= "rowid,";
|
||||
$sql .= "code_region,";
|
||||
$sql .= "fk_pays,";
|
||||
$sql .= "nom,";
|
||||
$sql .= "cheflieu,";
|
||||
$sql .= "active";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " ".(!isset($this->rowid) ? 'NULL' : "'".$this->db->escape($this->rowid)."'").",";
|
||||
$sql .= " ".(!isset($this->code_region) ? 'NULL' : "'".$this->db->escape($this->code_region)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_pays) ? 'NULL' : "'".$this->db->escape($this->fk_pays)."'").",";
|
||||
$sql .= " ".(!isset($this->name) ? 'NULL' : "'".$this->db->escape($this->name)."'").",";
|
||||
$sql .= " ".(!isset($this->cheflieu) ? 'NULL' : "'".$this->db->escape($this->cheflieu)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'")."";
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix()."c_regions");
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $code_region Code
|
||||
* @param string $fk_pays Country Id
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
public function fetch($id, $code_region = '', $fk_pays = '')
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.rowid,";
|
||||
$sql .= " t.code_region,";
|
||||
$sql .= " t.fk_pays,";
|
||||
$sql .= " t.nom,";
|
||||
$sql .= " t.cheflieu,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_regions as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.rowid = ".((int) $id);
|
||||
} elseif ($code_region) {
|
||||
$sql .= " WHERE t.code_region = '".$this->db->escape(strtoupper($code_region))."'";
|
||||
} elseif ($fk_pays) {
|
||||
$sql .= " WHERE t.fk_pays = '".$this->db->escape(strtoupper($fk_pays))."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->code_region = $obj->code_region;
|
||||
$this->fk_pays = $obj->fk_pays;
|
||||
$this->name = $obj->nom;
|
||||
$this->cheflieu = $obj->cheflieu;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code_region)) {
|
||||
$this->code_region = trim($this->code_region);
|
||||
}
|
||||
if (isset($this->fk_pays)) {
|
||||
$this->fk_pays = trim($this->fk_pays);
|
||||
}
|
||||
if (isset($this->name)) {
|
||||
$this->name = trim($this->name);
|
||||
}
|
||||
if (isset($this->cheflieu)) {
|
||||
$this->cheflieu = trim($this->cheflieu);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".$this->db->prefix()."c_regions SET";
|
||||
$sql .= " code_region=".(isset($this->code_region) ? "'".$this->db->escape($this->code_region)."'" : "null").",";
|
||||
$sql .= " fk_pays=".(isset($this->fk_pays) ? "'".$this->db->escape($this->fk_pays)."'" : "null").",";
|
||||
$sql .= " nom=".(isset($this->name) ? "'".$this->db->escape($this->name)."'" : "null").",";
|
||||
$sql .= " cheflieu=".(isset($this->cheflieu) ? "'".$this->db->escape($this->cheflieu)."'" : "null").",";
|
||||
$sql .= " active=".(isset($this->active) ? $this->active : "null")."";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_regions";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to ('nolink', ...)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans($this->name);
|
||||
}
|
||||
}
|
||||
|
|
@ -2306,6 +2306,11 @@ class ExtraFields
|
|||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key = $value_arr;
|
||||
}
|
||||
} elseif (in_array($key_type, array('html'))) {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
}
|
||||
$value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml'));
|
||||
} else {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
|
|
|
|||
|
|
@ -7728,7 +7728,7 @@ class Form
|
|||
$out = '';
|
||||
$outarray = array();
|
||||
|
||||
$selectFields = " p.rowid, p.ref, p.firstname, p.lastname";
|
||||
$selectFields = " p.rowid, p.ref, p.firstname, p.lastname, p.fk_adherent_type";
|
||||
|
||||
$sql = "SELECT ";
|
||||
$sql .= $selectFields;
|
||||
|
|
@ -7770,7 +7770,7 @@ class Form
|
|||
|
||||
if (!$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
|
||||
$out .= ajax_combobox($htmlname, $events, !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT) ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
|
||||
}
|
||||
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
|
|
@ -7928,7 +7928,7 @@ class Form
|
|||
|
||||
dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
|
||||
$out = '';
|
||||
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->$confkeyforautocompletemode) && !$forcecombo) {
|
||||
if (!empty($conf->use_javascript_ajax) && getDolGlobalString($confkeyforautocompletemode) && !$forcecombo) {
|
||||
// No immediate load of all database
|
||||
$placeholder = '';
|
||||
if ($preselectedvalue && empty($selected_input_value)) {
|
||||
|
|
@ -8763,7 +8763,7 @@ class Form
|
|||
<dd class="dropdowndd">
|
||||
<div class="multiselectcheckbox'.$htmlname.'">
|
||||
<ul class="'.$htmlname.($pos == '1' ? 'left' : '').'">
|
||||
<li><input class="inputsearch_dropdownselectedfields width90p minwidth200" style="width:90%;" type="text" placeholder="'.$langs->trans('Search').'"></li>
|
||||
<li><input class="inputsearch_dropdownselectedfields width90p minwidth200imp" style="width:90%;" type="text" placeholder="'.$langs->trans('Search').'"></li>
|
||||
'.$listoffieldsforselection.'
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -454,6 +454,7 @@ class FormAccounting extends Form
|
|||
public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$aux_account = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
* Only common components are here.
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -56,13 +56,13 @@ class FormCompany extends Form
|
|||
$effs = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_typent";
|
||||
$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_typent";
|
||||
$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . (empty($mysoc->country_id) ? '0' : $mysoc->country_id) . ")";
|
||||
if ($filter) {
|
||||
$sql .= " ".$filter;
|
||||
$sql .= " " . $filter;
|
||||
}
|
||||
$sql .= " ORDER by position, id";
|
||||
dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . '::typent_array', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -105,13 +105,13 @@ class FormCompany extends Form
|
|||
$effs = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_effectif";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_effectif";
|
||||
$sql .= " WHERE active = 1";
|
||||
if ($filter) {
|
||||
$sql .= " ".$filter;
|
||||
$sql .= " " . $filter;
|
||||
}
|
||||
$sql .= " ORDER BY id ASC";
|
||||
dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . '::effectif_array', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -149,13 +149,13 @@ class FormCompany extends Form
|
|||
// phpcs:enable
|
||||
global $user, $langs;
|
||||
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<form method="post" action="' . $page . '">';
|
||||
print '<input type="hidden" name="action" value="setprospectlevel">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
|
||||
dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . '::form_prospect_level', LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_prospectlevel";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_prospectlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -181,9 +181,9 @@ class FormCompany extends Form
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
if (!empty($htmlname) && $user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
|
@ -200,13 +200,13 @@ class FormCompany extends Form
|
|||
{
|
||||
global $user, $langs;
|
||||
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<form method="post" action="' . $page . '">';
|
||||
print '<input type="hidden" name="action" value="setprospectcontactlevel">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_prospectcontactlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -232,9 +232,9 @@ class FormCompany extends Form
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
if (!empty($htmlname) && $user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ class FormCompany extends Form
|
|||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
|
||||
dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_departement selected=" . $selected . ", country_codeid=" . $country_codeid, LOG_DEBUG);
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
|
|
@ -283,28 +283,28 @@ class FormCompany extends Form
|
|||
|
||||
// Serch departements/cantons/province active d'une region et pays actif
|
||||
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
|
||||
$sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c";
|
||||
$sql .= " " . $this->db->prefix() . "c_departements as d, " . $this->db->prefix() . "c_regions as r," . $this->db->prefix() . "c_country as c";
|
||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
|
||||
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
|
||||
if ($country_codeid && is_numeric($country_codeid)) {
|
||||
$sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'";
|
||||
$sql .= " AND c.rowid = '" . $this->db->escape($country_codeid) . "'";
|
||||
}
|
||||
if ($country_codeid && !is_numeric($country_codeid)) {
|
||||
$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
|
||||
$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
|
||||
}
|
||||
$sql .= " ORDER BY c.code, d.code_departement";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if (!empty($htmlname)) {
|
||||
$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
|
||||
}
|
||||
if ($country_codeid) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_departement num=" . $num, LOG_DEBUG);
|
||||
if ($num) {
|
||||
$country = '';
|
||||
while ($i < $num) {
|
||||
|
|
@ -315,28 +315,30 @@ class FormCompany extends Form
|
|||
if (!$country || $country != $obj->country) {
|
||||
// Show break if we are in list with multiple countries
|
||||
if (!$country_codeid && $obj->country_code) {
|
||||
$out .= '<option value="-1" disabled data-html="----- '.$obj->country.' -----">----- '.$obj->country." -----</option>\n";
|
||||
$out .= '<option value="-1" disabled data-html="----- ' . $obj->country . ' -----">----- ' . $obj->country . " -----</option>\n";
|
||||
$country = $obj->country;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid) {
|
||||
$out .= '<option value="'.$obj->rowid.'" selected>';
|
||||
$out .= '<option value="' . $obj->rowid . '" selected>';
|
||||
} else {
|
||||
$out .= '<option value="'.$obj->rowid.'">';
|
||||
$out .= '<option value="' . $obj->rowid . '">';
|
||||
}
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
if (!empty($conf->global->MAIN_SHOW_STATE_CODE) &&
|
||||
($conf->global->MAIN_SHOW_STATE_CODE == 1 || $conf->global->MAIN_SHOW_STATE_CODE == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all')) {
|
||||
if (
|
||||
!empty($conf->global->MAIN_SHOW_STATE_CODE) &&
|
||||
($conf->global->MAIN_SHOW_STATE_CODE == 1 || $conf->global->MAIN_SHOW_STATE_CODE == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all')
|
||||
) {
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
|
||||
$out .= $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
$out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
} else {
|
||||
$out .= $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
$out .= $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1) {
|
||||
$out .= $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
$out .= $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
} else {
|
||||
$out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
|
||||
}
|
||||
|
|
@ -351,7 +353,7 @@ class FormCompany extends Form
|
|||
$out .= '</select>';
|
||||
}
|
||||
if (!empty($htmlname) && $user->admin) {
|
||||
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
|
|
@ -359,7 +361,7 @@ class FormCompany extends Form
|
|||
|
||||
// Make select dynamic
|
||||
if (!empty($htmlname)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
}
|
||||
|
||||
|
|
@ -385,14 +387,14 @@ class FormCompany extends Form
|
|||
$langs->load("dict");
|
||||
|
||||
$sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_regions as r, " . $this->db->prefix() . "c_country as c";
|
||||
$sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
|
||||
$sql .= " ORDER BY c.code, c.label ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_region", LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_region", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
|
|
@ -404,16 +406,16 @@ class FormCompany extends Form
|
|||
} else {
|
||||
if ($country == '' || $country != $obj->country) {
|
||||
// Show break
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country;
|
||||
print '<option value="-2" disabled>----- '.$valuetoshow." -----</option>\n";
|
||||
$key = $langs->trans("Country" . strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country" . strtoupper($obj->country_code)) ? $obj->country_code . " - " . $key : $obj->country;
|
||||
print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option>\n";
|
||||
$country = $obj->country;
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $obj->code) {
|
||||
print '<option value="'.$obj->code.'" selected>'.$obj->label.'</option>';
|
||||
print '<option value="' . $obj->code . '" selected>' . $obj->label . '</option>';
|
||||
} else {
|
||||
print '<option value="'.$obj->code.'">'.$obj->label.'</option>';
|
||||
print '<option value="' . $obj->code . '">' . $obj->label . '</option>';
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
|
|
@ -444,13 +446,13 @@ class FormCompany extends Form
|
|||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility";
|
||||
$sql = "SELECT rowid, code, label, active FROM " . $this->db->prefix() . "c_civility";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog("Form::select_civility", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
$out .= '<option value=""> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
|
@ -458,12 +460,12 @@ class FormCompany extends Form
|
|||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($selected == $obj->code) {
|
||||
$out .= '<option value="'.$obj->code.'" selected>';
|
||||
$out .= '<option value="' . $obj->code . '" selected>';
|
||||
} else {
|
||||
$out .= '<option value="'.$obj->code.'">';
|
||||
$out .= '<option value="' . $obj->code . '">';
|
||||
}
|
||||
// If translation exists, we use it, otherwise, we use tha had coded label
|
||||
$out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$out .= ($langs->trans("Civility" . $obj->code) != "Civility" . $obj->code ? $langs->trans("Civility" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
|
||||
$out .= '</option>';
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -475,7 +477,7 @@ class FormCompany extends Form
|
|||
|
||||
if ($addjscombo) {
|
||||
// Enhance with select2
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -525,22 +527,22 @@ class FormCompany extends Form
|
|||
|
||||
// On recherche les formes juridiques actives des pays actifs
|
||||
$sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
|
||||
$sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c";
|
||||
$sql .= " FROM " . $this->db->prefix() . "c_forme_juridique as f, " . $this->db->prefix() . "c_country as c";
|
||||
$sql .= " WHERE f.fk_pays=c.rowid";
|
||||
$sql .= " AND f.active = 1 AND c.active = 1";
|
||||
if ($country_codeid) {
|
||||
$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
|
||||
$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
|
||||
}
|
||||
if ($filter) {
|
||||
$sql .= " ".$filter;
|
||||
$sql .= " " . $filter;
|
||||
}
|
||||
$sql .= " ORDER BY c.code";
|
||||
|
||||
dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$out .= '<div id="particulier2" class="visible">';
|
||||
$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
if ($country_codeid) {
|
||||
$out .= '<option value="0"> </option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
|
||||
}
|
||||
|
|
@ -554,31 +556,31 @@ class FormCompany extends Form
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj->code) { // We exclude empty line, we will add it later
|
||||
$labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country);
|
||||
$labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
|
||||
$arraydata[$obj->code] = array('code'=>$obj->code, 'label'=>$labeljs, 'label_sort'=>$labelcountry.'_'.$labeljs, 'country_code'=>$obj->country_code, 'country'=>$labelcountry);
|
||||
$labelcountry = (($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) ? $langs->trans("Country" . $obj->country_code) : $obj->country);
|
||||
$labeljs = (($langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code) ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
|
||||
$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$arraydata = dol_sort_array($arraydata, 'label_sort', 'ASC');
|
||||
if (empty($country_codeid)) { // Introduce empty value (if $country_codeid not empty, empty value was already added)
|
||||
$arraydata[0] = array('code'=>0, 'label'=>'', 'label_sort'=>'_', 'country_code'=>'', 'country'=>'');
|
||||
$arraydata[0] = array('code' => 0, 'label' => '', 'label_sort' => '_', 'country_code' => '', 'country' => '');
|
||||
}
|
||||
|
||||
foreach ($arraydata as $key => $val) {
|
||||
if (!$country || $country != $val['country']) {
|
||||
// Show break when we are in multi country mode
|
||||
if (empty($country_codeid) && $val['country_code']) {
|
||||
$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n";
|
||||
$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n";
|
||||
$country = $val['country'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($selected > 0 && $selected == $val['code']) {
|
||||
$out .= '<option value="'.$val['code'].'" selected>';
|
||||
$out .= '<option value="' . $val['code'] . '" selected>';
|
||||
} else {
|
||||
$out .= '<option value="'.$val['code'].'">';
|
||||
$out .= '<option value="' . $val['code'] . '">';
|
||||
}
|
||||
// If translation exists, we use it, otherwise we use default label in database
|
||||
$out .= $val['label'];
|
||||
|
|
@ -587,11 +589,11 @@ class FormCompany extends Form
|
|||
}
|
||||
$out .= '</select>';
|
||||
if ($user->admin) {
|
||||
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
|
||||
// Make select dynamic
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
$out .= '</div>';
|
||||
|
|
@ -645,13 +647,13 @@ class FormCompany extends Form
|
|||
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
|
||||
if (count($events)) { // If there is some ajax events to run once selection is done, we add code here to run events
|
||||
print '<script nonce="'.getNonce().'" type="text/javascript">
|
||||
print '<script nonce="' . getNonce() . '" type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
$("#search_'.$htmlname.'").change(function() {
|
||||
var obj = '.json_encode($events).';
|
||||
$("#search_' . $htmlname . '").change(function() {
|
||||
var obj = ' . json_encode($events) . ';
|
||||
$.each(obj, function(key,values) {
|
||||
if (values.method.length) {
|
||||
runJsCodeForEvent'.$htmlname.'(values);
|
||||
runJsCodeForEvent' . $htmlname . '(values);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -659,13 +661,13 @@ class FormCompany extends Form
|
|||
});
|
||||
|
||||
// Function used to execute events when search_htmlname change
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
function runJsCodeForEvent' . $htmlname . '(obj) {
|
||||
var id = $("#' . $htmlname . '").val();
|
||||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
var htmlname = obj.htmlname;
|
||||
var showempty = obj.showempty;
|
||||
console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
|
||||
console.log("Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
|
||||
$.getJSON(url,
|
||||
{
|
||||
action: method,
|
||||
|
|
@ -695,9 +697,9 @@ class FormCompany extends Form
|
|||
</script>';
|
||||
}
|
||||
|
||||
print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
|
||||
print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />';
|
||||
print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
|
||||
print "\n" . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . "\n";
|
||||
print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />';
|
||||
print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
|
||||
return $socid;
|
||||
} else {
|
||||
// Search to list thirdparties
|
||||
|
|
@ -709,14 +711,14 @@ class FormCompany extends Form
|
|||
$sql .= ", s.address, s.zip, s.town";
|
||||
$sql .= ", dictp.code as country_code";
|
||||
}
|
||||
$sql .= " FROM ".$this->db->prefix()."societe as s";
|
||||
$sql .= " FROM " . $this->db->prefix() . "societe as s";
|
||||
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
|
||||
// For ajax search we limit here. For combo list, we limit later
|
||||
if (is_array($limitto) && count($limitto)) {
|
||||
$sql .= " AND s.rowid IN (".$this->db->sanitize(join(',', $limitto)).")";
|
||||
$sql .= " AND s.rowid IN (" . $this->db->sanitize(join(',', $limitto)) . ")";
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
|
|
@ -726,10 +728,10 @@ class FormCompany extends Form
|
|||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"';
|
||||
print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$javaScript = "window.location='".dol_escape_js($_SERVER['PHP_SELF'])."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
|
||||
print ' onChange="'.$javaScript.'"';
|
||||
$javaScript = "window.location='" . dol_escape_js($_SERVER['PHP_SELF']) . "?" . $var_id . "=" . ($forceid > 0 ? $forceid : $object->id) . $moreparam . "&" . $htmlname . "=' + form." . $htmlname . ".options[form." . $htmlname . ".selectedIndex].value;";
|
||||
print ' onChange="' . $javaScript . '"';
|
||||
}
|
||||
print '>';
|
||||
print '<option value="-1"> </option>';
|
||||
|
|
@ -747,18 +749,18 @@ class FormCompany extends Form
|
|||
$disabled = 1;
|
||||
}
|
||||
if ($selected > 0 && $selected == $obj->rowid) {
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
print '<option value="' . $obj->rowid . '"';
|
||||
if ($disabled) {
|
||||
print ' disabled';
|
||||
}
|
||||
print ' selected>'.dol_trunc($obj->name, 24).'</option>';
|
||||
print ' selected>' . dol_trunc($obj->name, 24) . '</option>';
|
||||
$firstCompany = $obj->rowid;
|
||||
} else {
|
||||
print '<option value="'.$obj->rowid.'"';
|
||||
print '<option value="' . $obj->rowid . '"';
|
||||
if ($disabled) {
|
||||
print ' disabled';
|
||||
}
|
||||
print '>'.dol_trunc($obj->name, 24).'</option>';
|
||||
print '>' . dol_trunc($obj->name, 24) . '</option>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -795,20 +797,20 @@ class FormCompany extends Form
|
|||
if (is_object($object) && method_exists($object, 'liste_type_contact')) {
|
||||
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
|
||||
|
||||
$out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out .= '<select class="flat valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
if ($showempty) {
|
||||
$out .= '<option value="0"> </option>';
|
||||
}
|
||||
foreach ($lesTypes as $key => $value) {
|
||||
$out .= '<option value="'.$key.'"';
|
||||
$out .= '<option value="' . $key . '"';
|
||||
if ($key == $selected) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= '>'.$value.'</option>';
|
||||
$out .= '>' . $value . '</option>';
|
||||
}
|
||||
$out .= "</select>";
|
||||
if ($user->admin && empty($forcehidetooltip)) {
|
||||
$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
|
@ -837,9 +839,9 @@ class FormCompany extends Form
|
|||
if ($rendermode === 'view') {
|
||||
$toprint = array();
|
||||
foreach ($contact->roles as $key => $val) {
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val['label'].'</li>';
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val['label'] . '</li>';
|
||||
}
|
||||
return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.'"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
|
||||
return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
|
||||
}
|
||||
|
||||
if ($rendermode === 'edit') {
|
||||
|
|
@ -885,14 +887,14 @@ class FormCompany extends Form
|
|||
|
||||
$size = '';
|
||||
if (!empty($fieldsize)) {
|
||||
$size = 'size="'.$fieldsize.'"';
|
||||
$size = 'size="' . $fieldsize . '"';
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
|
||||
$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n";
|
||||
$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n";
|
||||
$moreattrib .= ' autocomplete="off"';
|
||||
}
|
||||
$out .= '<input id="'.$htmlname.'" class="maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" type="text"'.($moreattrib ? ' '.$moreattrib : '').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
|
||||
$out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ($morecss ? ' ' . $morecss : '') . '" type="text"' . ($moreattrib ? ' ' . $moreattrib : '') . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . "\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
|
@ -965,10 +967,10 @@ class FormCompany extends Form
|
|||
$out = '';
|
||||
|
||||
// Execute hook getInputIdProf to complete or replace $out
|
||||
$parameters = array('formlength'=>$formlength, 'selected'=>$preselected, 'idprof'=>$idprof, 'htmlname'=>$htmlname, 'country_code'=>$country_code);
|
||||
$parameters = array('formlength' => $formlength, 'selected' => $preselected, 'idprof' => $idprof, 'htmlname' => $htmlname, 'country_code' => $country_code);
|
||||
$reshook = $hookmanager->executeHooks('getInputIdProf', $parameters);
|
||||
if (empty($reshook)) {
|
||||
$out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
|
||||
$out .= '<input type="text" ' . ($morecss ? 'class="' . $morecss . '" ' : '') . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">';
|
||||
}
|
||||
$out .= $hookmanager->resPrint;
|
||||
|
||||
|
|
@ -999,9 +1001,9 @@ class FormCompany extends Form
|
|||
$i = 0;
|
||||
while ($i < $nbvalues) {
|
||||
if ($selected == $valors[$i]) {
|
||||
print '<option value="'.$valors[$i].'" selected>';
|
||||
print '<option value="' . $valors[$i] . '" selected>';
|
||||
} else {
|
||||
print '<option value="'.$valors[$i].'">';
|
||||
print '<option value="' . $valors[$i] . '">';
|
||||
}
|
||||
print $valors[$i];
|
||||
print '</option>';
|
||||
|
|
@ -1027,10 +1029,10 @@ class FormCompany extends Form
|
|||
{
|
||||
global $conf, $langs;
|
||||
if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && !isModEnabled('fournisseur')) {
|
||||
return '' ;
|
||||
return '';
|
||||
}
|
||||
|
||||
$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
|
||||
$out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">';
|
||||
if ($typeinput == 'form') {
|
||||
if ($allowempty || ($selected == '' || $selected == '-1')) {
|
||||
$out .= '<option value="-1">';
|
||||
|
|
@ -1042,33 +1044,33 @@ class FormCompany extends Form
|
|||
$out .= '</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
||||
$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
|
||||
$out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
|
||||
$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
|
||||
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
|
||||
$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
|
||||
}
|
||||
$out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
|
||||
$out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
|
||||
} elseif ($typeinput == 'list') {
|
||||
$out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'> </option>';
|
||||
$out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '> </option>';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
|
||||
$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
|
||||
$out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
|
||||
$out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
|
||||
$out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
|
||||
}
|
||||
if (isModEnabled("fournisseur")) {
|
||||
$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
|
||||
$out .= '<option value="4"' . ($selected == '4' ? ' selected' : '') . '>' . $langs->trans('Supplier') . '</option>';
|
||||
}
|
||||
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
|
||||
$out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>';
|
||||
} elseif ($typeinput == 'admin') {
|
||||
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
|
||||
$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
|
||||
}
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
|
||||
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
|
||||
$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
|
|
@ -1094,12 +1096,12 @@ class FormCompany extends Form
|
|||
|
||||
$out = '';
|
||||
if ($htmlname != "none") {
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<form method="post" action="' . $page . '">';
|
||||
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
|
||||
$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
|
||||
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
|
||||
$out .= '</form>';
|
||||
} else {
|
||||
if ($selected > 0) {
|
||||
|
|
@ -1117,4 +1119,57 @@ class FormCompany extends Form
|
|||
print $out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Output html select to select prospect status
|
||||
*
|
||||
* @param string $htmlname Name of HTML select
|
||||
* @param Societe|null $prospectstatic Prospect object
|
||||
* @param int $statusprospect status of prospect
|
||||
* @param int $idprospect id of prospect
|
||||
* @param string $mode select if we want activate de html part or js
|
||||
* @return void
|
||||
*/
|
||||
public function selectProspectStatus($htmlname, Societe $prospectstatic, $statusprospect, $idprospect, $mode = "html")
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode === "html") {
|
||||
//print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']);
|
||||
print img_action('', $prospectstatic->cacheprospectstatus[$statusprospect]['code'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto'], 'class="inline-block valignmiddle paddingright"');
|
||||
print '<select class="flat selectprospectstatus maxwidth150" id="'. $htmlname.$idprospect .'" data-socid="'.$idprospect.'" name="' . $htmlname .'">';
|
||||
foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
|
||||
$titlealt = (empty($val['label']) ? 'default' : $val['label']);
|
||||
$label = $val['label'];
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) {
|
||||
$titlealt = $val['label'];
|
||||
$label = (($langs->trans("StatusProspect".$val['code']) != "StatusProspect".$val['code']) ? $langs->trans("StatusProspect".$val['code']) : $label);
|
||||
} else {
|
||||
$label = (($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id']) ? $langs->trans("StatusProspect".$val['id']) : $label);
|
||||
}
|
||||
print '<option value="'.$val['id'].'" data-html="'.dol_escape_htmltag(img_action('', $val['code'], $val['picto']).' '.$label).'" title="'.dol_escape_htmltag($label).'"'.($statusprospect == $val['id'] ? ' selected' : '').'>';
|
||||
print dol_escape_htmltag($label);
|
||||
print '</option>';
|
||||
}
|
||||
print '</select>';
|
||||
print ajax_combobox($htmlname.$idprospect);
|
||||
} elseif ($mode === "js") {
|
||||
print '<script>
|
||||
jQuery(document).ready(function() {
|
||||
$(".selectprospectstatus").on("change", function() {
|
||||
console.log("We change a value into a field selectprospectstatus");
|
||||
var statusid = $(this).val();
|
||||
var prospectid = $(this).attr("data-socid");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\',
|
||||
data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\'},
|
||||
success: function(response) {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class FormContract
|
|||
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
|
||||
$sql .= " AND (c.fk_soc=".((int) $socid)." OR c.fk_soc IS NULL)";
|
||||
} elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {
|
||||
$sql .= " AND (c.fk_soc IN (".$this->db->sanitize($socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY).") ";
|
||||
$sql .= " AND (c.fk_soc IN (".$this->db->sanitize(((int) $socid).",".((int) $conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)).")";
|
||||
$sql .= " OR c.fk_soc IS NULL)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -341,7 +341,8 @@ class FormTicket
|
|||
if ($public) {
|
||||
$filter = 'public=1';
|
||||
}
|
||||
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', $filter, 2, 1, 0, 0, 'minwidth200');
|
||||
$selected = (GETPOST('category_code') ? GETPOST('category_code') : $this->category_code);
|
||||
$this->selectGroupTickets($selected, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity => Priority
|
||||
|
|
@ -807,8 +808,10 @@ class FormTicket
|
|||
}
|
||||
$outputlangs->load("ticket");
|
||||
|
||||
$publicgroups = ($filtertype == 'public=1' || $filtertype == '(public:=:1)');
|
||||
|
||||
$ticketstat = new Ticket($this->db);
|
||||
$ticketstat->loadCacheCategoriesTickets();
|
||||
$ticketstat->loadCacheCategoriesTickets($publicgroups ? 1 : -1); // get list of active ticket groups
|
||||
|
||||
if ($use_multilevel <= 0) {
|
||||
print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
|
||||
|
|
@ -819,7 +822,7 @@ class FormTicket
|
|||
if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) {
|
||||
foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) {
|
||||
// Exclude some record
|
||||
if ($filtertype == 'public=1') {
|
||||
if ($publicgroups) {
|
||||
if (empty($arraycategories['public'])) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1368,31 +1371,37 @@ class FormTicket
|
|||
}
|
||||
jQuery(".email_line").hide();
|
||||
}
|
||||
';
|
||||
|
||||
jQuery("#send_msg_email").click(function() {
|
||||
if(jQuery(this).is(":checked")) {
|
||||
if (jQuery("#private_message").is(":checked")) {
|
||||
jQuery("#private_message").prop("checked", false).trigger("change");
|
||||
// If constant set, allow to send private messages as email
|
||||
if (empty($conf->global->TICKET_SEND_PRIVATE_EMAIL)) {
|
||||
print 'jQuery("#send_msg_email").click(function() {
|
||||
if(jQuery(this).is(":checked")) {
|
||||
if (jQuery("#private_message").is(":checked")) {
|
||||
jQuery("#private_message").prop("checked", false).trigger("change");
|
||||
}
|
||||
jQuery(".email_line").show();
|
||||
}
|
||||
jQuery(".email_line").show();
|
||||
}
|
||||
else {
|
||||
jQuery(".email_line").hide();
|
||||
}
|
||||
});
|
||||
else {
|
||||
jQuery(".email_line").hide();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery("#private_message").click(function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
if (jQuery("#send_msg_email").is(":checked")) {
|
||||
jQuery("#send_msg_email").prop("checked", false).trigger("change");
|
||||
jQuery("#private_message").click(function() {
|
||||
if (jQuery(this).is(":checked")) {
|
||||
if (jQuery("#send_msg_email").is(":checked")) {
|
||||
jQuery("#send_msg_email").prop("checked", false).trigger("change");
|
||||
}
|
||||
jQuery(".email_line").hide();
|
||||
}
|
||||
jQuery(".email_line").hide();
|
||||
}
|
||||
});';
|
||||
});';
|
||||
}
|
||||
|
||||
print '});
|
||||
</script>';
|
||||
|
||||
print '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
|
||||
|
||||
print '<form method="post" name="ticket" id="ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="'.$this->action.'">';
|
||||
print '<input type="hidden" name="actionbis" value="add_message">';
|
||||
|
|
@ -1544,6 +1553,14 @@ class FormTicket
|
|||
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out .= '<script nonce="'.getNonce().'" type="text/javascript">';
|
||||
$out .= 'jQuery(document).ready(function () {';
|
||||
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", true);';
|
||||
$out .= ' jQuery("#addedfile").on("change", function() {';
|
||||
$out .= ' if (jQuery(this).val().length) {';
|
||||
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", false);';
|
||||
$out .= ' } else {';
|
||||
$out .= ' jQuery("#'.$addfileaction.'").prop("disabled", true);';
|
||||
$out .= ' }';
|
||||
$out .= ' });';
|
||||
$out .= ' jQuery(".removedfile").click(function() {';
|
||||
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
|
||||
$out .= ' });';
|
||||
|
|
@ -1637,8 +1654,13 @@ class FormTicket
|
|||
print '</table>';
|
||||
|
||||
print '<center><br>';
|
||||
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("Add").'" />';
|
||||
if ($this->withcancel) {
|
||||
print '<input type="submit" class="button" name="btn_add_message" value="'.$langs->trans("Add").'"';
|
||||
// Add a javascript test to avoid to forget to submit file before sending email
|
||||
if ($this->withfile == 2 && !empty($conf->use_javascript_ajax)) {
|
||||
print ' onClick="if (document.ticket.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
|
||||
}
|
||||
print ' />';
|
||||
if (!empty($this->withcancel)) {
|
||||
print " ";
|
||||
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
|
|
@ -1647,6 +1669,23 @@ class FormTicket
|
|||
print '<input type="hidden" name="page_y">'."\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
|
||||
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
|
||||
print '<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {';
|
||||
print ' $(document).on("keypress", \'#ticket\', function (e) { /* Note this is called at every key pressed ! */
|
||||
var code = e.keyCode || e.which;
|
||||
if (code == 13) {
|
||||
console.log("Enter was intercepted and blocked");
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});';
|
||||
print '})';
|
||||
print '</script>';
|
||||
}
|
||||
|
||||
print "<!-- End form TICKET -->\n";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,6 +231,22 @@ class SMTPs
|
|||
// @CHANGE LDR
|
||||
public $log = '';
|
||||
public $lastretval = '';
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
public $socket;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $errno;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $errstr;
|
||||
|
||||
private $_errorsTo = '';
|
||||
private $_deliveryReceipt = 0;
|
||||
private $_trackId = '';
|
||||
|
|
|
|||
|
|
@ -238,6 +238,9 @@ class DoliDBMysqli extends DoliDB
|
|||
// return mysqli::real_connect($host, $user, $pass, $db, $port);
|
||||
$tmp = false;
|
||||
try {
|
||||
if (!class_exists('mysqli')) {
|
||||
dol_print_error('', 'Driver mysqli for PHP not available');
|
||||
}
|
||||
$tmp = new mysqli($host, $login, $passwd, $name, $port);
|
||||
} catch (Exception $e) {
|
||||
dol_syslog(get_class($this)."::connect failed", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ function societe_prepare_head(Societe $object)
|
|||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) {
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight('societe', 'contact', 'lire')) {
|
||||
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||
$nbContact = 0;
|
||||
// Enable caching of thirdrparty count Contacts
|
||||
|
|
@ -2367,9 +2367,9 @@ function htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage = 0, $suffi
|
|||
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
|
||||
print '<!-- htmlPrintOnlinePaymentFooter -->'."\n";
|
||||
print '<!-- htmlPrintOnlineFooter -->'."\n";
|
||||
|
||||
print '<footer class="center paddingleft paddingright opacitymedium">'."\n";
|
||||
print '<footer class="center paddingleft paddingright opacitymedium centpercent">'."\n";
|
||||
print '<br>';
|
||||
if ($addformmessage) {
|
||||
print '<!-- object = '.(empty($object) ? 'undefined' : $object->element).' -->';
|
||||
|
|
|
|||
|
|
@ -3259,7 +3259,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$partsofdirinoriginalfile = explode('/', $original_file);
|
||||
if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use)
|
||||
$partofdirinoriginalfile = $partsofdirinoriginalfile[0];
|
||||
if ($partofdirinoriginalfile && !empty($fuser->rights->$modulepart->$partofdirinoriginalfile) && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) {
|
||||
if ($partofdirinoriginalfile && ($fuser->hasRight($modulepart, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($modulepart, $partofdirinoriginalfile, 'read'))) {
|
||||
$accessallowed = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -3353,6 +3353,17 @@ function dol_readcachefile($directory, $filename)
|
|||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relative dirname (relative to DOL_DATA_ROOT) of a full path string.
|
||||
*
|
||||
* @param string $pathfile Full path of a file
|
||||
* @return string Path of file relative to DOL_DATA_ROOT
|
||||
*/
|
||||
function dirbasename($pathfile)
|
||||
{
|
||||
return preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'\//', '', $pathfile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to get list of updated or modified files.
|
||||
|
|
@ -3423,7 +3434,7 @@ function dragAndDropFileUpload($htmlname)
|
|||
$("#'.$htmlname.'").addClass("cssDragDropArea");
|
||||
$(".cssDragDropArea").on("dragenter", function(ev) {
|
||||
// Entering drop area. Highlight area
|
||||
console.log("We add class highlightDragDropArea")
|
||||
console.log("dragAndDropFileUpload: We add class highlightDragDropArea")
|
||||
enterTargetDragDrop = ev.target;
|
||||
$(this).addClass("highlightDragDropArea");
|
||||
$("#'.$htmlname.'Message").removeClass("hidden");
|
||||
|
|
@ -3433,7 +3444,7 @@ function dragAndDropFileUpload($htmlname)
|
|||
$(".cssDragDropArea").on("dragleave", function(ev) {
|
||||
// Going out of drop area. Remove Highlight
|
||||
if (enterTargetDragDrop == ev.target){
|
||||
console.log("We remove class highlightDragDropArea")
|
||||
console.log("dragAndDropFileUpload: We remove class highlightDragDropArea")
|
||||
$("#'.$htmlname.'Message").addClass("hidden");
|
||||
$(this).removeClass("highlightDragDropArea");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2019-2023 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
|
|
@ -952,7 +952,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'aZ09arobase': // great to sanitize objecttype parameter
|
||||
case 'aZ09arobase': // great to sanitize $objecttype parameter
|
||||
if (!is_array($out)) {
|
||||
$out = trim($out);
|
||||
if (preg_match('/[^a-z0-9_\-\.@]+/i', $out)) {
|
||||
|
|
@ -960,7 +960,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'aZ09comma': // great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh
|
||||
case 'aZ09comma': // great to sanitize $sortfield or $sortorder params that can be 't.abc,t.def_gh'
|
||||
if (!is_array($out)) {
|
||||
$out = trim($out);
|
||||
if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) {
|
||||
|
|
@ -968,9 +968,6 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'nohtml': // No html
|
||||
$out = dol_string_nohtmltag($out, 0);
|
||||
break;
|
||||
case 'alpha': // No html and no ../ and "
|
||||
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
|
||||
if (!is_array($out)) {
|
||||
|
|
@ -1002,6 +999,9 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options
|
|||
} while ($oldstringtoclean != $out);
|
||||
}
|
||||
break;
|
||||
case 'nohtml': // No html
|
||||
$out = dol_string_nohtmltag($out, 0);
|
||||
break;
|
||||
case 'restricthtml': // Recommended for most html textarea
|
||||
case 'restricthtmlnolink':
|
||||
case 'restricthtmlallowunvalid':
|
||||
|
|
@ -1623,6 +1623,7 @@ function dol_strtolower($string, $encoding = "UTF-8")
|
|||
* @param string $string String to encode
|
||||
* @param string $encoding Character set encoding
|
||||
* @return string String converted
|
||||
* @see dol_ucfirst(), dol_ucwords()
|
||||
*/
|
||||
function dol_strtoupper($string, $encoding = "UTF-8")
|
||||
{
|
||||
|
|
@ -1639,6 +1640,7 @@ function dol_strtoupper($string, $encoding = "UTF-8")
|
|||
* @param string $string String to encode
|
||||
* @param string $encoding Character set encodign
|
||||
* @return string String converted
|
||||
* @see dol_strtoupper(), dol_ucwords()
|
||||
*/
|
||||
function dol_ucfirst($string, $encoding = "UTF-8")
|
||||
{
|
||||
|
|
@ -1650,11 +1652,12 @@ function dol_ucfirst($string, $encoding = "UTF-8")
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert first character of all the words of a string to upper. Never use ucfirst because it does not works with UTF8 strings.
|
||||
* Convert first character of all the words of a string to upper.
|
||||
*
|
||||
* @param string $string String to encode
|
||||
* @param string $encoding Character set encodign
|
||||
* @return string String converted
|
||||
* @see dol_strtoupper(), dol_ucfirst()
|
||||
*/
|
||||
function dol_ucwords($string, $encoding = "UTF-8")
|
||||
{
|
||||
|
|
@ -2340,14 +2343,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
|||
}
|
||||
} elseif ($object->element == 'product') {
|
||||
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
|
||||
if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
if (!empty($conf->use_javascript_ajax) && $user->hasRight('produit', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
|
||||
} else {
|
||||
$morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(6, 0).'</span>';
|
||||
}
|
||||
$morehtmlstatus .= ' ';
|
||||
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
|
||||
if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
if (!empty($conf->use_javascript_ajax) && $user->hasRight('produit', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
|
||||
} else {
|
||||
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
|
||||
|
|
@ -4499,9 +4502,10 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
|
|||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @param string $moreatt More attributes
|
||||
* @return string Return an img tag
|
||||
*/
|
||||
function img_action($titlealt, $numaction, $picto = '')
|
||||
function img_action($titlealt, $numaction, $picto = '', $moreatt = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
|
@ -4530,7 +4534,7 @@ function img_action($titlealt, $numaction, $picto = '')
|
|||
$numaction = 0;
|
||||
}
|
||||
|
||||
return img_picto($titlealt, !empty($picto) ? $picto : 'stcomm'.$numaction.'.png');
|
||||
return img_picto($titlealt, (empty($picto) ? 'stcomm'.$numaction.'.png' : $picto), $moreatt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -7391,6 +7395,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
|||
* @param string $pagecodefrom Pagecode stringtoencode is encoded
|
||||
* @param int $removelasteolbr 1=Remove last br or lasts \n (default), 0=Do nothing
|
||||
* @return string String encoded
|
||||
* @see dolGetFirstLineOfText()
|
||||
*/
|
||||
function dol_htmlentitiesbr($stringtoencode, $nl2brmode = 0, $pagecodefrom = 'UTF-8', $removelasteolbr = 1)
|
||||
{
|
||||
|
|
@ -7716,7 +7721,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
'__USER_JOB__' => (string) $user->job,
|
||||
'__USER_REMOTE_IP__' => (string) getUserRemoteIP()
|
||||
'__USER_REMOTE_IP__' => (string) getUserRemoteIP(),
|
||||
'__USER_VCARD_URL__' => (string) $user->getOnlineVirtualCardUrl('', 'external')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -8931,6 +8937,22 @@ function utf8_check($str)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is in UTF8
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @return boolean True if string is valid UTF8 string, false if corrupted
|
||||
*/
|
||||
function utf8_valid($str)
|
||||
{
|
||||
/* 2 other methods to test if string is utf8
|
||||
$validUTF8 = mb_check_encoding($messagetext, 'UTF-8');
|
||||
$validUTF8b = ! (false === mb_detect_encoding($messagetext, 'UTF-8', true));
|
||||
*/
|
||||
return preg_match('//u', $str) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a string is in ASCII
|
||||
*
|
||||
|
|
@ -12122,6 +12144,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$sql .= " a.percent as percent, 'action' as type,";
|
||||
$sql .= " a.fk_element, a.elementtype,";
|
||||
$sql .= " a.fk_contact,";
|
||||
$sql .= " a.email_from as msg_from,";
|
||||
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
|
|
@ -12321,6 +12344,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
'userfirstname'=>$obj->user_firstname,
|
||||
'userlastname'=>$obj->user_lastname,
|
||||
'userphoto'=>$obj->user_photo,
|
||||
'msg_from'=>$obj->msg_from,
|
||||
|
||||
'contact_id'=>$obj->fk_contact,
|
||||
'socpeopleassigned' => $contactaction->socpeopleassigned,
|
||||
|
|
@ -12384,6 +12408,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$userstatic = new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$userGetNomUrlCache = array();
|
||||
$contactGetNomUrlCache = array();
|
||||
|
||||
$out .= '<div class="filters-container" >';
|
||||
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
|
@ -12545,6 +12570,15 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
$userGetNomUrlCache[$histo[$key]['userid']] = $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
|
||||
}
|
||||
$out .= $userGetNomUrlCache[$histo[$key]['userid']];
|
||||
} elseif (!empty($histo[$key]['msg_from']) && $actionstatic->code == 'TICKET_MSG') {
|
||||
if (!isset($contactGetNomUrlCache[$histo[$key]['msg_from']])) {
|
||||
if ($contactstatic->fetch(0, null, '', $histo[$key]['msg_from']) > 0) {
|
||||
$contactGetNomUrlCache[$histo[$key]['msg_from']] = $contactstatic->getNomUrl(-1, '', 16);
|
||||
} else {
|
||||
$contactGetNomUrlCache[$histo[$key]['msg_from']] = $histo[$key]['msg_from'];
|
||||
}
|
||||
}
|
||||
$out .= $contactGetNomUrlCache[$histo[$key]['msg_from']];
|
||||
}
|
||||
$out .= '</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1280,7 +1280,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||
$counter = 0;
|
||||
$sql = "SELECT MAX(".$sqlstring.") as val";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'";
|
||||
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (!empty($conf->global->SEARCH_FOR_NEXT_VAL_ON_START_ONLY) ? "%" : "") . "'";
|
||||
$sql .= " AND ".$field." NOT LIKE '(PROV%)'";
|
||||
|
||||
// To ensure that all variables within the MAX() brackets are integers
|
||||
|
|
@ -1346,7 +1346,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||
$ref = '';
|
||||
$sql = "SELECT ".$field." as ref";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike)."'";
|
||||
$sql .= " WHERE ".$field." LIKE '".$db->escape($maskLike) . (!empty($conf->global->SEARCH_FOR_NEXT_VAL_ON_START_ONLY) ? "%" : "") . "'";
|
||||
$sql .= " AND ".$field." NOT LIKE '%PROV%'";
|
||||
if ($bentityon) { // only if entity enable
|
||||
$sql .= " AND entity IN (".getEntity($sharetable).")";
|
||||
|
|
@ -1408,7 +1408,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||
$maskrefclient_sql = "SELECT MAX(".$maskrefclient_sqlstring.") as val";
|
||||
$maskrefclient_sql .= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
//$sql.= " WHERE ".$field." not like '(%'";
|
||||
$maskrefclient_sql .= " WHERE ".$field." LIKE '".$db->escape($maskrefclient_maskLike)."'";
|
||||
$maskrefclient_sql .= " WHERE ".$field." LIKE '".$db->escape($maskrefclient_maskLike) . (!empty($conf->global->SEARCH_FOR_NEXT_VAL_ON_START_ONLY) ? "%" : "") . "'";
|
||||
if ($bentityon) { // only if entity enable
|
||||
$maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")";
|
||||
} elseif (!empty($forceentity)) {
|
||||
|
|
|
|||
|
|
@ -2547,11 +2547,12 @@ function pdf_getSizeForImage($realpath)
|
|||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return string Return total of line excl tax
|
||||
* @return float Return total of line excl tax
|
||||
*/
|
||||
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$sign = 1;
|
||||
if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) {
|
||||
$sign = -1;
|
||||
|
|
@ -2574,8 +2575,12 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
|
|||
|
||||
$action = '';
|
||||
|
||||
if ($hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action) > 0) {
|
||||
return $hookmanager->resPrint; // Note that $action and $object may have been modified by some hooks
|
||||
if ($hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action) > 0) { // Note that $action and $object may have been modified by some hooks
|
||||
if (isset($hookmanager->resArray['linetotalremise'])) {
|
||||
return $hookmanager->resArray['linetotalremise'];
|
||||
} else {
|
||||
return (float) $hookmanager->resPrint; // For backward compatibility
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2583,5 +2588,5 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails =
|
|||
return $sign * (($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ function product_prepare_head($object)
|
|||
}
|
||||
|
||||
if ($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { // If physical product we can stock (or service with option)
|
||||
if (isModEnabled('stock') && $user->rights->stock->lire) {
|
||||
if (isModEnabled('stock') && $user->hasRight('stock', 'lire')) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("Stock");
|
||||
$head[$h][2] = 'stock';
|
||||
|
|
@ -457,7 +457,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier proposals
|
||||
if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
|
||||
if (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire')) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_proposal_supplier($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -495,7 +495,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier orders
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire'))) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_commande_fournisseur($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -552,7 +552,7 @@ function show_stats_for_company($product, $socid)
|
|||
print '</tr>';
|
||||
}
|
||||
// Supplier invoices
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_facture_fournisseur($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
@ -592,7 +592,7 @@ function show_stats_for_company($product, $socid)
|
|||
}
|
||||
|
||||
// BOM
|
||||
if (isModEnabled('bom') && $user->rights->bom->read) {
|
||||
if (isModEnabled('bom') && $user->hasRight('bom', 'read')) {
|
||||
$nblines++;
|
||||
$ret = $product->load_stats_bom($socid);
|
||||
if ($ret < 0) {
|
||||
|
|
|
|||
|
|
@ -456,6 +456,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
|
|||
if ($featureforlistofmodule == 'produit') {
|
||||
$featureforlistofmodule = 'product';
|
||||
}
|
||||
if ($featureforlistofmodule == 'supplier_proposal') {
|
||||
$featureforlistofmodule = 'supplierproposal';
|
||||
}
|
||||
if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users
|
||||
$readok = 0;
|
||||
$nbko++;
|
||||
|
|
@ -845,10 +848,13 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||
$dbtablename = 'actioncomm';
|
||||
}
|
||||
|
||||
if ($feature == 'payment_sc') {
|
||||
$feature = "chargesociales";
|
||||
}
|
||||
$checkonentitydone = 0;
|
||||
|
||||
// Array to define rules of checks to do
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company)
|
||||
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment','chargesociales'); // Test on entity only (Objects with no link to company)
|
||||
$checksoc = array('societe'); // Test for object Societe
|
||||
$checkother = array('agenda', 'contact', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
|
||||
$checkproject = array('projet', 'project'); // Test for project object
|
||||
|
|
|
|||
|
|
@ -65,11 +65,12 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
|
|||
}
|
||||
$sql .= ") AND ".$entitycol." IN (0,".($entity ? ((int) $entity) : 1).")";
|
||||
$sql .= " AND statut = 1";
|
||||
// Note: Test on validity is done later
|
||||
// Order is required to firstly found the user into entity, then the superadmin.
|
||||
// For the case (TODO: we must avoid that) a user has renamed its login with same value than a user in entity 0.
|
||||
$sql .= " ORDER BY entity DESC";
|
||||
|
||||
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
|
||||
|
||||
|
||||
|
|
@ -41,34 +39,87 @@
|
|||
*/
|
||||
function check_user_password_googleoauth($usertotest, $passwordtotest, $entitytotest)
|
||||
{
|
||||
global $_POST, $db, $conf, $langs;
|
||||
global $_POST, $conf;
|
||||
|
||||
dol_syslog("functions_googleoauth::check_user_password_googleoauth usertotest=".$usertotest);
|
||||
dol_syslog("functions_googleoauth::check_user_password_googleoauth usertotest=".$usertotest." GETPOST('actionlogin')=".GETPOST('actionlogin'));
|
||||
|
||||
$login = '';
|
||||
|
||||
// Get identity from user and redirect browser to Google OAuth Server
|
||||
if (GETPOSTISSET('username')) {
|
||||
/*$openid = new SimpleOpenID();
|
||||
$openid->SetIdentity(GETPOST('username'));
|
||||
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
|
||||
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
|
||||
$openid->SetRequiredFields(array('email','fullname'));
|
||||
$_SESSION['dol_entity'] = $_POST["entity"];
|
||||
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
|
||||
if ($openid->sendDiscoveryRequestToGetXRDS())
|
||||
{
|
||||
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
|
||||
$openid->Redirect(); // This will redirect user to OpenID Server
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $openid->GetError();
|
||||
return false;
|
||||
}
|
||||
return false;*/
|
||||
}
|
||||
if (GETPOST('actionlogin') == 'login') {
|
||||
if (GETPOST('beforeoauthloginredirect')) {
|
||||
// We post the form on the login page by clicking on the link to login using Google.
|
||||
dol_syslog("We post the form on the login page by clicking on the link to login using Google");
|
||||
|
||||
// We save data of form into a variable
|
||||
$_SESSION['datafromloginform'] = array(
|
||||
'entity'=>GETPOST('entity', 'int'),
|
||||
'backtopage'=>GETPOST('backtopage'),
|
||||
'tz'=>GETPOST('tz'),
|
||||
'tzstring'=>GETPOST('tzstring'),
|
||||
'dst_observed'=>GETPOST('dst_observed'),
|
||||
'dst_first'=>GETPOST('dst_first'),
|
||||
'dst_second'=>GETPOST('dst_second'),
|
||||
'screenwidth'=>GETPOST('screenwidth'),
|
||||
'screenheight'=>GETPOST('screenheight'),
|
||||
'dol_hide_topmenu'=>GETPOST('dol_hide_topmenu'),
|
||||
'dol_hide_leftmenu'=>GETPOST('dol_hide_leftmenu'),
|
||||
'dol_optimize_smallscreen'=>GETPOST('dol_optimize_smallscreen'),
|
||||
'dol_no_mouse_hover'=>GETPOST('dol_no_mouse_hover'),
|
||||
'dol_use_jmobile'=>GETPOST('dol_use_jmobile')
|
||||
);
|
||||
|
||||
// Make the redirect to the google_authcallback.php page to start the redirect to Google OAUTH.
|
||||
|
||||
// Define $urlwithroot
|
||||
//global $dolibarr_main_url_root;
|
||||
//$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
//$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
//$shortscope = 'userinfo_email,userinfo_profile';
|
||||
$shortscope = 'openid,email,profile'; // For openid connect
|
||||
|
||||
$oauthstateanticsrf = bin2hex(random_bytes(128/8));
|
||||
$_SESSION['oauthstateanticsrf'] = $shortscope.'-'.$oauthstateanticsrf;
|
||||
|
||||
$url = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode('forlogin-'.$shortscope.'-'.$oauthstateanticsrf).'&username='.urlencode($usertotest);
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (GETPOST('afteroauthloginreturn')) {
|
||||
// We reach this code after a call of a redirect to the targeted page from the callback url page of Google OAUTH2
|
||||
dol_syslog("We reach the code after a call of a redirect to the targeted page from the callback url page of Google OAUTH2");
|
||||
|
||||
$tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']);
|
||||
|
||||
if (!empty($tmparray)) {
|
||||
$_POST['entity'] = $tmparray['entity'];
|
||||
$_POST['backtopage'] = $tmparray['backtopage'];
|
||||
$_POST['tz'] = $tmparray['tz'];
|
||||
$_POST['tzstring'] = $tmparray['tzstring'];
|
||||
$_POST['dst_observed'] = $tmparray['dst_observed'];
|
||||
$_POST['dst_first'] = $tmparray['dst_first'];
|
||||
$_POST['dst_second'] = $tmparray['dst_second'];
|
||||
$_POST['screenwidth'] = $tmparray['screenwidth'];
|
||||
$_POST['screenwidth'] = $tmparray['screenwidth'];
|
||||
$_POST['dol_hide_topmenu'] = $tmparray['dol_hide_topmenu'];
|
||||
$_POST['dol_hide_leftmenu'] = $tmparray['dol_hide_leftmenu'];
|
||||
$_POST['dol_optimize_smallscreen'] = $tmparray['dol_optimize_smallscreen'];
|
||||
$_POST['dol_no_mouse_hover'] = $tmparray['dol_no_mouse_hover'];
|
||||
$_POST['dol_use_jmobile'] = $tmparray['dol_use_jmobile'];
|
||||
}
|
||||
|
||||
// If googleoauth_login has been set (by google_oauthcallback after a successfull OAUTH2 request on openid scope
|
||||
if (dol_verifyHash($conf->file->instance_unique_id.$usertotest, $_SESSION['googleoauth_receivedlogin'], '0')) {
|
||||
unset($_SESSION['googleoauth_receivedlogin']);
|
||||
$login = $usertotest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $login;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ function check_user_password_http($usertotest, $passwordtotest, $entitytotest)
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
|
||||
/*
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1));
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ function check_user_password_http($usertotest, $passwordtotest, $entitytotest)
|
|||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
return '--bad-login-validity--';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return $login;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,8 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
|
||||
/*
|
||||
$tmpuser = new User($db);
|
||||
$tmpuser->fetch('', $login, '', 1, ($entitytotest > 0 ? $entitytotest : -1));
|
||||
|
||||
|
|
@ -179,7 +181,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
|
|||
$langs->loadLangs(array('main', 'errors'));
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
return '--bad-login-validity--';
|
||||
}
|
||||
}*/
|
||||
|
||||
// ldap2dolibarr synchronisation
|
||||
if ($login && !empty($conf->ldap->enabled) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization
|
||||
|
|
|
|||
|
|
@ -80,7 +80,8 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest)
|
|||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$now = dol_now();
|
||||
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
|
||||
/* $now = dol_now();
|
||||
if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('main', 'errors'));
|
||||
|
|
@ -92,8 +93,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest)
|
|||
$langs->loadLangs(array('main', 'errors'));
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
return '--bad-login-validity--';
|
||||
}
|
||||
|
||||
} */
|
||||
$login = $obj->login;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
|
|||
$userinfo_headers = array('Authorization: Bearer '.$token_content->access_token);
|
||||
$userinfo_response = getURLContent($conf->global->MAIN_AUTHENTICATION_OIDC_USERINFO_URL, 'GET', '', 1, $userinfo_headers);
|
||||
$userinfo_content = json_decode($userinfo_response['content']);
|
||||
|
||||
dol_syslog("functions_openid_connect::check_user_password_openid_connect /userinfo=".print_r($userinfo_response, true), LOG_DEBUG);
|
||||
|
||||
// Get the user attribute (claim) matching the Dolibarr login
|
||||
|
|
@ -92,12 +93,13 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
|
|||
$sql .= ' AND entity IN (0,'.(array_key_exists('dol_entity', $_SESSION) ? ((int) $_SESSION["dol_entity"]) : 1).')';
|
||||
|
||||
dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
// TODO I think we can remove this because this is done now natively by core after calling check_user_password_openid_connect()
|
||||
$now = dol_now();
|
||||
// Note: Test on validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method
|
||||
/* $now = dol_now();
|
||||
if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('main', 'errors'));
|
||||
|
|
@ -109,8 +111,7 @@ function check_user_password_openid_connect($usertotest, $passwordtotest, $entit
|
|||
$langs->loadLangs(array('main', 'errors'));
|
||||
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorLoginDateValidity");
|
||||
return '--bad-login-validity--';
|
||||
}
|
||||
|
||||
} */
|
||||
$login = $obj->login;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
public $description;
|
||||
|
||||
/**
|
||||
* @var int Save the name of generated file as the main doc when generating a doc with this template
|
||||
* @var string Save the name of generated file as the main doc when generating a doc with this template
|
||||
*/
|
||||
public $update_main_doc_field;
|
||||
|
||||
|
|
@ -179,8 +179,8 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
$this->posxqty = 135;
|
||||
$this->posxunit = 151;
|
||||
} else {
|
||||
$this->posxtva = 110;
|
||||
$this->posxup = 126;
|
||||
$this->posxtva = 106;
|
||||
$this->posxup = 122;
|
||||
$this->posxqty = 145;
|
||||
$this->posxunit = 162;
|
||||
}
|
||||
|
|
@ -735,9 +735,11 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
|
||||
|
|
@ -746,14 +748,16 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
|
||||
$posxval = 52;
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// Show payments conditions
|
||||
if ($object->cond_reglement_code || $object->cond_reglement) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -795,11 +799,11 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
// Show planed date of delivery
|
||||
if (!empty($object->delivery_date)) {
|
||||
$outputlangs->load("sendings");
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
|
@ -807,12 +811,12 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
$posy = $pdf->GetY() + 1;
|
||||
} elseif ($object->availability_code || $object->availability) {
|
||||
// Show availability conditions
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
|
||||
$lib_availability = str_replace('\n', "\n", $lib_availability);
|
||||
|
|
@ -825,12 +829,12 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
if ($object->mode_reglement_code
|
||||
&& $object->mode_reglement_code != 'CHQ'
|
||||
&& $object->mode_reglement_code != 'VIR') {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -842,8 +846,6 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
|
||||
|
|
@ -1266,7 +1268,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
}
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1426,12 +1428,18 @@ class pdf_einstein extends ModelePDFCommandes
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -946,9 +946,11 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
|
||||
|
|
@ -957,14 +959,16 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
|
||||
$posxval = 52;
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// Show payments conditions
|
||||
if ($object->cond_reglement_code || $object->cond_reglement) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -1006,23 +1010,23 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
// Show planed date of delivery
|
||||
if (!empty($object->delivery_date)) {
|
||||
$outputlangs->load("sendings");
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
} elseif ($object->availability_code || $object->availability) { // Show availability conditions
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
|
||||
$lib_availability = str_replace('\n', "\n", $lib_availability);
|
||||
|
|
@ -1035,12 +1039,12 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
if ($object->mode_reglement_code
|
||||
&& $object->mode_reglement_code != 'CHQ'
|
||||
&& $object->mode_reglement_code != 'VIR') {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -1052,8 +1056,6 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
|
||||
|
|
@ -1601,12 +1603,18 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
@ -1890,7 +1898,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
'textkey' => 'TotalHTShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
@ -1901,7 +1909,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
'textkey' => 'TotalTTCShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
|
|||
|
|
@ -724,11 +724,18 @@ class pdf_strato extends ModelePDFContract
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'INTERREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.$conf->global->DELIVERY_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.getDolGlobalString('DELIVERY_SAPHIR_MASK').'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// On defini critere recherche compteur
|
||||
$mask = $conf->global->DELIVERY_SAPHIR_MASK;
|
||||
$mask = getDolGlobalString('DELIVERY_SAPHIR_MASK');
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
|
|
|||
|
|
@ -1114,7 +1114,14 @@ class pdf_espadon extends ModelePdfExpedition
|
|||
}
|
||||
if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
|
||||
$object->fetch_user(reset($arrayidcontact));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,14 @@ class pdf_rouget extends ModelePdfExpedition
|
|||
}
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user(reset($arrayidcontact));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -336,8 +336,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
|||
$object->fetchObjectLinked('', '', '', '');
|
||||
//print_r($object->linkedObjects['propal']); exit;
|
||||
|
||||
if (isset($object->linkedObjects['propal'][0])) {
|
||||
$propal_object = $object->linkedObjects['propal'][0];
|
||||
$array_propal_object = $object->linkedObjects['propal'];
|
||||
if (isset($array_propal_object) && is_array($array_propal_object) && count($array_propal_object) > 0) {
|
||||
$tmparrayofvalue = array_values($array_propal_object);
|
||||
$propal_object = $tmparrayofvalue[0];
|
||||
} else {
|
||||
$propal_object = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,8 +191,8 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$this->posxqty = 135;
|
||||
$this->posxunit = 151;
|
||||
} else {
|
||||
$this->posxtva = 110;
|
||||
$this->posxup = 126;
|
||||
$this->posxtva = 106;
|
||||
$this->posxup = 122;
|
||||
$this->posxqty = 145;
|
||||
$this->posxunit = 162;
|
||||
}
|
||||
|
|
@ -1793,7 +1793,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2036,7 +2036,17 @@ class pdf_crabe extends ModelePDFFactures
|
|||
|
||||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'BILLING');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
||||
// Show sender
|
||||
$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
|
|
|
|||
|
|
@ -1622,7 +1622,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
// Total remise
|
||||
$total_line_remise = 0;
|
||||
foreach ($object->lines as $i => $line) {
|
||||
$total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
|
||||
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
|
||||
// Gestion remise sous forme de ligne négative
|
||||
if ($line->total_ht < 0) {
|
||||
$total_line_remise += -$line->total_ht;
|
||||
|
|
@ -2288,7 +2288,17 @@ class pdf_sponge extends ModelePDFFactures
|
|||
|
||||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'BILLING');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
||||
// Show sender
|
||||
$posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
|
|
@ -2577,7 +2587,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
'width' => 19, // in mm
|
||||
'status' => false,
|
||||
'title' => array(
|
||||
'textkey' => 'Progress'
|
||||
'textkey' => 'ProgressShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
@ -2620,7 +2630,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
'textkey' => 'TotalHTShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
@ -2631,7 +2641,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
'textkey' => 'TotalTTCShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
|
|||
|
|
@ -632,11 +632,18 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'INTERREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class modExpedition extends DolibarrModules
|
|||
|
||||
$this->const[$r][0] = "EXPEDITION_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "rouget";
|
||||
$this->const[$r][2] = "espadon";
|
||||
$this->const[$r][3] = 'Nom du gestionnaire de generation des bons expeditions en PDF';
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
|
@ -105,7 +105,7 @@ class modExpedition extends DolibarrModules
|
|||
|
||||
$this->const[$r][0] = "DELIVERY_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "typhon";
|
||||
$this->const[$r][2] = "storm";
|
||||
$this->const[$r][3] = 'Nom du gestionnaire de generation des bons de reception en PDF';
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ class modFacture extends DolibarrModules
|
|||
'class'=>'compta/facture/class/facture.class.php',
|
||||
'objectname'=>'Facture',
|
||||
'method'=>'sendEmailsRemindersOnInvoiceDueDate',
|
||||
'parameters'=>"10,all,EmailTemplateCode",
|
||||
'comment'=>'Send an email when we reach the invoice due date (or invoice date) - n days. First param is n, the number of days before due date (or invoice date) to send the remind (or after if value is negative), second parameter is "all" or a payment mode code, third parameter is the code of the email template to use (an email template with the EmailTemplateCode must exists. The version of the email template in the language of the thirdparty will be used in priority. Language of the thirdparty will be also used to update the PDF of the sent invoice). The last parameter is "duedate" or "invoicedate" to define which date of the invoice to use.',
|
||||
'parameters'=>"10,all,EmailTemplateCode,duedate",
|
||||
'comment'=>'Send an email when we reach the invoice due date (or invoice date) - n days. First param is n, the number of days before due date (or invoice date) to send the remind (or after if value is negative), second parameter is "all" or a payment mode code, third parameter is the code of the email template to use (an email template with the EmailTemplateCode must exists. The version of the email template in the language of the thirdparty will be used in priority. Language of the thirdparty will be also used to update the PDF of the sent invoice). The fourth parameter is the string "duedate" (default) or "invoicedate" to define which date of the invoice to use.',
|
||||
'frequency'=>1,
|
||||
'unitfrequency'=>3600 * 24,
|
||||
'priority'=>50,
|
||||
|
|
@ -318,7 +318,7 @@ class modFacture extends DolibarrModules
|
|||
'f.date_lim_reglement' => '2021-12-24',
|
||||
'f.note_public' => '',
|
||||
'f.note_private' => '',
|
||||
'f.model_pdf' => 'crabe',
|
||||
'f.model_pdf' => 'sponge',
|
||||
'f.multicurrency_code' => 'EUR',
|
||||
'f.multicurrency_tx' => '1',
|
||||
'f.multicurrency_total_ht' => '100',
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class modFournisseur extends DolibarrModules
|
|||
|
||||
$this->const[$r][0] = "COMMANDE_SUPPLIER_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "muscadet";
|
||||
$this->const[$r][2] = "cornas";
|
||||
$this->const[$r][3] = 'Nom du gestionnaire de generation des bons de commande en PDF';
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
|
|
|||
|
|
@ -1247,11 +1247,18 @@ class pdf_vinci extends ModelePDFMo
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// This page should make the process to login and get token as described here:
|
||||
// This page is used as callback for token generation of an OAUTH request.
|
||||
// This page can also be used to make the process to login and get token as described here:
|
||||
// https://developers.google.com/identity/protocols/oauth2/openid-connect#server-flow
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +26,17 @@
|
|||
* \brief Page to get oauth callback
|
||||
*/
|
||||
|
||||
// Force keyforprovider
|
||||
$forlogin = 0;
|
||||
if (preg_match('/^forlogin-/', $_GET['state'])) {
|
||||
$forlogin = 1;
|
||||
$_GET['keyforprovider'] = 'Login';
|
||||
}
|
||||
|
||||
if (!defined('NOLOGIN') && $forlogin) {
|
||||
define("NOLOGIN", 1); // This means this output page does not require to be logged.
|
||||
}
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
|
|
@ -33,11 +45,12 @@ use OAuth\Common\Consumer\Credentials;
|
|||
use OAuth\OAuth2\Service\Google;
|
||||
|
||||
// Define $urlwithroot
|
||||
global $dolibarr_main_url_root;
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtourl = GETPOST('backtourl', 'alpha');
|
||||
|
|
@ -85,7 +98,7 @@ $statewithanticsrfonly = '';
|
|||
$requestedpermissionsarray = array();
|
||||
if ($state) {
|
||||
// 'state' parameter is standard to store a hash value and can be used to retrieve some parameters back
|
||||
$statewithscopeonly = preg_replace('/\-.*$/', '', $state);
|
||||
$statewithscopeonly = preg_replace('/\-.*$/', '', preg_replace('/^forlogin-/', '', $state));
|
||||
$requestedpermissionsarray = explode(',', $statewithscopeonly); // Example: 'userinfo_email,userinfo_profile,openid,email,profile,cloud_print'.
|
||||
$statewithanticsrfonly = preg_replace('/^.*\-/', '', $state);
|
||||
}
|
||||
|
|
@ -112,13 +125,11 @@ $apiService = $serviceFactory->createService('Google', $credentials, $storage, $
|
|||
$apiService->setAccessType('offline');
|
||||
|
||||
|
||||
$langs->load("oauth");
|
||||
|
||||
if (!getDolGlobalString($keyforparamid)) {
|
||||
accessforbidden('Setup of service is not complete. Customer ID is missing');
|
||||
accessforbidden('Setup of service '.$keyforparamid.' is not complete. Customer ID is missing');
|
||||
}
|
||||
if (!getDolGlobalString($keyforparamsecret)) {
|
||||
accessforbidden('Setup of service is not complete. Secret key is missing');
|
||||
accessforbidden('Setup of service '.$keyforparamid.' is not complete. Secret key is missing');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,7 +137,6 @@ if (!getDolGlobalString($keyforparamsecret)) {
|
|||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'delete') {
|
||||
$storage->clearToken('Google');
|
||||
|
||||
|
|
@ -136,69 +146,14 @@ if ($action == 'delete') {
|
|||
exit();
|
||||
}
|
||||
|
||||
if (GETPOST('code')) { // We are coming from oauth provider page.
|
||||
dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider." code=".dol_trunc(GETPOST('code'), 5));
|
||||
|
||||
// We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not.
|
||||
if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) {
|
||||
print 'Value for state = '.dol_escape_htmltag($state).' differs from value in $_SESSION["oauthstateanticsrf"]. Code is refused.';
|
||||
unset($_SESSION['oauthstateanticsrf']);
|
||||
} else {
|
||||
// This was a callback request from service, get the token
|
||||
try {
|
||||
//var_dump($state);
|
||||
//var_dump($apiService); // OAuth\OAuth2\Service\Google
|
||||
|
||||
// This request the token
|
||||
// Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php, so into table llx_oauth_token
|
||||
$token = $apiService->requestAccessToken(GETPOST('code'), $state);
|
||||
|
||||
// Note: The extraparams has the 'id_token' than contains a lot of information about the user.
|
||||
$extraparams = $token->getExtraParams();
|
||||
$jwt = explode('.', $extraparams['id_token']);
|
||||
|
||||
// Extract the middle part, base64 decode, then json_decode it
|
||||
if (!empty($jwt[1])) {
|
||||
$userinfo = json_decode(base64_decode($jwt[1]), true);
|
||||
|
||||
// TODO
|
||||
// We should make the 5 steps of validation of id_token
|
||||
// Verify that the ID token is properly signed by the issuer. Google-issued tokens are signed using one of the certificates found at the URI specified in the jwks_uri metadata value of the Discovery document.
|
||||
// Verify that the value of the iss claim in the ID token is equal to https://accounts.google.com or accounts.google.com.
|
||||
// Verify that the value of the aud claim in the ID token is equal to your app's client ID.
|
||||
// Verify that the expiry time (exp claim) of the ID token has not passed.
|
||||
// If you specified a hd parameter value in the request, verify that the ID token has a hd claim that matches an accepted G Suite hosted domain.
|
||||
|
||||
/*
|
||||
$useremailuniq = $userinfo['sub'];
|
||||
$useremail = $userinfo['email'];
|
||||
$useremailverified = $userinfo['email_verified'];
|
||||
$username = $userinfo['name'];
|
||||
$userfamilyname = $userinfo['family_name'];
|
||||
$usergivenname = $userinfo['given_name'];
|
||||
$hd = $userinfo['hd'];
|
||||
*/
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs');
|
||||
|
||||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!GETPOST('code')) {
|
||||
// If we enter this page without 'code' parameter, we arrive here. This is the case when we want to get the redirect
|
||||
// to the OAuth provider login page.
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
$_SESSION["oauthkeyforproviderbeforeoauthjump"] = $keyforprovider;
|
||||
$_SESSION['oauthstateanticsrf'] = $state;
|
||||
|
||||
if (!preg_match('/^forlogin/', $state)) {
|
||||
if ($forlogin) {
|
||||
$apiService->setApprouvalPrompt('force');
|
||||
}
|
||||
|
||||
|
|
@ -209,19 +164,182 @@ if (GETPOST('code')) { // We are coming from oauth provider page.
|
|||
} else {
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
}
|
||||
// The redirect_uri is included into this $url
|
||||
|
||||
// Add more param
|
||||
$url .= '&nonce='.bin2hex(random_bytes(64/8));
|
||||
// TODO Add param hd and/or login_hint
|
||||
if (!preg_match('/^forlogin/', $state)) {
|
||||
//$url .= 'hd=xxx';
|
||||
}
|
||||
|
||||
//var_dump($url);exit;
|
||||
if ($forlogin) {
|
||||
// TODO Add param hd. What is it for ?
|
||||
//$url .= 'hd=xxx';
|
||||
|
||||
if (GETPOST('username')) {
|
||||
$url .= '&login_hint='.urlencode(GETPOST('username'));
|
||||
}
|
||||
|
||||
// Check that the redirect_uri that wil be used is same than url of current domain
|
||||
|
||||
// Define $urlwithroot
|
||||
global $dolibarr_main_url_root;
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
$currentrooturl = getRootURLFromURL(DOL_MAIN_URL_ROOT);
|
||||
$externalrooturl = getRootURLFromURL($urlwithroot);
|
||||
|
||||
if ($currentrooturl != $externalrooturl) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorTheUrlOfYourDolInstanceDoesNotMatchURLIntoOAuthSetup", $currentrooturl, $externalrooturl), null, 'errors');
|
||||
$url = DOL_URL_ROOT;
|
||||
}
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
} else {
|
||||
// We are coming from the return of an OAuth2 provider page.
|
||||
dol_syslog("We are coming from the oauth provider page keyforprovider=".$keyforprovider." code=".dol_trunc(GETPOST('code'), 5));
|
||||
|
||||
// We must validate that the $state is the same than the one into $_SESSION['oauthstateanticsrf'], return error if not.
|
||||
if (isset($_SESSION['oauthstateanticsrf']) && $state != $_SESSION['oauthstateanticsrf']) {
|
||||
//var_dump($_SESSION['oauthstateanticsrf']);exit;
|
||||
print 'Value for state='.dol_escape_htmltag($state).' differs from value in $_SESSION["oauthstateanticsrf"]. Code is refused.';
|
||||
unset($_SESSION['oauthstateanticsrf']);
|
||||
} else {
|
||||
// This was a callback request from service, get the token
|
||||
try {
|
||||
//var_dump($state);
|
||||
//var_dump($apiService); // OAuth\OAuth2\Service\Google
|
||||
//dol_syslog("_GET=".var_export($_GET, true));
|
||||
|
||||
$errorincheck = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
// This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint)
|
||||
// Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php, so into table llx_oauth_token
|
||||
$token = $apiService->requestAccessToken(GETPOST('code'), $state);
|
||||
|
||||
// Note: The extraparams has the 'id_token' than contains a lot of information about the user.
|
||||
$extraparams = $token->getExtraParams();
|
||||
$jwt = explode('.', $extraparams['id_token']);
|
||||
|
||||
$useremail = '';
|
||||
|
||||
// Extract the middle part, base64 decode, then json_decode it
|
||||
if (!empty($jwt[1])) {
|
||||
$userinfo = json_decode(base64_decode($jwt[1]), true);
|
||||
|
||||
dol_syslog("userinfo=".var_export($userinfo, true));
|
||||
|
||||
$useremail = $userinfo['email'];
|
||||
/*
|
||||
$useremailverified = $userinfo['email_verified'];
|
||||
$useremailuniq = $userinfo['sub'];
|
||||
$username = $userinfo['name'];
|
||||
$userfamilyname = $userinfo['family_name'];
|
||||
$usergivenname = $userinfo['given_name'];
|
||||
$hd = $userinfo['hd'];
|
||||
*/
|
||||
|
||||
// We should make the steps of validation of id_token
|
||||
|
||||
// Verify that the state is the one expected
|
||||
// TODO
|
||||
|
||||
// Verify that the ID token is properly signed by the issuer. Google-issued tokens are signed using one of the certificates found at the URI specified in the jwks_uri metadata value of the Discovery document.
|
||||
// TODO
|
||||
|
||||
// Verify that the value of the iss claim in the ID token is equal to https://accounts.google.com or accounts.google.com.
|
||||
if ($userinfo['iss'] != 'accounts.google.com' && $userinfo['iss'] != 'https://accounts.google.com') {
|
||||
setEventMessages($langs->trans('Bad value for returned userinfo[iss]'), null, 'errors');
|
||||
$errorincheck++;
|
||||
}
|
||||
|
||||
// Verify that the value of the aud claim in the ID token is equal to your app's client ID.
|
||||
if ($userinfo['aud'] != getDolGlobalString($keyforparamid)) {
|
||||
setEventMessages($langs->trans('Bad value for returned userinfo[aud]'), null, 'errors');
|
||||
$errorincheck++;
|
||||
}
|
||||
|
||||
// Verify that the expiry time (exp claim) of the ID token has not passed.
|
||||
if ($userinfo['exp'] <= dol_now()) {
|
||||
setEventMessages($langs->trans('Bad value for returned userinfo[exp]. Token expired.'), null, 'errors');
|
||||
$errorincheck++;
|
||||
}
|
||||
|
||||
// If you specified a hd parameter value in the request, verify that the ID token has a hd claim that matches an accepted G Suite hosted domain.
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (!$errorincheck) {
|
||||
// If call back to url for a OAUTH2 login
|
||||
if ($forlogin) {
|
||||
dol_syslog("we received the login/email to log to, it is ".$useremail);
|
||||
|
||||
$tmparray = (empty($_SESSION['datafromloginform']) ? array() : $_SESSION['datafromloginform']);
|
||||
$entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1);
|
||||
|
||||
// Delete the token
|
||||
$storage->clearToken('Google');
|
||||
|
||||
$tmpuser = new User($db);
|
||||
$res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail);
|
||||
|
||||
if ($res > 0) {
|
||||
$username = $tmpuser->login;
|
||||
|
||||
$_SESSION['googleoauth_receivedlogin'] = dol_hash($conf->file->instance_unique_id.$username, '0');
|
||||
dol_syslog('$_SESSION[\'googleoauth_receivedlogin\']='.$_SESSION['googleoauth_receivedlogin']);
|
||||
} else {
|
||||
$errormessage = "Failed to login using Google. User with the Email '".$useremail."' was not found";
|
||||
if ($entitytosearchuser > 0) {
|
||||
$errormessage .= ' ('.$langs->trans("Entity").' '.$entitytosearchuser.')';
|
||||
}
|
||||
$_SESSION["dol_loginmesg"] = $errormessage;
|
||||
$errorincheck++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If call back to url for a OAUTH2 login
|
||||
if ($forlogin) {
|
||||
$_SESSION["dol_loginmesg"] = "Failed to login using Google. OAuth callback URL retreives a token with non valid data";
|
||||
$errorincheck++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errorincheck) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
if (empty($backtourl)) {
|
||||
$backtourl = DOL_URL_ROOT;
|
||||
}
|
||||
|
||||
// If call back to url for a OAUTH2 login
|
||||
if ($forlogin) {
|
||||
$backtourl .= '?actionlogin=login&afteroauthloginreturn=1&username='.urlencode($username).'&token='.newToken();
|
||||
if (!empty($tmparray['entity'])) {
|
||||
$backtourl .= '&entity='.$tmparray['entity'];
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog("Redirect now on backtourl=".$backtourl);
|
||||
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -229,6 +347,6 @@ if (GETPOST('code')) { // We are coming from oauth provider page.
|
|||
* View
|
||||
*/
|
||||
|
||||
// No view at all, just actions, so we never reach this line.
|
||||
// No view at all, just actions, so we reach this line only on error.
|
||||
|
||||
$db->close();
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class mod_project_universal extends ModeleNumRefProjects
|
|||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskproject" value="'.$conf->global->PROJECT_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskproject" value="'.getDolGlobalString('PROJECT_UNIVERSAL_MASK').'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ class mod_project_universal extends ModeleNumRefProjects
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// On defini critere recherche compteur
|
||||
$mask = $conf->global->PROJECT_UNIVERSAL_MASK;
|
||||
$mask = getDolGlobalString('PROJECT_UNIVERSAL_MASK');
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class mod_task_universal extends ModeleNumRefTask
|
|||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masktask" value="'.$conf->global->PROJECT_TASK_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masktask" value="'.getDolGlobalString('PROJECT_TASK_UNIVERSAL_MASK').'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ class mod_task_universal extends ModeleNumRefTask
|
|||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$mask = !empty($conf->global->PROJECT_TASK_UNIVERSAL_MASK) ? $conf->global->PROJECT_TASK_UNIVERSAL_MASK : '';
|
||||
$mask = getDolGlobalString('PROJECT_TASK_UNIVERSAL_MASK');
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var int The environment ID when using a multicompany module
|
||||
*/
|
||||
public $entity;
|
||||
|
||||
/**
|
||||
* @var string model name
|
||||
*/
|
||||
|
|
@ -925,9 +930,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
|
||||
|
|
@ -944,23 +951,23 @@ class pdf_azur extends ModelePDFPropales
|
|||
// Show shipping date
|
||||
if (!empty($object->delivery_date)) {
|
||||
$outputlangs->load("sendings");
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size -$diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
} elseif ($object->availability_code || $object->availability) { // Show availability conditions
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability);
|
||||
$lib_availability = str_replace('\n', "\n", $lib_availability);
|
||||
|
|
@ -980,12 +987,12 @@ class pdf_azur extends ModelePDFPropales
|
|||
$shipping_method_code = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
$shipping_method_label = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'libelle');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("SendingMethod").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = ($outputlangs->transnoentities("SendingMethod".strtoupper($shipping_method_code)) != "SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans("SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label;
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -996,12 +1003,12 @@ class pdf_azur extends ModelePDFPropales
|
|||
|
||||
// Show payments conditions
|
||||
if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && $object->cond_reglement_code) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -1018,11 +1025,11 @@ class pdf_azur extends ModelePDFPropales
|
|||
if ($object->mode_reglement_code
|
||||
&& $object->mode_reglement_code != 'CHQ'
|
||||
&& $object->mode_reglement_code != 'VIR') {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -1034,8 +1041,6 @@ class pdf_azur extends ModelePDFPropales
|
|||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
|
||||
$account = new Account($this->db);
|
||||
$account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
|
||||
|
|
@ -1471,7 +1476,7 @@ class pdf_azur extends ModelePDFPropales
|
|||
}
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1635,12 +1640,18 @@ class pdf_azur extends ModelePDFPropales
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
@ -1665,7 +1676,7 @@ class pdf_azur extends ModelePDFPropales
|
|||
$pdf->SetTextColor(0, 0, 60);
|
||||
}
|
||||
|
||||
// Show sender name
|
||||
// Show company name
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
|
||||
$pdf->SetXY($posx + 2, $posy + 3);
|
||||
$pdf->SetFont('', 'B', $default_font_size);
|
||||
|
|
|
|||
|
|
@ -1035,9 +1035,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
|
||||
|
|
@ -1054,23 +1056,23 @@ class pdf_cyan extends ModelePDFPropales
|
|||
// Show shipping date
|
||||
if (!empty($object->delivery_date)) {
|
||||
$outputlangs->load("sendings");
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true);
|
||||
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
|
||||
|
||||
$posy = $pdf->GetY() + 1;
|
||||
} elseif ($object->availability_code || $object->availability) { // Show availability conditions
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability);
|
||||
$lib_availability = str_replace('\n', "\n", $lib_availability);
|
||||
|
|
@ -1090,12 +1092,12 @@ class pdf_cyan extends ModelePDFPropales
|
|||
$shipping_method_code = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
$shipping_method_label = dol_getIdFromCode($this->db, $shipping_method_id, 'c_shipment_mode', 'rowid', 'libelle');
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("SendingMethod").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = ($outputlangs->transnoentities("SendingMethod".strtoupper($shipping_method_code)) != "SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans("SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label;
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -1106,12 +1108,12 @@ class pdf_cyan extends ModelePDFPropales
|
|||
|
||||
// Show payments conditions
|
||||
if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && $object->cond_reglement_code) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(43, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -1128,11 +1130,11 @@ class pdf_cyan extends ModelePDFPropales
|
|||
if ($object->mode_reglement_code
|
||||
&& $object->mode_reglement_code != 'CHQ'
|
||||
&& $object->mode_reglement_code != 'VIR') {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -1144,8 +1146,6 @@ class pdf_cyan extends ModelePDFPropales
|
|||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
|
||||
$account = new Account($this->db);
|
||||
$account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
|
||||
|
|
@ -1710,12 +1710,18 @@ class pdf_cyan extends ModelePDFPropales
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
@ -2033,7 +2039,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_HIDE_PRICE_EXCL_TAX) ? true : false,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalHT'
|
||||
'textkey' => 'TotalHTShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
@ -2044,7 +2050,7 @@ class pdf_cyan extends ModelePDFPropales
|
|||
'width' => 26, // in mm
|
||||
'status' => empty($conf->global->PDF_PROPAL_SHOW_PRICE_INCL_TAX) ? false : true,
|
||||
'title' => array(
|
||||
'textkey' => 'TotalTTC'
|
||||
'textkey' => 'TotalTTCShort'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
|
|
|||
|
|
@ -971,7 +971,14 @@ class pdf_squille extends ModelePdfReception
|
|||
}
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user(reset($arrayidcontact));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
|
|
|||
|
|
@ -61,8 +61,14 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
|||
if (!isset($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) || trim($conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER) == '') {
|
||||
$conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER = '401';
|
||||
}
|
||||
$this->prefixcustomeraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
|
||||
$this->prefixsupplieraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
|
||||
|
||||
if (!empty($conf->global->COMPANY_AQUARIUM_NO_PREFIX)) {
|
||||
$this->prefixcustomeraccountancycode = '';
|
||||
$this->prefixsupplieraccountancycode = '';
|
||||
} else {
|
||||
$this->prefixcustomeraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_CUSTOMER;
|
||||
$this->prefixsupplieraccountancycode = $conf->global->COMPANY_AQUARIUM_MASK_SUPPLIER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -102,6 +108,10 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
|
|||
if (!empty($conf->global->COMPANY_AQUARIUM_CLEAN_REGEX)) {
|
||||
$texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."<br>\n";
|
||||
}
|
||||
|
||||
if (!empty($conf->global->COMPANY_AQUARIUM_NO_PREFIX)) {
|
||||
$texte .= $langs->trans('COMPANY_AQUARIUM_NO_PREFIX').' = '.$conf->global->COMPANY_AQUARIUM_NO_PREFIX."<br>\n";
|
||||
}
|
||||
$texte .= '</td>';
|
||||
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
|
||||
$texte .= '</tr></table>';
|
||||
|
|
|
|||
|
|
@ -154,20 +154,24 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||
|
||||
// Define column position
|
||||
$this->posxdesc = $this->marge_gauche + 1;
|
||||
$this->posxtva = 112;
|
||||
$this->posxup = 126;
|
||||
$this->posxqty = 145;
|
||||
$this->posxunit = 162;
|
||||
$this->posxdiscount = 162;
|
||||
$this->postotalht = 174;
|
||||
|
||||
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
|
||||
$this->posxtva = 99;
|
||||
$this->posxup = 114;
|
||||
$this->posxqty = 130;
|
||||
$this->posxunit = 147;
|
||||
} else {
|
||||
$this->posxtva = 106;
|
||||
$this->posxup = 122;
|
||||
$this->posxqty = 145;
|
||||
$this->posxunit = 162;
|
||||
}
|
||||
//if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxdiscount = 162;
|
||||
$this->postotalht = 174;
|
||||
|
||||
/* if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
|
||||
$this->posxtva = $this->posxup;
|
||||
} */
|
||||
$this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$this->posxpicture -= 20;
|
||||
|
|
@ -1189,11 +1193,18 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
|
|
@ -890,9 +890,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
global $conf, $mysoc;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
// If France, show VAT mention if not applicable
|
||||
if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
|
||||
|
||||
|
|
@ -903,12 +905,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
|
||||
// Show payments conditions
|
||||
if (!empty($object->cond_reglement_code) || $object->cond_reglement) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
$pdf->MultiCell(80, 4, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
|
||||
$lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
|
||||
|
|
@ -919,12 +921,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
|
||||
// Show payment mode
|
||||
if (!empty($object->mode_reglement_code)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
$pdf->MultiCell(80, 5, $titre, 0, 'L');
|
||||
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->SetXY($posxval, $posy);
|
||||
$lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -1379,11 +1381,18 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
|||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of object if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
|
||||
$carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
|
||||
$carac_emetteur .= "\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue