Merge branch 'develop' into patch-538
This commit is contained in:
commit
eea8ddbe24
@ -98,6 +98,12 @@ source_file = htdocs/langs/en_US/cron.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.datapolicy]
|
||||
file_filter = htdocs/langs/<lang>/datapolicy.lang
|
||||
source_file = htdocs/langs/en_US/datapolicy.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.deliveries]
|
||||
file_filter = htdocs/langs/<lang>/deliveries.lang
|
||||
source_file = htdocs/langs/en_US/deliveries.lang
|
||||
|
||||
@ -33,6 +33,7 @@ PEAR Mail_MIME 1.8.9 BSD Yes
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
|
||||
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
|
||||
48
ChangeLog
48
ChangeLog
@ -59,66 +59,60 @@ NEW: Add margin info in proposal and order list
|
||||
NEW: Add massaction "Edit Extrafield" for Product
|
||||
NEW: Add more fields to detect duplicate during import of thirdparties
|
||||
NEW: Add option to foce delivery on email for purchase order receipt to yes
|
||||
NEW: Add param boder table for md theme
|
||||
NEW: Add param border table for md theme
|
||||
NEW: Add param color button action
|
||||
NEW: Add possibility to create contract from invoice
|
||||
NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name
|
||||
NEW: Add private and public notes on tax files.
|
||||
NEW: Add status "Obsolete" to KM articles
|
||||
NEW: Add substitutions "user numbers"
|
||||
NEW: allow a ticket to be automatically marked as read when created from backend.
|
||||
NEW: allow cut&paste as real numeric value to excel
|
||||
NEW: A public form to send a message and create a lead is available
|
||||
NEW: automatically set totally received status in reception
|
||||
NEW: Auto set invoice paid when adding credit not and remain to pay is 0
|
||||
NEW: Availibility dictionnary has a new column unit and number
|
||||
NEW: Can change value of AWP during the inventory
|
||||
NEW: Can enter price with tax for predefined products on purchase objects
|
||||
NEW: Can filter on a thirdparty on product statistics
|
||||
NEW: Can removed doc templates from setup page of thirdparty
|
||||
NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
|
||||
NEW: Can use ! to make a search that exclude a string
|
||||
NEW: Change in theme colors does not need to use the refresh button
|
||||
NEW: clean values and amount in FEC import
|
||||
NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action
|
||||
NEW: Contact filter project list
|
||||
NEW: Create contract from invoice
|
||||
NEW: create third-party with contact if not found on public ticket
|
||||
NEW: Database: Can store the session into database (instead of beeing managed by PHP)
|
||||
NEW: Database: Some core tables are created only at module activation
|
||||
NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks)
|
||||
NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit.
|
||||
NEW: Dictionaries - add possibility to manage countries in EEC
|
||||
NEW: Dictionaries - Availibility dictionnary has a new column unit and number
|
||||
NEW: Display errors in a message box after generating documents
|
||||
NEW: Display physical and virtual stock of the products when creating OF from a BOM
|
||||
NEW: Display product ref in "Object link" product tab for BOM
|
||||
NEW: Enhance the import. Can use 'auto' for the ref (import of orders)
|
||||
NEW: Events on Proposal to Return to Draft
|
||||
NEW: Page to list expense report payments
|
||||
NEW: JS inventory autocalc input
|
||||
NEW: language support for more emailing target selectors
|
||||
NEW: leave requests: add field into type dictionary to block request if balance is negative
|
||||
NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
|
||||
NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
|
||||
NEW: Mass action "Close shipments"
|
||||
NEW: Module BOM - Add tabs for nets Bom
|
||||
NEW: Module BOM - Add the possibility to add sub-BOMs to BOM
|
||||
NEW: Module Recruitment - Add a public page with all list of open job positions.
|
||||
NEW: Module Recruitment - Add a public page with list of all open job positions.
|
||||
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
|
||||
NEW: Module Website - supports now the multicompany module
|
||||
NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...)
|
||||
NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens)
|
||||
NEW: on redirect of page in website module, GET parameters are kept.
|
||||
NEW: optional display warning icons on ticket list
|
||||
NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439)
|
||||
NEW: possibility to consume multiple batch
|
||||
NEW: Reverse movement product consumption
|
||||
NEW: Send email to the supplier order contact
|
||||
NEW: add permission to report time on timesheet
|
||||
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
|
||||
NEW: Some core tables are created only at module activation
|
||||
NEW: Knowledge Management - Add status "Obsolete" to KM articles
|
||||
NEW: MRP - split consumption line on MO
|
||||
NEW: MRP - Display physical and virtual stock of the products when creating OF from a BOM
|
||||
NEW: MRP - Display product ref in "Object link" product tab for BOM
|
||||
NEW: Proposals - option update prices on proposal cloning
|
||||
NEW: stock filter in reassort lists
|
||||
NEW: stock limit in stock export CSV
|
||||
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
|
||||
NEW: Stocks - stock filter in reassort lists
|
||||
NEW: Stocks - stock limit in stock export CSV
|
||||
NEW: Supplier order - Show ref supplier of reception in linked object block
|
||||
NEW: support user_modif in order
|
||||
NEW: Surveys - Show number of votes into the label of tab "Results" of a survey
|
||||
@ -128,20 +122,24 @@ NEW: TakePOS - show product reference
|
||||
NEW: TakePOS - add constant to hide categories
|
||||
NEW: TakePOS - add constant to show category description
|
||||
NEW: TakePOS - add constant to show only the products in stock
|
||||
NEW: Third-Parties - Add rules "customer accountancy code" is mandatory to validate invoice
|
||||
NEW: Third-Parties - Can set the parent company during the creation of thirdparty (action=add of societe/card.php)
|
||||
NEW: Tickets - create Third-party with contact if not found on public ticket
|
||||
NEW: Tickets - option to default check "notify tier at creation"
|
||||
NEW: Tickets - Trigger: allow to automatically send messages on new tickets
|
||||
NEW: Tickets - optional display warning icons on ticket list
|
||||
NEW: Websites Module - supports now the multicompany module
|
||||
NEW: Websites Module - on redirect of page in website module, GET parameters are kept.
|
||||
NEW: The backup tools has an "lowmemory" option for mysqldump on large database
|
||||
NEW: The 'reposition' class works on ajax constantonoff that make redirects
|
||||
NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice
|
||||
NEW: thumbnail field in product list
|
||||
NEW: total mark rate in list
|
||||
NEW: uncheck "send message" by default on a ticket when private messages has been checked
|
||||
NEW: VAT Report by month - Show detail by rate and also by code
|
||||
NEW: Can store the session into database (instead of beeing managed by PHP)
|
||||
NEW: Added MMK currency (Myanmar Kyat)
|
||||
NEW: On a form to send an email, we show all emails of contacts of object
|
||||
|
||||
Modules
|
||||
Modules state
|
||||
NEW: Module Partnership Management
|
||||
NEW: Module Event Organization Management
|
||||
|
||||
@ -164,7 +162,7 @@ NEW: Creation of the function select_bom() used to display bom select list
|
||||
NEW: Add trigger and event on completely received status change
|
||||
NEW: Add utility function send backup by mail
|
||||
NEW: add WordPress OAuth to save a token (not SSO)
|
||||
NEW: A module can embed a sql script run at each Dolibarr upgrade
|
||||
NEW: A module can embed a SQL script run at each Dolibarr upgrade
|
||||
NEW: Add param to keep the robot=index meta tag on public pages
|
||||
NEW: Add method hintindex() in database handlers.
|
||||
NEW: add modifications for new function "$db->prefix()"
|
||||
@ -209,9 +207,11 @@ NEW: TakePOS - add hook doaction in TakePOS invoice
|
||||
|
||||
Config Options:
|
||||
NEW: Add hidden option on contract PDF line to hide qty and price
|
||||
NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END
|
||||
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
|
||||
|
||||
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
|
||||
NEW: Option MAIN_API_DEBUG to save API logs into a file
|
||||
NEW: Option MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys
|
||||
NEW: Option MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category
|
||||
NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END
|
||||
|
||||
WARNING:
|
||||
|
||||
|
||||
@ -885,9 +885,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
|
||||
$fieldname = 'country';
|
||||
if ($context == 'add') {
|
||||
$fieldname = 'country_id';
|
||||
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
$preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code;
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
} else {
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
$preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code);
|
||||
print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'country_id') {
|
||||
|
||||
@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of custom groups that are active
|
||||
* Return list of custom groups.
|
||||
*
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @param int $active 1= active, 0=not active
|
||||
* @return array|int Array of groups or -1 if error
|
||||
*/
|
||||
public function getCats($categorytype = -1)
|
||||
public function getCats($categorytype = -1, $active = 1)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
|
||||
@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " WHERE c.active = " . (int) $active;
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
if ($categorytype >= 0) {
|
||||
$sql .= " AND c.category_type = 1";
|
||||
|
||||
@ -51,7 +51,7 @@ if ($result > 0) {
|
||||
} elseif ($result < 0) {
|
||||
dol_print_error('', $object->error, $object->errors);
|
||||
} elseif ($result == 0) {
|
||||
accessforbidden($langs->trans('ErrorRecordNotFound'));
|
||||
accessforbidden('ErrorRecordNotFound');
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2022 Philippe Grand <philippe.grand@atoo-net.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
|
||||
@ -124,7 +124,7 @@ if (!empty($this->control->tpl['action_delete'])) {
|
||||
if (empty($user->socid)) {
|
||||
echo '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
|
||||
@ -110,10 +110,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -246,7 +246,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update' && !$cancel && $user->rights->adherent->creer) {
|
||||
if ($action == 'update' && !$cancel && $user->hasRight('adherent', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$birthdate = '';
|
||||
@ -421,7 +421,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->creer) {
|
||||
if ($action == 'add' && $user->hasRight('adherent', 'creer')) {
|
||||
if ($canvas) {
|
||||
$object->canvas = $canvas;
|
||||
}
|
||||
@ -629,7 +629,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'creer') && $action == 'confirm_valid' && $confirm == 'yes') {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -854,7 +854,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') {
|
||||
if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') {
|
||||
if (!count($object->errors)) {
|
||||
if (!$mailmanspip->add_to_spip($object)) {
|
||||
setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors');
|
||||
@ -867,7 +867,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->adherent->dir_output;
|
||||
$permissiontoadd = $user->rights->adherent->creer;
|
||||
$permissiontoadd = $user->hasRight('adherent', 'creer');
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
@ -1222,7 +1222,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $object->typeid), 0, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
} else {
|
||||
print $adht->getNomUrl(1);
|
||||
@ -1820,7 +1820,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Third party Dolibarr
|
||||
if (isModEnabled('societe')) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->adherent->creer;
|
||||
$editenable = $user->hasRight('adherent', 'creer');
|
||||
print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editthirdparty') {
|
||||
@ -1857,7 +1857,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Login Dolibarr - Link to user
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
|
||||
$editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer;
|
||||
print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
|
||||
print '</td><td colspan="2" class="valeur">';
|
||||
if ($action == 'editlogin') {
|
||||
@ -1901,7 +1901,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Send card by email
|
||||
// TODO Remove this to replace with a template
|
||||
/*
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($object->email) print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a>\n";
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a>\n";
|
||||
@ -1913,7 +1913,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}*/
|
||||
|
||||
// Modify
|
||||
if (!empty($user->rights->adherent->creer)) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</span>'."\n";
|
||||
@ -1921,7 +1921,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Validate
|
||||
if (Adherent::STATUS_DRAFT == $object->statut) {
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate").'</a>'."\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</span>'."\n";
|
||||
@ -1930,7 +1930,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Reactivate
|
||||
if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $object->statut) {
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable").'</span>'."\n";
|
||||
@ -2022,7 +2022,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed = $user->rights->adherent->lire;
|
||||
$delallowed = $user->rights->adherent->creer;
|
||||
$delallowed = $user->hasRight('adherent', 'creer');
|
||||
|
||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
@ -335,8 +335,8 @@ class Adherent extends CommonObject
|
||||
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
|
||||
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150),
|
||||
'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=> 153),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
|
||||
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170),
|
||||
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Thibault FOUCART<support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 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
|
||||
@ -286,7 +286,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
@ -311,7 +311,7 @@ class Members extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ class Subscriptions extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
|
||||
@ -87,10 +87,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
$permissiontoadd = $canaddmember;
|
||||
@ -186,8 +186,8 @@ if ($id > 0) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
$modulepart = 'member';
|
||||
$permissiontoadd = $user->rights->adherent->creer;
|
||||
$permtoedit = $user->rights->adherent->creer;
|
||||
$permissiontoadd = $user->hasRight('adherent', 'creer');
|
||||
$permtoedit = $user->hasRight('adherent', 'creer');
|
||||
$param = '&id='.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
print "<br><br>";
|
||||
|
||||
@ -62,10 +62,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
// Security check
|
||||
|
||||
@ -232,7 +232,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($massaction == 'close' && $user->rights->adherent->creer) {
|
||||
if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) {
|
||||
$tmpmember = new Adherent($db);
|
||||
$error = 0;
|
||||
$nbclose = 0;
|
||||
@ -262,7 +262,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Create external user
|
||||
if ($massaction == 'createexternaluser' && $user->rights->adherent->creer && $user->rights->user->user->creer) {
|
||||
if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {
|
||||
$tmpmember = new Adherent($db);
|
||||
$error = 0;
|
||||
$nbcreated = 0;
|
||||
@ -302,7 +302,7 @@ if (empty($reshook)) {
|
||||
$objectlabel = 'Members';
|
||||
$permissiontoread = $user->rights->adherent->lire;
|
||||
$permissiontodelete = $user->rights->adherent->supprimer;
|
||||
$permissiontoadd = $user->rights->adherent->creer;
|
||||
$permissiontoadd = $user->hasRight('adherent', 'creer');
|
||||
$uploaddir = $conf->adherent->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -350,7 +350,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
}
|
||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||
if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
|
||||
// We need this table joined to the select in order to filter by categ
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
|
||||
}
|
||||
@ -617,7 +617,7 @@ $arrayofmassactions = array(
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
|
||||
}
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
@ -626,7 +626,7 @@ if ($user->rights->adherent->supprimer) {
|
||||
if ($user->rights->societe->creer) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
|
||||
if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {
|
||||
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
|
||||
@ -635,7 +635,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ if ($result > 0) {
|
||||
}
|
||||
|
||||
|
||||
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionnote = $user->hasRight('adherent', 'creer'); // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
// Fetch object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
@ -71,10 +71,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('membernote'));
|
||||
@ -155,7 +155,7 @@ if ($id) {
|
||||
|
||||
|
||||
$cssclass = 'titlefield';
|
||||
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
|
||||
$permission = $user->hasRight('adherent', 'creer'); // Used by the include of notes.tpl.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
|
||||
|
||||
@ -112,10 +112,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -594,7 +594,7 @@ if ($rowid > 0) {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrThirdParty");
|
||||
print '</td>';
|
||||
if ($action != 'editthirdparty' && $user->rights->adherent->creer) {
|
||||
if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
@ -636,7 +636,7 @@ if ($rowid > 0) {
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans("LinkedToDolibarrUser");
|
||||
print '</td>';
|
||||
if ($action != 'editlogin' && $user->rights->adherent->creer) {
|
||||
if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
|
||||
print '<td class="right">';
|
||||
if ($user->rights->user->user->creer) {
|
||||
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&token='.newToken().'&rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
|
||||
@ -1072,7 +1072,7 @@ if ($rowid > 0) {
|
||||
|
||||
// Payment mode
|
||||
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200');
|
||||
print $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200', 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Date of payment
|
||||
|
||||
@ -753,7 +753,7 @@ if ($rowid > 0) {
|
||||
|
||||
// Actions
|
||||
print '<td class="center">';
|
||||
if ($user->rights->adherent->creer) {
|
||||
if ($user->hasRight('adherent', 'creer')) {
|
||||
print '<a class="editfielda marginleftonly" href="card.php?rowid='.$objp->rowid.'&action=edit&token='.newToken().'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
|
||||
}
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
|
||||
@ -53,10 +53,10 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
// Define variables to determine what the current user can do on the members
|
||||
$canaddmember = $user->rights->adherent->creer;
|
||||
$canaddmember = $user->hasRight('adherent', 'creer');
|
||||
// Define variables to determine what the current user can do on the properties of a member
|
||||
if ($id) {
|
||||
$caneditfieldmember = $user->rights->adherent->creer;
|
||||
$caneditfieldmember = $user->hasRight('adherent', 'creer');
|
||||
}
|
||||
|
||||
// Security check
|
||||
|
||||
@ -35,8 +35,8 @@ if (!$user->admin) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!in_array('clicktodial', $conf->modules)) {
|
||||
accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name")));
|
||||
if (!isModEnabled('clicktodial')) {
|
||||
accessforbidden($langs->transnoentitiesnoconv("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2086,7 +2086,7 @@ if ($id > 0) {
|
||||
} elseif ($value == 'fk_tva') {
|
||||
foreach ($form->cache_vatrates as $key => $Tab) {
|
||||
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) {
|
||||
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
|
||||
$valuetoshow = $form->cache_vatrates[$key]['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ print '<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">'
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')</td>';
|
||||
print '<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
|
||||
if ($conf->global->FICHINTER_PRINT_PRODUCTS) {
|
||||
if (getDolGlobalString("FICHINTER_PRINT_PRODUCTS")) {
|
||||
print 'checked ';
|
||||
}
|
||||
print '/>';
|
||||
@ -554,7 +554,7 @@ print '<td>';
|
||||
print $langs->trans("UseServicesDurationOnFichinter");
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.($conf->global->FICHINTER_USE_SERVICE_DURATION ? ' checked' : '').'>';
|
||||
print '<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString("FICHINTER_USE_SERVICE_DURATION") ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
@ -570,7 +570,7 @@ print '<td>';
|
||||
print $langs->trans("UseDurationOnFichinter");
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.($conf->global->FICHINTER_WITHOUT_DURATION ? ' checked' : '').'>';
|
||||
print '<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString("FICHINTER_WITHOUT_DURATION") ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
@ -586,7 +586,7 @@ print '<td>';
|
||||
print $langs->trans("UseDateWithoutHourOnFichinter");
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.($conf->global->FICHINTER_DATE_WITHOUT_HOUR ? ' checked' : '').'>';
|
||||
print '<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString("FICHINTER_DATE_WITHOUT_HOUR") ? ' checked' : '').'>';
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@ -624,7 +624,7 @@ if ($action == 'edit') {
|
||||
setEventMessages(null, $object->errors, "errors");
|
||||
}
|
||||
} else {
|
||||
print $conf->global->{$constname};
|
||||
print getDolGlobalString($constname);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1060,21 +1060,57 @@ if ($num) {
|
||||
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
||||
}
|
||||
|
||||
// If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email).
|
||||
// Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this:
|
||||
// $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
|
||||
$acceptlocallinktomedia = getDolGlobalInt('MAIN_DISALLOW_MEDIAS_IN_EMAIL_TEMPLATES') ? 0 : 1;
|
||||
if ($acceptlocallinktomedia) {
|
||||
global $dolibarr_main_url_root;
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
|
||||
// Parse $newUrl
|
||||
$newUrlArray = parse_url($urlwithouturlroot);
|
||||
$hosttocheck = $newUrlArray['host'];
|
||||
$hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6
|
||||
|
||||
if (function_exists('gethostbyname')) {
|
||||
$iptocheck = gethostbyname($hosttocheck);
|
||||
} else {
|
||||
$iptocheck = $hosttocheck;
|
||||
}
|
||||
|
||||
//var_dump($iptocheck.' '.$acceptlocallinktomedia);
|
||||
if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
// If ip of public url is an private network IP, we do not allow this.
|
||||
$acceptlocallinktomedia = 0;
|
||||
// TODO Show a warning
|
||||
}
|
||||
|
||||
if (preg_match('/http:/i', $urlwithouturlroot)) {
|
||||
// If public url is not a https, we do not allow to add medias link. It will generate security alerts when email will be sent.
|
||||
$acceptlocallinktomedia = 0;
|
||||
// TODO Show a warning
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpfieldlist == 'content') {
|
||||
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
}
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
if ($tmpfieldlist == 'content_lines') {
|
||||
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
}
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -237,7 +237,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&token='.newToken().'&value='.urlencode($file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&token='.newToken().'&value='.urlencode($file).(!empty($module->scandir) ? '&scan_dir='.$module->scandir : '').(!empty($module->name) ? '&label='.urlencode($module->name) : '').'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
@ -344,10 +344,10 @@ foreach ($dirmodels as $reldir) {
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
if (isset($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
if (isset($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -392,7 +392,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") {
|
||||
if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") {
|
||||
//print img_picto($langs->trans("Default"),'on');
|
||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.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
|
||||
* 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/>.
|
||||
*/
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.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
|
||||
* 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/admin/supplier_order.php
|
||||
@ -54,8 +54,8 @@ $specimenthirdparty->initAsSpecimen();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
@ -84,7 +84,9 @@ if ($action == 'updateMask') {
|
||||
$commande->thirdparty = $specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
|
||||
@ -194,8 +196,8 @@ if ($action == 'updateMask') {
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@ -313,8 +315,8 @@ print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Documents models for supplier orders
|
||||
*/
|
||||
* Documents models for supplier orders
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("OrdersModelModule"), '', '');
|
||||
|
||||
@ -369,7 +371,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
print "<tr class=\"oddeven\">\n";
|
||||
print "<td>";
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.'/'.$file;
|
||||
@ -437,8 +439,8 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*/
|
||||
* Other options
|
||||
*/
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -456,7 +458,7 @@ print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'<br>';
|
||||
print $langs->trans("IfSetToYesDontForgetPermission");
|
||||
print '</td><td>';
|
||||
print '<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.$conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED.'">';
|
||||
print '<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.getDolGlobalString("SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED").'">';
|
||||
print '</td><td class="right">';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
@ -466,30 +468,30 @@ print "</td></tr>\n";
|
||||
/* Kept as hidden for the moment
|
||||
if (isModEnabled('banque')) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td> </td><td align="center">';
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td> </td><td align="center">';
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER&token='.newToken().'&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
}
|
||||
*/
|
||||
|
||||
@ -539,8 +541,8 @@ print '</form>';
|
||||
|
||||
|
||||
/*
|
||||
* Notifications
|
||||
*/
|
||||
* Notifications
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("Notifications"), '', '');
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
@ -74,7 +74,7 @@ if ($action == 'updateMask') {
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->FACTURE_ADDON_PDF == "$value") {
|
||||
if (getDolGlobalString("FACTURE_ADDON_PDF") == "$value") {
|
||||
dolibarr_del_const($db, 'SUPPLIER_PAYMENT_ADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
@ -262,7 +262,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).(!empty($module->scandir) ? '&scandir='.$module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -288,7 +288,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
|
||||
if ($conf->global->PAYMENT_ADDON.'.php' == $file) { // If module is the one used, we show existing errors
|
||||
if (getDolGlobalString("PAYMENT_ADDON").'.php' == $file) { // If module is the one used, we show existing errors
|
||||
if (!empty($module->error)) {
|
||||
dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
}
|
||||
@ -350,7 +350,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
$module = new $classname($db, new Societe($db));
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
} else {
|
||||
@ -382,7 +382,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF == "$name") {
|
||||
if (getDolGlobalString("SUPPLIER_PAYMENT_ADDON_PDF") == "$name") {
|
||||
//print img_picto($langs->trans("Default"),'on');
|
||||
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&value='.urlencode($name).'&scandir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
@ -441,7 +441,7 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("GroupPaymentsByModOnReports");
|
||||
print '</td><td width="60" align="center">';
|
||||
print $form->selectyesno("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD, 1);
|
||||
print $form->selectyesno("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", getDolGlobalString("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1);
|
||||
print '</td><td class="right">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
@ -428,7 +428,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
if ($conf->global->TICKET_ADDON_PDF == $name) {
|
||||
if (getDolGlobalString("TICKET_ADDON_PDF") == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
@ -540,9 +540,10 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (isModEnabled('product')) {
|
||||
$htmlname = "product_category_id";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
|
||||
print '<td class="left">';
|
||||
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
|
||||
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, $htmlname);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_combobox('select_'.$htmlname);
|
||||
}
|
||||
|
||||
@ -381,10 +381,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
}
|
||||
|
||||
// Interface topic
|
||||
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
|
||||
$url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC");
|
||||
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$conf->global->TICKET_PUBLIC_INTERFACE_TOPIC.'" size="40" ></td>';
|
||||
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="'.$url_interface.'" size="40" ></td>';
|
||||
print '</td>';
|
||||
print '<td class="center width75">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
|
||||
@ -403,7 +403,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</td></tr>';
|
||||
|
||||
// Text to help to enter a ticket
|
||||
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
|
||||
$public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'));
|
||||
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -415,10 +415,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</td></tr>';
|
||||
|
||||
// Url public interface
|
||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
$url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE");
|
||||
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
|
||||
print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$url_interface.'"></td>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||
@ -448,7 +448,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '</tr>';
|
||||
|
||||
// Text of email after creatio of a ticket
|
||||
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
|
||||
$mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody'));
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
|
||||
print '</label>';
|
||||
@ -468,7 +468,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
|
||||
print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED"));
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -477,7 +477,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print '<tr><td>';
|
||||
print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.'" size="40" ></td>';
|
||||
print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL").'" size="40" ></td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ $langs->load("admin");
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$choice = GETPOST('choice', 'aZ09');
|
||||
|
||||
$nbsecondsold = GETPOSTINT('nbsecondsold');
|
||||
|
||||
// Define filelog to discard it from purge
|
||||
$filelog = '';
|
||||
@ -42,6 +42,7 @@ if (!empty($conf->syslog->enabled)) {
|
||||
$filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog);
|
||||
}
|
||||
|
||||
// Security
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -64,7 +65,8 @@ if ($action == 'purge' && !preg_match('/^confirm/i', $choice) && ($choice != 'al
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
||||
$utils = new Utils($db);
|
||||
$result = $utils->purgeFiles($choice);
|
||||
|
||||
$result = $utils->purgeFiles($choice, $nbsecondsold);
|
||||
|
||||
$mesg = $utils->output;
|
||||
setEventMessages($mesg, null, 'mesgs');
|
||||
@ -114,8 +116,11 @@ print '> <label for="choicetempfiles">'.$langs->trans("PurgeDeleteTemporaryFiles
|
||||
|
||||
print '<input type="radio" name="choice" id="choiceallfiles" value="confirm_allfiles"';
|
||||
print ($choice && $choice == 'confirm_allfiles') ? ' checked' : '';
|
||||
print '> <label for="choiceallfiles">'.$langs->trans("PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).'</label><br>';
|
||||
|
||||
print '> <label for="choiceallfiles">'.$langs->trans("PurgeDeleteAllFilesInDocumentsDir", $dolibarr_main_data_root).'</label>';
|
||||
print '<br>';
|
||||
if (getDolGlobalInt('MAIN_PURGE_ACCEPT_NBSECONDSOLD')) {
|
||||
print 'NbSecondsOld = <input class="width50 right" type="text" name="nbsecondsold" value="'.$nbsecondsold.'">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
//if ($choice != 'confirm_allfiles')
|
||||
@ -129,7 +134,7 @@ print '</form>';
|
||||
if (preg_match('/^confirm/i', $choice)) {
|
||||
print '<br>';
|
||||
$formquestion = array();
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles&nbsecondsold='.$nbsecondsold, $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -76,6 +76,8 @@ if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
|
||||
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||
}
|
||||
header('X-Frame-Options: SAMEORIGIN');
|
||||
|
||||
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
|
||||
@ -49,6 +49,17 @@ $modBarCodeThirdparty = '';
|
||||
|
||||
$maxperinit = 1000;
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
if (!isModEnabled('barcode')) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
//restrictedArea($user, 'barcode');
|
||||
if (empty($user->admin)) {
|
||||
accessforbidden('Must be admin');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -262,13 +273,6 @@ if ($action == 'initbarcodeproducts') {
|
||||
* View
|
||||
*/
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($conf->barcode->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("MassBarcodeInit"));
|
||||
|
||||
@ -56,6 +56,17 @@ $action = GETPOST('action', 'aZ09');
|
||||
$producttmp = new Product($db);
|
||||
$thirdpartytmp = new Societe($db);
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
if (!isModEnabled('barcode')) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
if (!$user->hasRight('barcode', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
restrictedArea($user, 'barcode');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -263,10 +274,6 @@ if ($action == 'builddoc') {
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($conf->barcode->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("BarCodePrintsheet"));
|
||||
|
||||
@ -180,6 +180,16 @@ if (empty($reshook)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// We check if we're allowed to add this bom
|
||||
$TParentBom=array();
|
||||
$object->getParentBomTreeRecursive($TParentBom);
|
||||
if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) {
|
||||
$n_child = new BOM($db);
|
||||
$n_child->fetch($bom_child_id);
|
||||
setEventMessages($langs->transnoentities('BomCantAddChildBom', $n_child->getNomUrl(1), $object->getNomUrl(1)), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null);
|
||||
|
||||
|
||||
@ -1379,6 +1379,38 @@ class BOM extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively retrieves all parent bom in the tree that leads to the $bom_id bom
|
||||
*
|
||||
* @param array $TParentBom We put all found parent bom in $TParentBom
|
||||
* @param int $bom_id ID of bom from which we want to get parent bom ids
|
||||
* @param int $level Protection against infinite loop
|
||||
* @return void
|
||||
*/
|
||||
public function getParentBomTreeRecursive(&$TParentBom, $bom_id = '', $level = 1)
|
||||
{
|
||||
|
||||
// Protection against infinite loop
|
||||
if ($level > 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($bom_id)) $bom_id=$this->id;
|
||||
|
||||
$sql = 'SELECT l.fk_bom, b.label
|
||||
FROM '.MAIN_DB_PREFIX.'bom_bomline l
|
||||
INNER JOIN '.MAIN_DB_PREFIX.$this->table_element.' b ON b.rowid = l.fk_bom
|
||||
WHERE fk_bom_child = '.((int) $bom_id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!empty($resql)) {
|
||||
while ($res = $this->db->fetch_object($resql)) {
|
||||
$TParentBom[$res->fk_bom] = $res->fk_bom;
|
||||
$this->getParentBomTreeRecursive($TParentBom, $res->fk_bom, $level+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function printDropdownBookmarksList()
|
||||
{
|
||||
global $conf, $user, $db, $langs;
|
||||
global $conf, $user, $db, $langs, $sortfield, $sortorder;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
@ -48,7 +48,6 @@ function printDropdownBookmarksList()
|
||||
}
|
||||
}
|
||||
}
|
||||
global $sortfield, $sortorder;
|
||||
$tmpurl = '';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) {
|
||||
|
||||
@ -386,7 +386,7 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -466,7 +466,7 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -546,7 +546,7 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
@ -624,7 +624,7 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
$object = new Contact($this->db);
|
||||
} elseif ($type === Categorie::TYPE_MEMBER) {
|
||||
if (!DolibarrApiAccess::$user->rights->adherent->creer) {
|
||||
if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$object = new Adherent($this->db);
|
||||
|
||||
@ -117,7 +117,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
||||
$tmpobject = new Societe($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'customer';
|
||||
} elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) {
|
||||
} elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$tmpobject = new Adherent($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
@ -563,7 +563,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -724,7 +724,7 @@ if ($type == Categorie::TYPE_SUPPLIER) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -733,7 +733,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
if ($user->hasRight("adherent", "read")) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
|
||||
$permission = $user->rights->adherent->creer;
|
||||
$permission = $user->hasRight('adherent', 'creer');
|
||||
|
||||
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||
if ($prods < 0) {
|
||||
@ -768,7 +768,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
|
||||
print '<br>';
|
||||
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer);
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('adherent', 'creer'));
|
||||
print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
|
||||
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
@ -808,7 +808,7 @@ if ($type == Categorie::TYPE_MEMBER) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ if ($type == Categorie::TYPE_CONTACT) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -977,7 +977,7 @@ if ($type == Categorie::TYPE_ACCOUNT) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1060,7 +1060,7 @@ if ($type == Categorie::TYPE_PROJECT) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1137,7 +1137,7 @@ if ($type == Categorie::TYPE_USER) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1201,7 +1201,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1280,7 +1280,7 @@ if ($type == Categorie::TYPE_TICKET) {
|
||||
}
|
||||
} else {
|
||||
print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket');
|
||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||
accessforbidden("NotEnoughPermissions", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,31 +25,36 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/action/card.php
|
||||
* \ingroup agenda
|
||||
* \brief Page for event card
|
||||
* \file htdocs/comm/action/card.php
|
||||
* \ingroup agenda
|
||||
* \brief Page for event card
|
||||
*/
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncommreminder.class.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncommreminder.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda", "mails"));
|
||||
|
||||
// Get Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
@ -96,6 +101,7 @@ if ($user->socid) {
|
||||
$error = GETPOST("error");
|
||||
$donotclearsession = GETPOST('donotclearsession') ?GETPOST('donotclearsession') : 0;
|
||||
|
||||
// Initialize Objects
|
||||
$object = new ActionComm($db);
|
||||
$cactioncomm = new CActionComm($db);
|
||||
$contact = new Contact($db);
|
||||
|
||||
@ -27,10 +27,6 @@
|
||||
* \brief Page to list actions
|
||||
*/
|
||||
|
||||
if (!defined("NOREDIRECTBYMAINTOLOGIN")) {
|
||||
define('NOREDIRECTBYMAINTOLOGIN', 1);
|
||||
}
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
@ -23,20 +23,22 @@
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/action/pertype.php
|
||||
* \ingroup agenda
|
||||
* \brief Tab of calendar events per type
|
||||
* \file htdocs/comm/action/pertype.php
|
||||
* \ingroup agenda
|
||||
* \brief Tab of calendar events per type
|
||||
*/
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
|
||||
|
||||
if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
|
||||
@ -51,28 +53,35 @@ $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = 0;
|
||||
|
||||
// $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = 0; // will be hidden here
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
|
||||
$filtert = $user->id;
|
||||
}
|
||||
|
||||
// Sorting
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
if (!$sortfield) {
|
||||
$sortfield = "a.datec";
|
||||
}
|
||||
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
// Page
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "a.datec";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("search_socid", "int") ?GETPOST("search_socid", "int") : GETPOST("socid", "int");
|
||||
@ -83,6 +92,7 @@ if ($socid < 0) {
|
||||
$socid = '';
|
||||
}
|
||||
|
||||
// Permissions
|
||||
$canedit = 1;
|
||||
if (empty($user->rights->agenda->myactions->read)) {
|
||||
accessforbidden();
|
||||
@ -105,6 +115,7 @@ $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'alpha') : GE
|
||||
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha');
|
||||
$maxprint = ((GETPOST("maxprint", 'int') != '') ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('search_actioncode', 'array')) {
|
||||
$actioncode = GETPOST('search_actioncode', 'array', 3);
|
||||
@ -117,11 +128,12 @@ if (GETPOST('search_actioncode', 'array')) {
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
|
||||
if ($dateselect > 0) {
|
||||
$day = GETPOST('dateselectday', 'int');
|
||||
$day = GETPOST('dateselectday', 'int');
|
||||
$month = GETPOST('dateselectmonth', 'int');
|
||||
$year = GETPOST('dateselectyear', 'int');
|
||||
$year = GETPOST('dateselectyear', 'int');
|
||||
}
|
||||
|
||||
// working hours
|
||||
$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||
$tmp = str_replace(' ', '', $tmp); // FIX 7533
|
||||
$tmparray = explode('-', $tmp);
|
||||
@ -137,6 +149,7 @@ if ($end_h <= $begin_h) {
|
||||
$end_h = $begin_h + 1;
|
||||
}
|
||||
|
||||
// working days
|
||||
$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
||||
$tmp = str_replace(' ', '', $tmp); // FIX 7533
|
||||
$tmparray = explode('-', $tmp);
|
||||
@ -150,19 +163,24 @@ if (empty($mode) && !GETPOSTISSET('mode')) {
|
||||
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
}
|
||||
|
||||
// View by month
|
||||
if (GETPOST('viewcal', 'alpha') && $mode != 'show_day' && $mode != 'show_week' && $mode != 'show_peruser') {
|
||||
$mode = 'show_month'; $day = '';
|
||||
} // View by month
|
||||
}
|
||||
// View by week
|
||||
if (GETPOST('viewweek', 'alpha') || $mode == 'show_week') {
|
||||
$mode = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d"));
|
||||
} // View by week
|
||||
}
|
||||
// View by day
|
||||
if (GETPOST('viewday', 'alpha') || $mode == 'show_day') {
|
||||
$mode = 'show_day'; $day = ($day ? $day : date("d"));
|
||||
} // View by day
|
||||
}
|
||||
// View by year
|
||||
if (GETPOST('viewyear', 'alpha') || $mode == 'show_year') {
|
||||
$mode = 'show_year';
|
||||
} // View by year
|
||||
}
|
||||
|
||||
// Initialize object
|
||||
$object = new ActionComm($db);
|
||||
|
||||
// Load translation files required by the page
|
||||
@ -218,6 +236,7 @@ $parameters = array(
|
||||
'resourceid' => $resourceid,
|
||||
'usergroup' => $usergroup,
|
||||
);
|
||||
|
||||
$reshook = $hookmanager->executeHooks('beforeAgendaPerType', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -226,14 +245,14 @@ if ($reshook < 0) {
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
|
||||
llxHeader('', $langs->trans("Agenda"), $help_url);
|
||||
|
||||
$now = dol_now();
|
||||
$nowarray = dol_getdate($now);
|
||||
$nowyear = $nowarray['year'];
|
||||
$nowyear = $nowarray['year'];
|
||||
$nowmonth = $nowarray['mon'];
|
||||
$nowday = $nowarray['mday'];
|
||||
$nowday = $nowarray['mday'];
|
||||
|
||||
|
||||
// Define list of all external calendars (global setup)
|
||||
@ -246,7 +265,7 @@ $first_year = $year;
|
||||
|
||||
$week = $prev['week'];
|
||||
|
||||
$day = (int) $day;
|
||||
$day = (int) $day;
|
||||
$next = dol_get_next_day($day, $month, $year);
|
||||
$next_year = $year + 1;
|
||||
$next_month = $month;
|
||||
|
||||
@ -316,8 +316,28 @@ if (empty($reshook)) {
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->set_date($user, $datep);
|
||||
if ($result > 0 && !empty($object->duree_validite) && !empty($object->fin_validite)) {
|
||||
$datev = $datep + ($object->duree_validite * 24 * 3600);
|
||||
$result = $object->set_echeance($user, $datev, 1);
|
||||
}
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
} elseif (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->model_pdf;
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setecheance' && $usercancreate) {
|
||||
@ -1771,13 +1791,13 @@ if ($action == 'create') {
|
||||
// Terms of payment
|
||||
print '<tr class="field_cond_reglement_id"><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
|
||||
print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent));
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
print '<tr class="field_mode_reglement_id"><td class="titlefieldcreate">'.$langs->trans('PaymentMode').'</td><td class="valuefieldcreate">';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
@ -2352,13 +2372,16 @@ if ($action == 'create') {
|
||||
// Date of proposal
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DatePropal');
|
||||
print '</td>';
|
||||
if ($action != 'editdate' && $usercancreate && $caneditfield) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
// print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
// print $langs->trans('DatePropal');
|
||||
// print '</td>';
|
||||
// if ($action != 'editdate' && $usercancreate && $caneditfield) {
|
||||
// print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
|
||||
// }
|
||||
|
||||
// print '</tr></table>';
|
||||
$editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT;
|
||||
print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable);
|
||||
print '</td><td class="valuefield">';
|
||||
if ($action == 'editdate' && $usercancreate && $caneditfield) {
|
||||
print '<form name="editdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
|
||||
@ -322,8 +322,8 @@ class Propal extends CommonObject
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
@ -384,7 +384,7 @@ class Propal extends CommonObject
|
||||
$this->socid = $socid;
|
||||
$this->id = $propalid;
|
||||
|
||||
$this->duree_validite = ((int) $conf->global->PROPALE_VALIDITY_DURATION);
|
||||
$this->duree_validite = getDolGlobalInt('PROPALE_VALIDITY_DURATION', 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1232,13 +1232,13 @@ if ($resql) {
|
||||
// Payment term
|
||||
if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1);
|
||||
print $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.total_ht']['checked'])) {
|
||||
|
||||
@ -1813,13 +1813,13 @@ if ($action == 'create' && $usercancreate) {
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'payment', 'class="pictofixedwidth"');
|
||||
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
|
||||
print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
|
||||
print img_picto('', 'bank', 'class="pictofixedwidth"');
|
||||
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx');
|
||||
print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank Account
|
||||
@ -2105,109 +2105,112 @@ if ($action == 'create' && $usercancreate) {
|
||||
}
|
||||
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
|
||||
|
||||
if (getDolGlobalInt('SALE_ORDER_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) {
|
||||
// This is a hidden option:
|
||||
// Suggestion to create invoice during order validation is not enabled by default.
|
||||
// Such choice should be managed by the workflow module and trigger. This option generates conflicts with some setup.
|
||||
// It may also break step of creating an order when invoicing must be done from proposals and not from orders
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
if (!empty($deposit_percent_from_payment_terms) && !empty($conf->facture->enabled) && !empty($user->rights->facture->creer)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
if (!empty($deposit_percent_from_payment_terms) && !empty($conf->facture->enabled) && !empty($user->rights->facture->creer)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
$object->fetchObjectLinked();
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
$eligibleForDepositGeneration = true;
|
||||
|
||||
$eligibleForDepositGeneration = true;
|
||||
|
||||
if (array_key_exists('facture', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break;
|
||||
if (array_key_exists('facture', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($eligibleForDepositGeneration && array_key_exists('propal', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['propal'] as $proposal) {
|
||||
$proposal->fetchObjectLinked();
|
||||
if ($eligibleForDepositGeneration && array_key_exists('propal', $object->linkedObjects)) {
|
||||
foreach ($object->linkedObjects['propal'] as $proposal) {
|
||||
$proposal->fetchObjectLinked();
|
||||
|
||||
if (array_key_exists('facture', $proposal->linkedObjects)) {
|
||||
foreach ($proposal->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break 2;
|
||||
if (array_key_exists('facture', $proposal->linkedObjects)) {
|
||||
foreach ($proposal->linkedObjects['facture'] as $invoice) {
|
||||
if ($invoice->type == Facture::TYPE_DEPOSIT) {
|
||||
$eligibleForDepositGeneration = false;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($eligibleForDepositGeneration) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => '',
|
||||
'name' => 'generate_deposit',
|
||||
'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected'))
|
||||
);
|
||||
|
||||
if ($eligibleForDepositGeneration) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => '',
|
||||
'name' => 'generate_deposit',
|
||||
'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected'))
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'datef',
|
||||
'label' => $langs->trans('DateInvoice'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'date_pointoftax',
|
||||
'label' => $langs->trans('DatePointOfTax'),
|
||||
'name' => 'datef',
|
||||
'label' => $langs->trans('DateInvoice'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
|
||||
$paymentTermsSelect = ob_get_clean();
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
|
||||
$formquestion[] = array(
|
||||
'type' => 'date',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'date_pointoftax',
|
||||
'label' => $langs->trans('DatePointOfTax'),
|
||||
'value' => dol_now(),
|
||||
'datenow' => true
|
||||
);
|
||||
}
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'other',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'cond_reglement_id',
|
||||
'label' => $langs->trans('PaymentTerm'),
|
||||
'value' => $paymentTermsSelect
|
||||
);
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => 'showonlyifgeneratedeposit',
|
||||
'name' => 'validate_generated_deposit',
|
||||
'label' => $langs->trans('ValidateGeneratedDeposit')
|
||||
);
|
||||
$paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
|
||||
|
||||
$formquestion[] = array(
|
||||
'type' => 'onecolumn',
|
||||
'value' => '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("[name=generate_deposit]").change(function () {
|
||||
let $self = $(this);
|
||||
let $target = $(".showonlyifgeneratedeposit").parent(".tagtr");
|
||||
$formquestion[] = array(
|
||||
'type' => 'other',
|
||||
'tdclass' => 'fieldrequired showonlyifgeneratedeposit',
|
||||
'name' => 'cond_reglement_id',
|
||||
'label' => $langs->trans('PaymentTerm'),
|
||||
'value' => $paymentTermsSelect
|
||||
);
|
||||
|
||||
if (! $self.parents(".tagtr").is(":hidden") && $self.is(":checked")) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
$formquestion[] = array(
|
||||
'type' => 'checkbox',
|
||||
'tdclass' => 'showonlyifgeneratedeposit',
|
||||
'name' => 'validate_generated_deposit',
|
||||
'label' => $langs->trans('ValidateGeneratedDeposit')
|
||||
);
|
||||
|
||||
return true;
|
||||
$formquestion[] = array(
|
||||
'type' => 'onecolumn',
|
||||
'value' => '
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("[name=generate_deposit]").change(function () {
|
||||
let $self = $(this);
|
||||
let $target = $(".showonlyifgeneratedeposit").parent(".tagtr");
|
||||
|
||||
if (! $self.parents(".tagtr").is(":hidden") && $self.is(":checked")) {
|
||||
$target.show();
|
||||
} else {
|
||||
$target.hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
'
|
||||
);
|
||||
</script>
|
||||
'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -330,8 +330,8 @@ class Commande extends CommonOrder
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
|
||||
|
||||
@ -1507,13 +1507,13 @@ if ($resql) {
|
||||
// Payment term
|
||||
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1);
|
||||
print $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Channel
|
||||
|
||||
@ -192,6 +192,9 @@ for ($mois = 1; $mois < 13; $mois++) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")."</td>";
|
||||
for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
$totsorties[$annee] = 0;
|
||||
$totentrees[$annee] = 0;
|
||||
|
||||
$case = sprintf("%04s-%02s", $annee, $mois);
|
||||
|
||||
print '<td class="right" width="10%"> ';
|
||||
|
||||
@ -1084,7 +1084,7 @@ if ($resql) {
|
||||
}
|
||||
if (!empty($arrayfields['type']['checked'])) {
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
|
||||
print $form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100', 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Numero
|
||||
@ -1277,7 +1277,7 @@ if ($resql) {
|
||||
}
|
||||
// Extra fields
|
||||
$element = 'banktransaction';
|
||||
if (is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label'])) {
|
||||
if (!empty($extrafields->attributes[$element]['label']) && is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label'])) {
|
||||
foreach ($extrafields->attributes[$element]['label'] as $key => $val) {
|
||||
if (!empty($arrayfields["ef.".$key]['checked'])) {
|
||||
if (!empty($arrayfields[$key]['checked'])) {
|
||||
|
||||
@ -315,7 +315,7 @@ class Account extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
|
||||
@ -22,17 +22,21 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/transfer.php
|
||||
* \ingroup banque
|
||||
* \brief Page de saisie d'un virement
|
||||
* \file htdocs/compta/bank/transfer.php
|
||||
* \ingroup bank
|
||||
* \brief Page for entering a bank transfer
|
||||
*/
|
||||
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("banks", "categories", "multicurrency"));
|
||||
$langs->loadLangs(array('banks', 'categories', 'multicurrency'));
|
||||
|
||||
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
|
||||
@ -293,7 +293,7 @@ if (GETPOST("account") || GETPOST("ref")) {
|
||||
}
|
||||
print "</td>";
|
||||
print "<td>".$ref."</td>";
|
||||
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
|
||||
if (getDolGlobalString("MULTICOMPANY_INVOICE_SHARING_ENABLED")) {
|
||||
if ($tmpobj->family == 'invoice') {
|
||||
$mc->getInfo($tmpobj->entity);
|
||||
print "<td>".$mc->label."</td>";
|
||||
|
||||
@ -418,7 +418,7 @@ if ($resql) {
|
||||
// Payment type
|
||||
if ($arrayfields['type']['checked']) {
|
||||
print '<td class="liste_titre center">';
|
||||
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100');
|
||||
print $form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16, 1, 'maxwidth100', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -3670,7 +3670,7 @@ if ($action == 'create') {
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -3702,7 +3702,7 @@ if ($action == 'create') {
|
||||
$retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||
}
|
||||
}
|
||||
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
@ -4728,7 +4728,7 @@ if ($action == 'create') {
|
||||
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
|
||||
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
} else {
|
||||
|
||||
@ -185,8 +185,8 @@ class FactureRec extends CommonInvoice
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
@ -144,7 +144,8 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* @var string customer ref
|
||||
*/
|
||||
public $ref_client;
|
||||
public $ref_client; // deprecated; use ref_customer instead
|
||||
public $ref_customer;
|
||||
|
||||
/**
|
||||
* @var int Ref Int
|
||||
@ -335,8 +336,8 @@ class Facture extends CommonInvoice
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
|
||||
@ -1985,8 +1986,9 @@ class Facture extends CommonInvoice
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_customer = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->type = $obj->type;
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
|
||||
@ -530,13 +530,13 @@ if ($resql) {
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
|
||||
// Payment term
|
||||
print '<td class="liste_titre right">';
|
||||
$form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
|
||||
print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
|
||||
print "</td>";
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
|
||||
// Payment mode
|
||||
print '<td class="liste_titre right">';
|
||||
$form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100');
|
||||
print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['recurring']['checked'])) {
|
||||
|
||||
@ -1365,13 +1365,13 @@ if ($resql) {
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
|
||||
print $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10, 1, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Payment terms
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_conditions_paiements($search_paymentterms, 'search_paymentterms', -1, 1, 1);
|
||||
print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Module source
|
||||
|
||||
@ -111,8 +111,14 @@ if (empty($reshook)) {
|
||||
$sourcetype = 'supplier_invoice';
|
||||
$newtype = 'bank-transfer';
|
||||
}
|
||||
$paymentservice = GETPOST('paymentservice');
|
||||
|
||||
if (preg_match('/stripesepa/', $paymentservice)) {
|
||||
$result = $object->demande_prelevement_stripe($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
} else {
|
||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
}
|
||||
|
||||
$result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
||||
@ -736,6 +742,22 @@ if ($object->id > 0) {
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
|
||||
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
|
||||
print '</form>';
|
||||
|
||||
if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
print "<br>";
|
||||
//add stripe sepa button
|
||||
$buttonlabel = $langs->trans("MakeWithdrawRequestStripe");
|
||||
print '<form method="POST" action="">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||
print '<input type="hidden" name="type" value="'.$type.'" />';
|
||||
print '<input type="hidden" name="action" value="new" />';
|
||||
print '<input type="hidden" name="paymenservice" value="stripesepa" />';
|
||||
print '<label for="withdraw_request_amount">'.$langs->trans('BankTransferAmount').' </label>';
|
||||
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="'.$remaintopaylesspendingdebit.'" size="9" />';
|
||||
print '<input type="submit" class="butAction" value="'.$buttonlabel.'" />';
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$buttonlabel.'</a>';
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ if ($action == 'create') {
|
||||
if (isModEnabled("banque")) {
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST("paiementtype"), "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
|
||||
print $form->select_types_paiements(GETPOST("paiementtype"), "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx', 1);
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
@ -63,6 +63,8 @@ if (!$sortfield) {
|
||||
|
||||
$year = GETPOST("year");
|
||||
$month = GETPOST("month");
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$view = GETPOST("view", 'alpha');
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
@ -400,7 +400,7 @@ if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
// Filter: Payment type
|
||||
if (!empty($arrayfields['c.libelle']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
|
||||
print $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1, 1, 1, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ if ($action == 'create') {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype", "int") : $tva->paiementtype, "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
|
||||
print $form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype", "int") : $tva->paiementtype, "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx', 1);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -61,6 +61,7 @@ $offset = $limit * $page;
|
||||
$hookmanager->initHooks(array('directdebitcreatecard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
@ -71,7 +72,7 @@ if ($type == 'bank-transfer') {
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
$option = "";
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -52,6 +52,8 @@ if (!$sortfield) {
|
||||
$sortfield = "p.datec";
|
||||
}
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
// Get supervariables
|
||||
$statut = GETPOST('statut', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
|
||||
@ -1064,7 +1064,11 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
//No need of GROUP BY
|
||||
} else {
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
}
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'p.ref';
|
||||
@ -1522,15 +1526,17 @@ $hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
|
||||
// Total
|
||||
print '<tr>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '<td colspan="'.($modecompta == 'BOOKKEEPING' ? 3 : 4).'"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
|
||||
@ -1538,7 +1544,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
|
||||
@ -1546,7 +1552,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
|
||||
|
||||
@ -274,6 +274,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
// Get array of all report groups that are active
|
||||
$cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include
|
||||
$unactive_cats = $AccCat->getCats(-1, 0);
|
||||
|
||||
/*
|
||||
$sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa';
|
||||
@ -325,6 +326,11 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Unactive categories have a total of 0 to be used in the formula.
|
||||
foreach ($unactive_cats as $un_cat) {
|
||||
$vars[$un_cat['code']] = 0;
|
||||
}
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach ($sommes as $code => $det) {
|
||||
$vars[$code] = $det['NP'];
|
||||
@ -405,6 +411,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
// Set $cpts with array of accounts in the category/group
|
||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||
// We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number.
|
||||
if (empty($cpts)) $cpts[] = array();
|
||||
|
||||
|
||||
$arrayofaccountforfilter = array();
|
||||
foreach ($cpts as $i => $cpt) { // Loop on each account.
|
||||
@ -477,7 +486,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
// Label of group
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($cat['label']);
|
||||
if (count($cpts) > 0) { // Show example of 5 first accounting accounts
|
||||
if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts
|
||||
$i = 0;
|
||||
foreach ($cpts as $cpt) {
|
||||
if ($i > 5) {
|
||||
|
||||
@ -457,7 +457,7 @@ if (!empty($arrayfields['cs.fk_user']['checked'])) {
|
||||
// Filter: Type
|
||||
if (!empty($arrayfields['cs.fk_mode_reglement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 0, 1, 'maxwidth150');
|
||||
print $form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 0, 1, 'maxwidth150', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -490,7 +490,7 @@ if ($action == 'create') {
|
||||
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST("type_payment", 'int'), "type_payment", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx');
|
||||
print $form->select_types_paiements(GETPOST("type_payment", 'int'), "type_payment", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusx', 1);
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
@ -354,7 +354,7 @@ if (!empty($arrayfields['t.datev']['checked'])) {
|
||||
// Filter: Type
|
||||
if (!empty($arrayfields['t.fk_typepayment']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
$form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 16);
|
||||
print $form->select_types_paiements($search_type, 'search_type', '', 0, 1, 1, 16, 1, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -237,8 +237,8 @@ class Contrat extends CommonObject
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -41,8 +41,8 @@ if ((GETPOST('sendit', 'alpha')
|
||||
|| ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
|| ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha'))
|
||||
|| ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha'))) && empty($permissiontoadd)) {
|
||||
dol_syslog('The file actions_linkedfiles.inc.php was included but paramater $permissiontoadd as not set before.');
|
||||
print 'The file actions_linkedfiles.inc.php was included but paramater $permissiontoadd as not set before.';
|
||||
dol_syslog('The file actions_linkedfiles.inc.php was included but parameter $permissiontoadd was not set before.');
|
||||
print 'The file actions_linkedfiles.inc.php was included but parameter $permissiontoadd was not set before.';
|
||||
die;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
/* Copyright (C) 2015-2022 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
|
||||
@ -65,13 +66,15 @@ if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
//$user->rights->societe->lire = 0;$user->rights->fournisseur->lire = 0;
|
||||
//restrictedArea($user, 'societe', $id);
|
||||
|
||||
if (in_array($field, array('status'))) {
|
||||
restrictedArea($user, $element, $id);
|
||||
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
|
||||
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
|
||||
} else {
|
||||
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
|
||||
exit;
|
||||
httponly_accessforbidden("Bad value for combination of parameters element/field.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -74,9 +74,7 @@ if ($type == 'proposal') {
|
||||
}
|
||||
|
||||
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403);
|
||||
}
|
||||
|
||||
|
||||
@ -214,6 +212,15 @@ if ($action == "importSignature") {
|
||||
$db->commit();
|
||||
$response = "success";
|
||||
setEventMessages("PropalSigned", null, 'warnings');
|
||||
if (method_exists($object, 'call_trigger')) {
|
||||
//customer is not a user !?! so could we use same user as validation ?
|
||||
$user = new User($db);
|
||||
$user->fetch($object->user_valid_id);
|
||||
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
$error++;
|
||||
|
||||
@ -40,6 +40,7 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOREDIRECTBYMAINTOLOGIN')) {
|
||||
// Disable redirect to main login because the selectsearch must not ask a login
|
||||
define('NOREDIRECTBYMAINTOLOGIN', '1');
|
||||
}
|
||||
|
||||
@ -78,7 +79,7 @@ if (isModEnabled('societe') && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISA
|
||||
$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (((isModEnabled('product') && $user->hasRight('produit', 'lire')) || (isModEnabled('service') && $user->hasRight('service', 'lire'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) {
|
||||
if (((isModEnabled('product') && $user->hasRight('product', 'read')) || (isModEnabled('service') && $user->hasRight('service', 'read'))) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) {
|
||||
$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
|
||||
// search on lot/serial numbers
|
||||
if (isModEnabled('productbatch')) {
|
||||
|
||||
@ -122,8 +122,8 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
)
|
||||
&& empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
|
||||
'contacts' => isModEnabled('societe') && $user->hasRight('societe', 'contact', 'lire'),
|
||||
'products' => isModEnabled('product') && $user->hasRight('produit', 'lire'),
|
||||
'services' => isModEnabled('service') && $user->hasRight('service', 'lire'),
|
||||
'products' => isModEnabled('product') && $user->hasRight('product', 'read'),
|
||||
'services' => isModEnabled('service') && $user->hasRight('service', 'read'),
|
||||
'proposals' => isModEnabled('propal') && $user->hasRight('propal', 'read'),
|
||||
'orders' => isModEnabled('commande') && $user->hasRight('commande', 'lire'),
|
||||
'invoices' => isModEnabled('facture') && $user->hasRight('facture', 'lire'),
|
||||
|
||||
@ -150,9 +150,9 @@ class box_produits extends ModeleBoxes
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
|
||||
$productstatic->date_modification = $datem;
|
||||
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read');
|
||||
if ($productstatic->isService()) {
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read');
|
||||
}
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -823,6 +823,815 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Create a withdrawal request for a direct debit order or a credit transfer order.
|
||||
* Use the remain to pay excluding all existing open direct debit requests.
|
||||
*
|
||||
* @param User $fuser User asking the direct debit transfer
|
||||
* @param float $amount Amount we request direct debit for
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param string $sourcetype Source ('facture' or 'supplier_invoice')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function demande_prelevement_stripe($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc, $user, $langs;
|
||||
|
||||
if (empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
|
||||
//exit
|
||||
return 0;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement_stripe 0", LOG_DEBUG);
|
||||
|
||||
if ($this->statut > self::STATUS_DRAFT && $this->paye == 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
$bac->fetch(0, $this->socid);
|
||||
|
||||
$sql = 'SELECT count(*)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' WHERE fk_facture = '.((int) $this->id);
|
||||
$sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments
|
||||
$sql .= ' AND traite = 0';
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement_stripe 1", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$row = $this->db->fetch_row($resql);
|
||||
|
||||
if ($row[0] == 0) {
|
||||
$now = dol_now();
|
||||
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalcreditnotes = $this->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->getSumDepositsUsed();
|
||||
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
if (empty($amount)) {
|
||||
$amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
}
|
||||
|
||||
if (is_numeric($amount) && $amount != 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php';
|
||||
$companypaymentmode = new CompanyPaymentMode($this->db);
|
||||
$companypaymentmode->fetch($bac->id);
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement_stripe amount=$amount, companypaymentmode = " . $companypaymentmode->id, LOG_DEBUG);
|
||||
|
||||
//Start code from sellyoursaas
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
|
||||
$langs->load("agenda");
|
||||
dol_syslog("doTakePaymentStripeForThirdparty service=" . $service . " servicestatus=" . $servicestatus . " thirdparty_id=" . $this->socid . " companypaymentmode=" . $companypaymentmode->id . " noemailtocustomeriferror=" . $noemailtocustomeriferror . " nocancelifpaymenterror=" . $nocancelifpaymenterror . " calledinmyaccountcontext=" . $calledinmyaccountcontext);
|
||||
|
||||
$this->stripechargedone = 0;
|
||||
$this->stripechargeerror = 0;
|
||||
$now = dol_now();
|
||||
|
||||
$currency = $conf->currency;
|
||||
|
||||
global $stripearrayofkeysbyenv;
|
||||
global $savstripearrayofkeysbyenv;
|
||||
|
||||
$errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop
|
||||
|
||||
$this->fetch_thirdparty();
|
||||
|
||||
dol_syslog("--- Process invoice thirdparty_id=" . $this->id . ", thirdparty_name=" . $this->thirdparty->name . " id=" . $this->id . ", ref=" . $this->ref . ", datef=" . dol_print_date($this->date, 'dayhourlog'), LOG_DEBUG);
|
||||
|
||||
$alreadypayed = $this->getSommePaiement();
|
||||
$amount_credit_notes_included = $this->getSumCreditNotesUsed();
|
||||
$amounttopay = $this->total_ttc - $alreadypayed - $amount_credit_notes_included;
|
||||
|
||||
// Correct the amount according to unit of currency
|
||||
// See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support
|
||||
$arrayzerounitcurrency = ['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'];
|
||||
$amountstripe = $amounttopay;
|
||||
if (!in_array($currency, $arrayzerounitcurrency)) {
|
||||
$amountstripe = $amountstripe * 100;
|
||||
}
|
||||
|
||||
if ($amountstripe > 0) {
|
||||
try {
|
||||
//var_dump($companypaymentmode);
|
||||
dol_syslog("We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG);
|
||||
|
||||
$thirdparty = new Societe($this->db);
|
||||
$resultthirdparty = $thirdparty->fetch($this->socid);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php
|
||||
// So it inits or erases the $stripearrayofkeysbyenv
|
||||
$stripe = new Stripe($this->db);
|
||||
|
||||
if (empty($savstripearrayofkeysbyenv)) {
|
||||
$savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
|
||||
}
|
||||
dol_syslog("Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']);
|
||||
dol_syslog("Current Saved Stripe environment is " . $savstripearrayofkeysbyenv[$servicestatus]['publishable_key']);
|
||||
|
||||
$foundalternativestripeaccount = '';
|
||||
|
||||
// Force stripe to another value (by default this value is empty)
|
||||
if (!empty($thirdparty->array_options['options_stripeaccount'])) {
|
||||
dol_syslog("The thirdparty id=" . $thirdparty->id . " has a dedicated Stripe Account, so we switch to it.");
|
||||
|
||||
$tmparray = explode('@', $thirdparty->array_options['options_stripeaccount']);
|
||||
if (!empty($tmparray[1])) {
|
||||
$tmparray2 = explode(':', $tmparray[1]);
|
||||
if (!empty($tmparray2[3])) {
|
||||
$stripearrayofkeysbyenv = [
|
||||
0 => [
|
||||
"publishable_key" => $tmparray2[0],
|
||||
"secret_key" => $tmparray2[1]
|
||||
],
|
||||
1 => [
|
||||
"publishable_key" => $tmparray2[2],
|
||||
"secret_key" => $tmparray2[3]
|
||||
]
|
||||
];
|
||||
|
||||
$stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
||||
|
||||
$foundalternativestripeaccount = $tmparray[0]; // Store the customer id
|
||||
|
||||
dol_syslog("We use now customer=" . $foundalternativestripeaccount . " publishable_key=" . $stripearrayofkeys['publishable_key'], LOG_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$foundalternativestripeaccount) {
|
||||
$stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
|
||||
|
||||
$stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
||||
dol_syslog("We found a bad value for Stripe Account for thirdparty id=" . $thirdparty->id . ", so we ignore it and keep using the global one, so " . $stripearrayofkeys['publishable_key'], LOG_WARNING);
|
||||
}
|
||||
} else {
|
||||
$stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
|
||||
|
||||
$stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
|
||||
dol_syslog("The thirdparty id=" . $thirdparty->id . " has no dedicated Stripe Account, so we use global one, so " . json_encode($stripearrayofkeys), LOG_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("get stripe account", LOG_DEBUG);
|
||||
$stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)
|
||||
dol_syslog("get stripe account return " . json_encode($stripeacc), LOG_DEBUG);
|
||||
|
||||
if ($foundalternativestripeaccount) {
|
||||
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
|
||||
$customer = \Stripe\Customer::retrieve(['id' => "$foundalternativestripeaccount", 'expand[]' => 'sources']);
|
||||
} else {
|
||||
$customer = \Stripe\Customer::retrieve(['id' => "$foundalternativestripeaccount", 'expand[]' => 'sources'], ["stripe_account" => $stripeacc]);
|
||||
}
|
||||
} else {
|
||||
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
|
||||
if (empty($customer) && !empty($stripe->error)) {
|
||||
$this->errors[] = $stripe->error;
|
||||
}
|
||||
/*if (!empty($customer) && empty($customer->sources)) {
|
||||
$customer = null;
|
||||
$this->errors[] = '\Stripe\Customer::retrieve did not returned the sources';
|
||||
}*/
|
||||
}
|
||||
|
||||
// $nbhoursbetweentries = (empty($conf->global->SELLYOURSAAS_NBHOURSBETWEENTRIES) ? 49 : $conf->global->SELLYOURSAAS_NBHOURSBETWEENTRIES); // Must have more that 48 hours + 1 between each try (so 1 try every 3 daily batch)
|
||||
// $nbdaysbeforeendoftries = (empty($conf->global->SELLYOURSAAS_NBDAYSBEFOREENDOFTRIES) ? 35 : $conf->global->SELLYOURSAAS_NBDAYSBEFOREENDOFTRIES);
|
||||
$labeltouse = '';
|
||||
$postactionmessages = [];
|
||||
|
||||
if ($resultthirdparty > 0 && !empty($customer)) {
|
||||
if (!$error && !empty($this->array_options['options_delayautopayment']) && $this->array_options['options_delayautopayment'] > $now && empty($calledinmyaccountcontext)) {
|
||||
$errmsg = 'Payment try was canceled (invoice qualified by the automatic payment was delayed after the ' . dol_print_date($this->array_options['options_delayautopayment'], 'day') . ')';
|
||||
dol_syslog($errmsg, LOG_DEBUG);
|
||||
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
$this->errors[] = $errmsg;
|
||||
}
|
||||
// if (!$error && ($this->date < ($now - ($nbdaysbeforeendoftries * 24 * 3600))) // We try until we reach $nbdaysbeforeendoftries
|
||||
// && ($this->date < ($now - (62 * 24 * 3600)) || $this->date > ($now - (60 * 24 * 3600))) // or when we have 60 days
|
||||
// && ($this->date < ($now - (92 * 24 * 3600)) || $this->date > ($now - (90 * 24 * 3600))) // or when we have 90 days
|
||||
// && empty($nocancelifpaymenterror)) {
|
||||
// $errmsg = 'Payment try was canceled (invoice date is older than ' . $nbdaysbeforeendoftries . ' days and not 60 days old and not 90 days old) - You can still take payment from backoffice.';
|
||||
// dol_syslog($errmsg, LOG_DEBUG);
|
||||
|
||||
// $error++;
|
||||
// $errorforinvoice++;
|
||||
// $this->errors[] = $errmsg;
|
||||
// }
|
||||
// if (!$error && empty($nocancelifpaymenterror)) { // If we are not in a mode that ask to avoid cancelation, we cancel payment.
|
||||
// // Test if last AC_PAYMENT_STRIPE_KO event is an old error lower than $nbhoursbetweentries hours.
|
||||
// $recentfailedpayment = false;
|
||||
// $sqlonevents = 'SELECT COUNT(*) as nb FROM ' . MAIN_DB_PREFIX . 'actioncomm WHERE fk_soc = ' . ((int) $thirdparty->id) . " AND code ='AC_PAYMENT_STRIPE_KO' AND datep > '" . $this->db->idate($now - ($nbhoursbetweentries * 3600)) . "'";
|
||||
// $resqlonevents = $this->db->query($sqlonevents);
|
||||
// if ($resqlonevents) {
|
||||
// $obj = $this->db->fetch_object($resqlonevents);
|
||||
// if ($obj && $obj->nb > 0) {
|
||||
// $recentfailedpayment = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($recentfailedpayment) {
|
||||
// $errmsg = 'Payment try was canceled (recent payment, in last ' . $nbhoursbetweentries . ' hours, with error AC_PAYMENT_STRIPE_KO for this customer)';
|
||||
// dol_syslog($errmsg, LOG_DEBUG);
|
||||
|
||||
// $error++;
|
||||
// $errorforinvoice++;
|
||||
// $this->errors[] = $errmsg;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!$error) { // Payment was not canceled
|
||||
//erics card or sepa ?
|
||||
$sepaMode = false;
|
||||
if ($companypaymentmode->type == 'ban') {
|
||||
$sepaMode = true;
|
||||
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
|
||||
} else {
|
||||
$stripecard = $stripe->cardStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
|
||||
}
|
||||
|
||||
if ($stripecard) { // Can be card_... (old mode) or pm_... (new mode)
|
||||
$FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id;
|
||||
$description = 'Stripe payment from doTakePaymentStripeForThirdparty: ' . $FULLTAG . ' ref=' . $this->ref;
|
||||
|
||||
$stripefailurecode = '';
|
||||
$stripefailuremessage = '';
|
||||
$stripefailuredeclinecode = '';
|
||||
|
||||
if (preg_match('/^card_/', $stripecard->id)) { // Using old method
|
||||
dol_syslog("* Create charge on card " . $stripecard->id . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
|
||||
|
||||
$ipaddress = getUserRemoteIP();
|
||||
|
||||
$charge = null; // Force reset of $charge, so, if already set from a previous fetch, it will be empty even if there is an exception at next step
|
||||
try {
|
||||
$charge = \Stripe\Charge::create([
|
||||
'amount' => price2num($amountstripe, 'MU'),
|
||||
'currency' => $currency,
|
||||
'capture' => true, // Charge immediatly
|
||||
'description' => $description,
|
||||
'metadata' => ["FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress],
|
||||
'customer' => $customer->id,
|
||||
//'customer' => 'bidon_to_force_error', // To use to force a stripe error
|
||||
'source' => $stripecard,
|
||||
'statement_descriptor' => dol_trunc('INV=' . $this->id, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
|
||||
]);
|
||||
} catch (\Stripe\Error\Card $e) {
|
||||
// Since it's a decline, Stripe_CardError will be caught
|
||||
$body = $e->getJsonBody();
|
||||
$err = $body['error'];
|
||||
|
||||
$stripefailurecode = $err['code'];
|
||||
$stripefailuremessage = $err['message'];
|
||||
$stripefailuredeclinecode = $err['decline_code'];
|
||||
} catch (Exception $e) {
|
||||
$stripefailurecode = 'UnknownChargeError';
|
||||
$stripefailuremessage = $e->getMessage();
|
||||
}
|
||||
} else { // Using new SCA method
|
||||
if ($sepaMode)
|
||||
dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
|
||||
else dol_syslog("* Create payment on card " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
|
||||
|
||||
// Create payment intent and charge payment (confirmnow = true)
|
||||
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
|
||||
|
||||
$charge = new stdClass();
|
||||
//erics add processing sepa is like success ?
|
||||
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
|
||||
$charge->status = 'ok';
|
||||
$charge->id = $paymentintent->id;
|
||||
$charge->customer = $customer->id;
|
||||
} elseif ($paymentintent->status === 'requires_action') {
|
||||
//paymentintent->status may be => 'requires_action' (no error in such a case)
|
||||
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
|
||||
|
||||
$charge->status = 'failed';
|
||||
$charge->customer = $customer->id;
|
||||
$charge->failure_code = $stripe->code;
|
||||
$charge->failure_message = $stripe->error;
|
||||
$charge->failure_declinecode = $stripe->declinecode;
|
||||
$stripefailurecode = $stripe->code;
|
||||
$stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
|
||||
$stripefailuredeclinecode = $stripe->declinecode;
|
||||
} else {
|
||||
dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
|
||||
|
||||
$charge->status = 'failed';
|
||||
$charge->customer = $customer->id;
|
||||
$charge->failure_code = $stripe->code;
|
||||
$charge->failure_message = $stripe->error;
|
||||
$charge->failure_declinecode = $stripe->declinecode;
|
||||
$stripefailurecode = $stripe->code;
|
||||
$stripefailuremessage = $stripe->error;
|
||||
$stripefailuredeclinecode = $stripe->declinecode;
|
||||
}
|
||||
|
||||
//var_dump("stripefailurecode=".$stripefailurecode." stripefailuremessage=".$stripefailuremessage." stripefailuredeclinecode=".$stripefailuredeclinecode);
|
||||
//exit;
|
||||
}
|
||||
|
||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||
if (empty($charge) || $charge->status == 'failed') {
|
||||
dol_syslog('Failed to charge card or payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
|
||||
|
||||
// Save a stripe payment was in error
|
||||
$this->stripechargeerror++;
|
||||
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
$errmsg = $langs->trans("FailedToChargeCard");
|
||||
if (!empty($charge)) {
|
||||
if ($stripefailuredeclinecode == 'authentication_required') {
|
||||
$errauthenticationmessage = $langs->trans("ErrSCAAuthentication");
|
||||
$errmsg = $errauthenticationmessage;
|
||||
} elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) {
|
||||
$errmsg .= ': ' . $charge->failure_code;
|
||||
$errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message;
|
||||
if (empty($stripefailurecode)) {
|
||||
$stripefailurecode = $charge->failure_code;
|
||||
}
|
||||
if (empty($stripefailuremessage)) {
|
||||
$stripefailuremessage = $charge->failure_message;
|
||||
}
|
||||
} else {
|
||||
$errmsg .= ': failure_code=' . $charge->failure_code;
|
||||
$errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message;
|
||||
if (empty($stripefailurecode)) {
|
||||
$stripefailurecode = $charge->failure_code;
|
||||
}
|
||||
if (empty($stripefailuremessage)) {
|
||||
$stripefailuremessage = $charge->failure_message;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage;
|
||||
$errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : '');
|
||||
}
|
||||
|
||||
$description = 'Stripe payment ERROR from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
|
||||
$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
$this->errors[] = $errmsg;
|
||||
} else {
|
||||
dol_syslog('Successfuly charge card ' . $stripecard->id);
|
||||
|
||||
$postactionmessages[] = 'Success to charge card (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
|
||||
// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
|
||||
// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
|
||||
$this->stripechargedone++;
|
||||
|
||||
// Default description used for label of event. Will be overwrite by another value later.
|
||||
$description = 'Stripe payment OK (' . $charge->id . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
|
||||
|
||||
$db = $this->db;
|
||||
|
||||
$ipaddress = getUserRemoteIP();
|
||||
|
||||
$TRANSACTIONID = $charge->id;
|
||||
$currency = $conf->currency;
|
||||
$paymentmethod = 'stripe';
|
||||
$emetteur_name = $charge->customer;
|
||||
|
||||
// Same code than into paymentok.php...
|
||||
|
||||
$paymentTypeId = 0;
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||
}
|
||||
if (empty($paymentTypeId)) {
|
||||
//erics
|
||||
if ($sepaMode) {
|
||||
$paymentType = 'PRE';
|
||||
} else {
|
||||
$paymentType = $_SESSION["paymentType"];
|
||||
if (empty($paymentType)) {
|
||||
$paymentType = 'CB';
|
||||
}
|
||||
}
|
||||
$paymentTypeId = dol_getIdFromCode($this->db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||
}
|
||||
|
||||
$currencyCodeType = $currency;
|
||||
|
||||
$ispostactionok = 1;
|
||||
|
||||
// Creation of payment line
|
||||
include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
$paiement = new Paiement($this->db);
|
||||
$paiement->datepaye = $now;
|
||||
$paiement->date = $now;
|
||||
if ($currencyCodeType == $conf->currency) {
|
||||
$paiement->amounts = [$this->id => $amounttopay]; // Array with all payments dispatching with invoice id
|
||||
} else {
|
||||
$paiement->multicurrency_amounts = [$this->id => $amounttopay]; // Array with all payments dispatching
|
||||
|
||||
$postactionmessages[] = 'Payment was done in a different currency than currency expected of company';
|
||||
$ispostactionok = -1;
|
||||
// Not yet supported, so error
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
}
|
||||
$paiement->paiementid = $paymentTypeId;
|
||||
$paiement->num_paiement = '';
|
||||
$paiement->num_payment = '';
|
||||
// Add a comment with keyword 'SellYourSaas' in text. Used by trigger.
|
||||
$paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
|
||||
$paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
|
||||
$paiement->ext_payment_id = $charge->id . ':' . $customer->id . '@' . $stripearrayofkeys['publishable_key'];
|
||||
$paiement->ext_payment_site = 'stripe';
|
||||
|
||||
if (!$errorforinvoice) {
|
||||
dol_syslog('* Record payment for invoice id ' . $this->id . '. It includes closing of invoice and regenerating document');
|
||||
|
||||
// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
|
||||
$paiement_id = $paiement->create($user, 1);
|
||||
if ($paiement_id < 0) {
|
||||
$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("<br>\n", $paiement->errors);
|
||||
$ispostactionok = -1;
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
} else {
|
||||
$postactionmessages[] = 'Payment created';
|
||||
}
|
||||
|
||||
dol_syslog("The payment has been created for invoice id " . $this->id);
|
||||
}
|
||||
|
||||
if (!$errorforinvoice && !empty($conf->banque->enabled)) {
|
||||
dol_syslog('* Add payment to bank');
|
||||
|
||||
$bankaccountid = 0;
|
||||
if ($paymentmethod == 'paybox') {
|
||||
$bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
if ($paymentmethod == 'stripe') {
|
||||
$bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
|
||||
}
|
||||
|
||||
if ($bankaccountid > 0) {
|
||||
$label = '(CustomerInvoicePayment)';
|
||||
if ($this->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$label = '(CustomerInvoicePaymentBack)';
|
||||
} // Refund of a credit note
|
||||
$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $emetteur_name, '');
|
||||
if ($result < 0) {
|
||||
$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("<br>\n", $paiement->errors);
|
||||
$ispostactionok = -1;
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
} else {
|
||||
$postactionmessages[] = 'Bank transaction of payment created (by doTakePaymentStripeForThirdparty)';
|
||||
}
|
||||
} else {
|
||||
$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
|
||||
$ispostactionok = -1;
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ispostactionok < 1) {
|
||||
$description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
|
||||
} else {
|
||||
$description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG;
|
||||
}
|
||||
}
|
||||
|
||||
$object = $invoice;
|
||||
|
||||
// Send emails
|
||||
$labeltouse = 'InvoicePaymentSuccess';
|
||||
$sendemailtocustomer = 1;
|
||||
|
||||
if (empty($charge) || $charge->status == 'failed') {
|
||||
$labeltouse = 'InvoicePaymentFailure';
|
||||
if ($noemailtocustomeriferror) {
|
||||
$sendemailtocustomer = 0;
|
||||
} // $noemailtocustomeriferror is set when error already reported on myaccount screen
|
||||
}
|
||||
|
||||
// Track an event
|
||||
if (empty($charge) || $charge->status == 'failed') {
|
||||
$actioncode = 'PAYMENT_STRIPE_KO';
|
||||
$extraparams = $stripefailurecode;
|
||||
$extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage;
|
||||
$extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode;
|
||||
} else {
|
||||
$actioncode = 'PAYMENT_STRIPE_OK';
|
||||
$extraparams = '';
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog("No card or payment method found for this stripe customer " . $customer->id, LOG_WARNING);
|
||||
$this->errors[] = 'Failed to get card | payment method for stripe customer = ' . $customer->id;
|
||||
|
||||
$labeltouse = 'InvoicePaymentFailure';
|
||||
$sendemailtocustomer = 1;
|
||||
if ($noemailtocustomeriferror) {
|
||||
$sendemailtocustomer = 0;
|
||||
} // $noemailtocustomeriferror is set when error already reported on myaccount screen
|
||||
|
||||
$description = 'Failed to find or use the payment mode - no credit card defined for the customer account';
|
||||
$stripefailurecode = 'BADPAYMENTMODE';
|
||||
$stripefailuremessage = 'Failed to find or use the payment mode - no credit card defined for the customer account';
|
||||
$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')';
|
||||
|
||||
$object = $invoice;
|
||||
|
||||
$actioncode = 'PAYMENT_STRIPE_KO';
|
||||
$extraparams = '';
|
||||
}
|
||||
} else {
|
||||
// If error because payment was canceled for a logical reason, we do nothing (no email and no event added)
|
||||
$labeltouse = '';
|
||||
$sendemailtocustomer = 0;
|
||||
|
||||
$description = '';
|
||||
$stripefailurecode = '';
|
||||
$stripefailuremessage = '';
|
||||
|
||||
$object = $invoice;
|
||||
|
||||
$actioncode = '';
|
||||
$extraparams = '';
|
||||
}
|
||||
} else { // Else of the if ($resultthirdparty > 0 && ! empty($customer)) {
|
||||
if ($resultthirdparty <= 0) {
|
||||
dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
|
||||
$this->errors[] = 'Failed to load customer for thirdparty_id = ' . $thirdparty->id;
|
||||
} else { // $customer stripe not found
|
||||
dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
|
||||
$this->errors[] = 'Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
|
||||
}
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
|
||||
$labeltouse = 'InvoicePaymentFailure';
|
||||
$sendemailtocustomer = 1;
|
||||
if ($noemailtocustomeriferror) {
|
||||
$sendemailtocustomer = 0;
|
||||
} // $noemailtocustomeriferror is set when error already reported on myaccount screen
|
||||
|
||||
$description = 'Failed to find or use your payment mode (no payment mode for this customer id)';
|
||||
$stripefailurecode = 'BADPAYMENTMODE';
|
||||
$stripefailuremessage = 'Failed to find or use your payment mode (no payment mode for this customer id)';
|
||||
$postactionmessages = [];
|
||||
|
||||
$object = $invoice;
|
||||
|
||||
$actioncode = 'PAYMENT_STRIPE_KO';
|
||||
$extraparams = '';
|
||||
}
|
||||
|
||||
// Send email + create action after
|
||||
if ($sendemailtocustomer && $labeltouse) {
|
||||
dol_syslog("* Send email with result of payment - " . $labeltouse);
|
||||
|
||||
// Set output language
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
|
||||
$outputlangs->loadLangs(["main", "members", "bills"]);
|
||||
|
||||
// Get email content from templae
|
||||
$arraydefaultmessage = null;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
if (!empty($labeltouse)) {
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse);
|
||||
}
|
||||
|
||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
$subject = $arraydefaultmessage->topic;
|
||||
$msg = $arraydefaultmessage->content;
|
||||
}
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
|
||||
//$substitutionarray['__SELLYOURSAAS_PAYMENT_ERROR_DESC__'] = $stripefailurecode . ' ' . $stripefailuremessage;
|
||||
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
// Set the property ->ref_customer with ref_customer of contract so __REF_CLIENT__ will be replaced in email content
|
||||
// Search contract linked to invoice
|
||||
$foundcontract = null;
|
||||
$this->fetchObjectLinked();
|
||||
if (is_array($this->linkedObjects['contrat']) && count($this->linkedObjects['contrat']) > 0) {
|
||||
//dol_sort_array($object->linkedObjects['facture'], 'date');
|
||||
foreach ($this->linkedObjects['contrat'] as $idcontract => $contract) {
|
||||
$substitutionarray['__CONTRACT_REF__'] = $contract->ref_customer;
|
||||
$substitutionarray['__REFCLIENT__'] = $contract->ref_customer; // For backward compatibility
|
||||
$substitutionarray['__REF_CLIENT__'] = $contract->ref_customer;
|
||||
$foundcontract = $contract;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__=' . $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
|
||||
|
||||
//erics - erreur de réécriture de l'url de téléchargement direct de la facture ... le lien de base est le bon
|
||||
//on cherche donc d'ou vien le pb ...
|
||||
//$urlforsellyoursaasaccount = getRootUrlForAccount($foundcontract);
|
||||
// if ($urlforsellyoursaasaccount) {
|
||||
// $tmpforurl = preg_replace('/.*document.php/', '', $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']);
|
||||
// if ($tmpforurl) {
|
||||
// dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__ cas 1, urlforsellyoursaasaccount=' . $urlforsellyoursaasaccount);
|
||||
// // $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $urlforsellyoursaasaccount . '/source/document.php' . $tmpforurl;
|
||||
// } else {
|
||||
// dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__ cas 2, urlforsellyoursaasaccount=' . $urlforsellyoursaasaccount);
|
||||
// // $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $urlforsellyoursaasaccount;
|
||||
// }
|
||||
// }
|
||||
|
||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
|
||||
|
||||
// Attach a file ?
|
||||
$file = '';
|
||||
$listofpaths = [];
|
||||
$listofnames = [];
|
||||
$listofmimes = [];
|
||||
if (is_object($invoice)) {
|
||||
$invoicediroutput = $conf->facture->dir_output;
|
||||
//erics - choix du PDF a joindre aux mails
|
||||
$fileparams = dol_most_recent_file($invoicediroutput . '/' . $this->ref, preg_quote($this->ref, '/') . '[^\-]+*.pdf');
|
||||
$file = $fileparams['fullname'];
|
||||
//$file = $invoicediroutput . '/' . $this->ref . '/' . $this->ref . '.pdf';
|
||||
// $file = ''; // Disable attachment of invoice in emails
|
||||
|
||||
if ($file) {
|
||||
$listofpaths = [$file];
|
||||
$listofnames = [basename($file)];
|
||||
$listofmimes = [dol_mimetype($file)];
|
||||
}
|
||||
}
|
||||
$from = "";//$conf->global->SELLYOURSAAS_NOREPLY_EMAIL;
|
||||
|
||||
$trackid = 'inv' . $this->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: doTakeStripePaymentForThirdParty' . "\r\n";
|
||||
|
||||
// Send email (substitutionarray must be done just before this)
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subjecttosend, $this->thirdparty->email, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, -1, '', '', $trackid, $moreinheader);
|
||||
if ($mailfile->sendfile()) {
|
||||
$result = 1;
|
||||
} else {
|
||||
$this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->thirdparty->email) . '. ' . $mailfile->error;
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
if ($result < 0) {
|
||||
$errmsg = $this->error;
|
||||
$postactionmessages[] = $errmsg;
|
||||
$ispostactionok = -1;
|
||||
} else {
|
||||
if ($file) {
|
||||
$postactionmessages[] = 'Email sent to thirdparty (to ' . $this->thirdparty->email . ' with invoice document attached: ' . $file . ', language = ' . $outputlangs->defaultlang . ')';
|
||||
} else {
|
||||
$postactionmessages[] = 'Email sent to thirdparty (to ' . $this->thirdparty->email . ' without any attached document, language = ' . $outputlangs->defaultlang . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($description) {
|
||||
dol_syslog("* Record event for payment result - " . $description);
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of payment (success or error)
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_' . $actioncode;
|
||||
$actioncomm->label = $description;
|
||||
$actioncomm->note_private = join(",\n", $postactionmessages);
|
||||
$actioncomm->fk_project = $this->fk_project;
|
||||
$actioncomm->datep = $now;
|
||||
$actioncomm->datef = $now;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->socid = $thirdparty->id;
|
||||
$actioncomm->contactid = 0;
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
// Fields when action is a real email (content is already into note)
|
||||
/*$actioncomm->email_msgid = $object->email_msgid;
|
||||
$actioncomm->email_from = $object->email_from;
|
||||
$actioncomm->email_sender= $object->email_sender;
|
||||
$actioncomm->email_to = $object->email_to;
|
||||
$actioncomm->email_tocc = $object->email_tocc;
|
||||
$actioncomm->email_tobcc = $object->email_tobcc;
|
||||
$actioncomm->email_subject = $object->email_subject;
|
||||
$actioncomm->errors_to = $object->errors_to;*/
|
||||
$actioncomm->fk_element = $this->id;
|
||||
$actioncomm->elementtype = $this->element;
|
||||
$actioncomm->extraparams = dol_trunc($extraparams, 250);
|
||||
|
||||
$actioncomm->create($user);
|
||||
}
|
||||
|
||||
$this->description = $description;
|
||||
$this->postactionmessages = $postactionmessages;
|
||||
} catch (Exception $e) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog('Error ' . $e->getMessage(), LOG_ERR);
|
||||
$this->errors[] = 'Error ' . $e->getMessage();
|
||||
}
|
||||
} else { // If remain to pay is null
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
|
||||
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
|
||||
}
|
||||
|
||||
//end copy
|
||||
// print json_encode($stripecard);
|
||||
// exit;
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande(';
|
||||
$sql .= 'fk_facture, ';
|
||||
$sql .= ' amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($amount)."'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",".$fuser->id;
|
||||
$sql .= ",'".$this->db->escape($stripe_id)."'";
|
||||
$sql .= ",'".$this->db->escape($stripe_uri)."'";
|
||||
$sql .= ",'".$this->db->escape($sourcetype)."'";
|
||||
$sql .= ",".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::demande_prelevement_stripe", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::demande_prelevement_stripe Erreur');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$this->error = 'WithdrawRequestErrorNilAmount';
|
||||
dol_syslog(get_class($this).'::demande_prelevement_stripe WithdrawRequestErrorNilAmount');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Force payment mode of invoice to withdraw
|
||||
$payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1);
|
||||
if ($payment_mode_id > 0) {
|
||||
$result = $this->setPaymentMethods($payment_mode_id);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = "A request already exists";
|
||||
dol_syslog(get_class($this).'::demande_prelevement_stripe Impossible de creer une demande, demande deja en cours');
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
dol_syslog(get_class($this).'::demande_prelevement_stripe Erreur -2');
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
$this->error = "Status of invoice does not allow this";
|
||||
dol_syslog(get_class($this)."::demande_prelevement_stripe ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Remove a direct debit request or a credit transfer request
|
||||
|
||||
@ -68,7 +68,7 @@ class DolEditor
|
||||
* @param int $readonly 0=Read/Edit, 1=Read only
|
||||
* @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y)
|
||||
*/
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array())
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
|
||||
@ -5372,7 +5372,7 @@ class Form
|
||||
if ($type) {
|
||||
print '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
|
||||
}
|
||||
$this->select_conditions_paiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
|
||||
print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
|
||||
print '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
} else {
|
||||
|
||||
@ -77,6 +77,7 @@ class FormTicket
|
||||
|
||||
public $withtitletopic;
|
||||
public $withtopicreadonly;
|
||||
public $withreadid;
|
||||
public $withcompany; // affiche liste déroulante company
|
||||
public $withfromsocid;
|
||||
public $withfromcontactid;
|
||||
|
||||
@ -52,8 +52,8 @@ class Utils
|
||||
* Purge files into directory of data files.
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @param string $choices Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'logfiles', or mix of this). Note 'allfiles' is possible too but very dangerous.
|
||||
* @param int $nbsecondsold Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold'
|
||||
* @param string $choices Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'logfiles', or mix of this). Note that 'allfiles' is also possible but very dangerous.
|
||||
* @param int $nbsecondsold Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold', or deletion of file if $choice is 'allfiles'
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function purgeFiles($choices = 'tempfilesold+logfiles', $nbsecondsold = 86400)
|
||||
@ -67,6 +67,9 @@ class Utils
|
||||
if (empty($choices)) {
|
||||
$choices = 'tempfilesold+logfiles';
|
||||
}
|
||||
if ($choices == 'allfiles' && $nbsecondsold > 0) {
|
||||
$choices = 'allfilesold';
|
||||
}
|
||||
|
||||
dol_syslog("Utils::purgeFiles choice=".$choices, LOG_DEBUG);
|
||||
|
||||
@ -77,6 +80,7 @@ class Utils
|
||||
|
||||
$choicesarray = preg_split('/[\+,]/', $choices);
|
||||
foreach ($choicesarray as $choice) {
|
||||
$now = dol_now();
|
||||
$filesarray = array();
|
||||
|
||||
if ($choice == 'tempfiles' || $choice == 'tempfilesold') {
|
||||
@ -85,7 +89,6 @@ class Utils
|
||||
$filesarray = dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks
|
||||
|
||||
if ($choice == 'tempfilesold') {
|
||||
$now = dol_now();
|
||||
foreach ($filesarray as $key => $val) {
|
||||
if ($val['date'] > ($now - ($nbsecondsold))) {
|
||||
unset($filesarray[$key]); // Discard temp dir not older than $nbsecondsold
|
||||
@ -98,7 +101,14 @@ class Utils
|
||||
if ($choice == 'allfiles') {
|
||||
// Delete all files (except install.lock, do not follow symbolic links)
|
||||
if ($dolibarr_main_data_root) {
|
||||
$filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
|
||||
$filesarray = dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1); // No need to use recursive, we will delete directory
|
||||
}
|
||||
}
|
||||
|
||||
if ($choice == 'allfilesold') {
|
||||
// Delete all files (except install.lock, do not follow symbolic links)
|
||||
if ($dolibarr_main_data_root) {
|
||||
$filesarray = dol_dir_list($dolibarr_main_data_root, "files", 1, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1, $nbsecondsold); // No need to use recursive, we will delete directory
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,14 +148,16 @@ class Utils
|
||||
$countdeleted += $tmpcountdeleted;
|
||||
}
|
||||
} elseif ($filesarray[$key]['type'] == 'file') {
|
||||
// If (file that is not logfile) or (if mode is logfile)
|
||||
if ($filesarray[$key]['fullname'] != $filelog || $choice == 'logfile' || $choice == 'logfiles') {
|
||||
$result = dol_delete_file($filesarray[$key]['fullname'], 1, 1);
|
||||
if ($result) {
|
||||
$count++;
|
||||
$countdeleted++;
|
||||
} else {
|
||||
$counterror++;
|
||||
if ($choice != 'allfilesold' || $filesarray[$key]['date'] < ($now - $nbsecondsold)) {
|
||||
// If (file that is not logfile) or (if mode is logfile)
|
||||
if ($filesarray[$key]['fullname'] != $filelog || $choice == 'logfile' || $choice == 'logfiles') {
|
||||
$result = dol_delete_file($filesarray[$key]['fullname'], 1, 1);
|
||||
if ($result) {
|
||||
$count++;
|
||||
$countdeleted++;
|
||||
} else {
|
||||
$counterror++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ class DoliDBMysqli extends DoliDB
|
||||
if (!is_object($resultset)) {
|
||||
$resultset = $this->_results;
|
||||
}
|
||||
return $resultset->num_rows;
|
||||
return isset($resultset->num_rows) ? $resultset->num_rows : 0;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
|
||||
@ -54,10 +54,11 @@ function dol_basename($pathfile)
|
||||
* @param int $nohook Disable all hooks
|
||||
* @param string $relativename For recursive purpose only. Must be "" at first call.
|
||||
* @param string $donotfollowsymlinks Do not follow symbolic links
|
||||
* @param string $nbsecondsold Only files older than $nbsecondsold
|
||||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
|
||||
* @see dol_dir_list_in_database()
|
||||
*/
|
||||
function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0)
|
||||
function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0, $nbsecondsold = 0)
|
||||
{
|
||||
global $db, $hookmanager;
|
||||
global $object;
|
||||
@ -67,13 +68,14 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
//print 'xxx'."files.lib.php::dol_dir_list path=".$path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter);
|
||||
}
|
||||
|
||||
$loaddate = ($mode == 1 || $mode == 2) ?true:false;
|
||||
$loadsize = ($mode == 1 || $mode == 3) ?true:false;
|
||||
$loadperm = ($mode == 1 || $mode == 4) ?true:false;
|
||||
$loaddate = ($mode == 1 || $mode == 2 || $nbsecondsold) ? true : false;
|
||||
$loadsize = ($mode == 1 || $mode == 3) ?true : false;
|
||||
$loadperm = ($mode == 1 || $mode == 4) ?true : false;
|
||||
|
||||
// Clean parameters
|
||||
$path = preg_replace('/([\\/]+)$/i', '', $path);
|
||||
$newpath = dol_osencode($path);
|
||||
$now = dol_now();
|
||||
|
||||
$reshook = 0;
|
||||
$file_list = array();
|
||||
@ -170,7 +172,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
if ($recursive > 0) {
|
||||
if (empty($donotfollowsymlinks) || !is_link($path."/".$file)) {
|
||||
//var_dump('eee '. $path."/".$file. ' '.is_dir($path."/".$file).' '.is_link($path."/".$file));
|
||||
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive + 1, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename != '' ? $relativename.'/' : '').$file, $donotfollowsymlinks));
|
||||
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive + 1, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename != '' ? $relativename.'/' : '').$file, $donotfollowsymlinks, $nbsecondsold));
|
||||
}
|
||||
}
|
||||
} elseif (!$isdir && (($types == "files") || ($types == "all"))) {
|
||||
@ -183,18 +185,20 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
}
|
||||
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $file)) { // We do not search key $filter into $path, only into $file
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'file'
|
||||
);
|
||||
if (empty($nbsecondsold) || $filedate <= ($now - $nbsecondsold)) {
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $path.'/'.$file, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
$file_list[] = array(
|
||||
"name" => $file,
|
||||
"path" => $path,
|
||||
"level1name" => $level1name,
|
||||
"relativename" => ($relativename ? $relativename.'/' : '').$file,
|
||||
"fullname" => $path.'/'.$file,
|
||||
"date" => $filedate,
|
||||
"size" => $filesize,
|
||||
"type" => 'file'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4955,8 +4955,9 @@ function dol_print_error($db = '', $error = '', $errors = null)
|
||||
$out .= "<br>\n";
|
||||
}
|
||||
|
||||
// Return a http error code if possible
|
||||
// Return a http header with error code if possible
|
||||
if (!headers_sent()) {
|
||||
top_httphead();
|
||||
http_response_code(500);
|
||||
}
|
||||
|
||||
|
||||
@ -38,11 +38,11 @@ function product_prepare_head($object)
|
||||
$langs->load("products");
|
||||
|
||||
$label = $langs->trans('Product');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read');
|
||||
|
||||
if ($object->isService()) {
|
||||
$label = $langs->trans('Service');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
|
||||
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read');
|
||||
}
|
||||
|
||||
$h = 0;
|
||||
|
||||
@ -329,11 +329,11 @@ function dolGetLdapPasswordHash($password, $type = 'md5')
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
* @param int $isdraft 1=The object with id=$objectid is a draft
|
||||
* @param int $mode Mode (0=default, 1=return with not die)
|
||||
* @param int $mode Mode (0=default, 1=return without dieing)
|
||||
* @return int If mode = 0 (default): Always 1, die process if not allowed. If mode = 1: Return 0 if access not allowed.
|
||||
* @see dol_check_secure_access_document(), checkUserAccessToObject()
|
||||
*/
|
||||
function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0)
|
||||
function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0)
|
||||
{
|
||||
global $db, $conf;
|
||||
global $hookmanager;
|
||||
@ -1016,8 +1016,35 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a message to say access is forbidden and stop program
|
||||
* Show a message to say access is forbidden and stop program.
|
||||
* This includes only HTTP header.
|
||||
* Calling this function terminate execution of PHP.
|
||||
*
|
||||
* @param string $message Force error message
|
||||
* @param int $http_response_code HTTP response code
|
||||
* @param int $stringalreadysanitized 1 if string is already sanitized with HTML entities
|
||||
* @return void
|
||||
* @see accessforbidden()
|
||||
*/
|
||||
function httponly_accessforbidden($message = 1, $http_response_code = 403, $stringalreadysanitized = 0)
|
||||
{
|
||||
top_httphead();
|
||||
http_response_code($http_response_code);
|
||||
|
||||
if ($stringalreadysanitized) {
|
||||
print $message;
|
||||
} else {
|
||||
print htmlentities($message);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a message to say access is forbidden and stop program.
|
||||
* This includes HTTP and HTML header and footer (except if $printheader and $printfooter is 0, use this case inside an already started page).
|
||||
* Calling this function terminate execution of PHP.
|
||||
*
|
||||
* @param string $message Force error message
|
||||
@ -1026,10 +1053,12 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
||||
* @param int $showonlymessage Show only message parameter. Otherwise add more information.
|
||||
* @param array|null $params More parameters provided to hook
|
||||
* @return void
|
||||
* @see httponly_accessforbidden()
|
||||
*/
|
||||
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
|
||||
{
|
||||
global $conf, $db, $user, $langs, $hookmanager;
|
||||
|
||||
if (!is_object($langs)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
|
||||
$langs = new Translate('', $conf);
|
||||
@ -1046,10 +1075,10 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
|
||||
}
|
||||
}
|
||||
print '<div class="error">';
|
||||
if (!$message) {
|
||||
if (empty($message)) {
|
||||
print $langs->trans("ErrorForbidden");
|
||||
} else {
|
||||
print $message;
|
||||
print $langs->trans($message);
|
||||
}
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
@ -1077,6 +1106,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
|
||||
if ($printfooter && function_exists("llxFooter")) {
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@ -1055,7 +1055,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
if ($foruserprofile) {
|
||||
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
|
||||
$default = $langs->trans('No');
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -150,7 +150,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
||||
// Products-Services
|
||||
$tmpentry = array(
|
||||
'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')),
|
||||
'perms'=> ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire') || $user->hasRight('expedition', 'lire')),
|
||||
'perms'=> ($user->hasRight('product', 'read') || $user->hasRight('service', 'read') || $user->hasRight('expedition', 'lire')),
|
||||
'module'=>'product|service'
|
||||
);
|
||||
$menu_arr[] = array(
|
||||
@ -1990,22 +1990,22 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
||||
if ($mainmenu == 'products') {
|
||||
// Products
|
||||
if (isModEnabled('product')) {
|
||||
$newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('produit', 'lire'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('produit', 'creer'));
|
||||
$newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('produit', 'lire'));
|
||||
$newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer'));
|
||||
$newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read'));
|
||||
if (isModEnabled('stock')) {
|
||||
$newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire'));
|
||||
}
|
||||
if (isModEnabled('productbatch')) {
|
||||
$langs->load("stocks");
|
||||
$newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->hasRight('product', 'read') && $user->hasRight('stock', 'lire'));
|
||||
}
|
||||
if (isModEnabled('variants')) {
|
||||
$newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('produit', 'lire'));
|
||||
$newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('product', 'read'));
|
||||
}
|
||||
if (isModEnabled('propal') || (isModEnabled('commande') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('facture') || isModEnabled('fournisseur') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('produit', 'lire'));
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('product', 'read'));
|
||||
}
|
||||
|
||||
// Categories
|
||||
@ -2018,11 +2018,11 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
||||
|
||||
// Services
|
||||
if (isModEnabled('service')) {
|
||||
$newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'lire'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer'));
|
||||
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'lire'));
|
||||
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read'));
|
||||
if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || (isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) {
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'lire'));
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'read'));
|
||||
}
|
||||
// Categories
|
||||
if (isModEnabled('categorie')) {
|
||||
@ -2035,16 +2035,16 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
||||
// Warehouse
|
||||
if (isModEnabled('stock')) {
|
||||
$langs->load("stocks");
|
||||
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer'));
|
||||
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
||||
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer'));
|
||||
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire'));
|
||||
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire'));
|
||||
|
||||
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->hasRight('stock', 'mouvement', 'creer'));
|
||||
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->hasRight('stock', 'mouvement', 'creer'));
|
||||
if (isModEnabled('supplier_order')) {
|
||||
$newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire'));
|
||||
$newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire'));
|
||||
}
|
||||
$newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire'));
|
||||
$newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->hasRight('product', 'read', '', 1) && $user->hasRight('stock', 'lire'));
|
||||
|
||||
// Categories for warehouses
|
||||
if (isModEnabled('categorie')) {
|
||||
|
||||
@ -79,7 +79,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskorder" value="'.$conf->global->COMMANDE_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskorder" value="'.getDolGlobalString("COMMANDE_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>';
|
||||
|
||||
@ -128,7 +128,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->COMMANDE_SAPHIR_MASK;
|
||||
$mask = getDolGlobalString("COMMANDE_SAPHIR_MASK");
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -85,7 +85,7 @@ class mod_contract_magre extends ModelNumRefContracts
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcontract" value="'.$conf->global->CONTRACT_MAGRE_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskcontract" value="'.getDolGlobalString("CONTRACT_MAGRE_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>';
|
||||
$texte .= '</tr>';
|
||||
$texte .= '</table>';
|
||||
@ -127,7 +127,7 @@ class mod_contract_magre extends ModelNumRefContracts
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$mask = $conf->global->CONTRACT_MAGRE_MASK;
|
||||
$mask = getDolGlobalString("CONTRACT_MAGRE_MASK");
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -969,8 +969,16 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -548,8 +548,16 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
//*********************LOGO****************************
|
||||
$pdf->SetXY(11, 7);
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -914,8 +914,16 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -84,7 +84,7 @@ class mod_arctic extends ModeleNumRefFicheinter
|
||||
|
||||
// Setting the prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskvalue" value="'.getDolGlobalString("FICHINTER_ARTIC_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_arctic extends ModeleNumRefFicheinter
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// We define the search criteria of the counter
|
||||
$mask = $conf->global->FICHINTER_ARTIC_MASK;
|
||||
$mask = getDolGlobalString("FICHINTER_ARTIC_MASK");
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
|
||||
@ -77,18 +77,28 @@ class modBarcode extends DolibarrModules
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'barcode';
|
||||
$r = 0;
|
||||
|
||||
$this->rights[1][0] = 301; // id de la permission
|
||||
$this->rights[1][1] = 'Read barcodes'; // libelle de la permission
|
||||
$this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
|
||||
$this->rights[1][4] = 'lire_advance';
|
||||
$this->rights[$r][0] = 301; // id de la permission
|
||||
$this->rights[$r][1] = 'Generate PDF sheets of barcodes'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'read';
|
||||
$r++;
|
||||
|
||||
$this->rights[2][0] = 302; // id de la permission
|
||||
$this->rights[2][1] = 'Create/modify barcodes'; // libelle de la permission
|
||||
$this->rights[2][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[2][4] = 'creer_advance';
|
||||
$this->rights[$r][0] = 304; // id de la permission
|
||||
$this->rights[$r][1] = 'Read barcodes'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'lire_advance';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 305; // id de la permission
|
||||
$this->rights[$r][1] = 'Create/modify barcodes'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'creer_advance';
|
||||
$r++;
|
||||
|
||||
// Main menu entries
|
||||
$r = 0;
|
||||
@ -104,8 +114,8 @@ class modBarcode extends DolibarrModules
|
||||
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
|
||||
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>200,
|
||||
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'enabled'=>'isModEnabled("barcode")', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->hasRight("barcode", "read")',
|
||||
'target'=>'',
|
||||
'user'=>0, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
@ -119,8 +129,8 @@ class modBarcode extends DolibarrModules
|
||||
'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=admintools',
|
||||
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>300,
|
||||
'enabled'=>'$conf->barcode->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'enabled'=>'isModEnabled("barcode") && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->admin',
|
||||
'target'=>'',
|
||||
'user'=>0, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
|
||||
@ -164,8 +164,9 @@ class modCategorie extends DolibarrModules
|
||||
$typeexample .= ($typeexample ? " / " : "")."11=Website page";
|
||||
}
|
||||
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'pcat.label'=>'Text');
|
||||
// Definition of vars
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another picto
|
||||
$this->export_help_array[$r] = array('cat.type'=>$typeexample);
|
||||
|
||||
@ -181,8 +182,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'product';
|
||||
@ -192,6 +193,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cp.fk_product';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -206,7 +208,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_fournisseur'=>"SupplierCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -214,7 +216,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.fournisseur'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_fournisseur'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -236,6 +238,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cf.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -252,7 +255,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("societe")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -260,7 +263,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType', 'pl.code'=>'ProspectLevel', 'st.code'=>'ProspectStatus'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -282,6 +285,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cs.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -299,8 +303,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = 'isModEnabled("adherent")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'adherent';
|
||||
@ -310,6 +314,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_member as cm ON cm.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'adherent as p ON p.rowid = cm.fk_member';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
|
||||
@ -324,7 +329,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = 'isModEnabled("societe")';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname',
|
||||
'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country',
|
||||
'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction',
|
||||
@ -335,8 +340,8 @@ class modCategorie extends DolibarrModules
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email"
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.rowid'=>'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label',
|
||||
'p.birthday' => 'Date', 'p.poste' => 'Text',
|
||||
'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text',
|
||||
@ -363,6 +368,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -381,8 +387,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = "isModEnabled('project')";
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text");
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text");
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'projet';
|
||||
@ -392,6 +398,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_project as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'projet as p ON p.rowid = cp.fk_project';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -406,8 +413,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->user->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'TechnicalID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'user';
|
||||
@ -417,6 +424,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_user as cu ON cu.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'user as p ON p.rowid = cu.fk_user';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
|
||||
@ -106,7 +106,7 @@ class modDataPolicy extends DolibarrModules {
|
||||
$this->depends = array('always'=>'modCron'); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->langfiles = array("datapolicy@datapolicy");
|
||||
$this->langfiles = array("datapolicy");
|
||||
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(4, 0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
@ -217,23 +217,23 @@ class modDataPolicy extends DolibarrModules {
|
||||
|
||||
/*
|
||||
// Extrafield contact
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_date', $langs->trans("DATAPOLICY_date"), 'date', 104, 3, 'thirdparty', 0, 0, '', '', 1, '', '3', 0);
|
||||
$result1 = $extrafields->addExtraField('datapolicy_send', $langs->trans("DATAPOLICY_send"), 'date', 105, 3, 'thirdparty', 0, 0, '', '', 0, '', '0', 0);
|
||||
|
||||
// Extrafield Tiers
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'contact', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_date', $langs->trans("DATAPOLICY_date"), 'date', 104, 3, 'contact', 0, 0, '', '', 1, '', '3', 0);
|
||||
$result1 = $extrafields->addExtraField('datapolicy_send', $langs->trans("DATAPOLICY_send"), 'date', 105, 3, 'contact', 0, 0, '', '', 0, '', '0', 0);
|
||||
|
||||
// Extrafield Adherent
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy@datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_consentement', $langs->trans("DATAPOLICY_consentement"), 'boolean', 101, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_traitement', $langs->trans("DATAPOLICY_opposition_traitement"), 'boolean', 102, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_opposition_prospection', $langs->trans("DATAPOLICY_opposition_prospection"), 'boolean', 103, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0, '', '', 'datapolicy', '$conf->datapolicy->enabled');
|
||||
$result1 = $extrafields->addExtraField('datapolicy_date', $langs->trans("DATAPOLICY_date"), 'date', 104, 3, 'adherent', 0, 0, '', '', 1, '', '3', 0);
|
||||
$result1 = $extrafields->addExtraField('datapolicy_send', $langs->trans("DATAPOLICY_send"), 'date', 105, 3, 'adherent', 0, 0, '', '', 0, '', '0', 0);
|
||||
*/
|
||||
|
||||
@ -13,8 +13,9 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup zapier Module Zapier
|
||||
* \brief Zapier module descriptor.
|
||||
@ -23,7 +24,8 @@
|
||||
* \ingroup zapier
|
||||
* \brief Description and activation file for the module Zapier
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
/**
|
||||
* Description and activation class for module Zapier
|
||||
|
||||
@ -123,7 +123,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte .= '<input type="hidden" name="page_y" value="">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PROPALE_ADDON_PDF_ODT_PATH">';
|
||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
|
||||
if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) {
|
||||
$texte .= '<input type="hidden" name="param2" value="PROPALE_ADDON_PDF_ODT_DEFAULT">';
|
||||
$texte .= '<input type="hidden" name="param3" value="PROPALE_ADDON_PDF_ODT_TOBILL">';
|
||||
$texte .= '<input type="hidden" name="param4" value="PROPALE_ADDON_PDF_ODT_CLOSED">';
|
||||
@ -187,7 +187,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
$texte .= '</div>';
|
||||
|
||||
// Set default template for different status of proposal
|
||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
|
||||
if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) {
|
||||
// Model for creation
|
||||
$list = ModelePDFPropales::liste_modeles($this->db);
|
||||
$texte .= '<table width="50%;">';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user