Merge branch 'develop' into NEW_stockstransfers

This commit is contained in:
Maxime Kohlhaas 2022-05-21 16:06:59 +02:00 committed by GitHub
commit 6445dd3882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1784 changed files with 69135 additions and 33841 deletions

View File

@ -24,7 +24,6 @@ Component Version License GPL Compatible
-------------------------------------------------------------------------------------
PHP libraries:
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
@ -50,6 +49,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
JS libraries:
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
ChartJS 3.7.1 MIT License Yes JS library for graph
CKEditor 4.18 LGPL-2.1+ Yes Editor WYSIWYG
jQuery 3.6.0 MIT License Yes JS library
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css

275
ChangeLog
View File

@ -9,21 +9,177 @@ English Dolibarr ChangeLog
For users:
---------------
NEW: PHP 8.0 compatibility
NEW: PHP 8.1 compatibility
NEW: Support for recurring purchase invoices.
NEW: #20292 Include German public holidays
NEW: #17123 added ExtraFields for Stock Mouvement
NEW: #20609 : new massaction to assign a sale representatives on a selection of thirdparties
NEW: #20653 edit discount pourcentage for all lines in one shot
NEW: Accept 'auto' for ref of object on import of purchase order/proposal
NEW: Accountancy - Add more filters and info on page to bind accounting accounts
NEW: Accountancy - Add subledger account when we generate a transaction with a deposit invoice
NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list)
NEW: ACE Editor is restored at same cursor position after a save.
NEW: Add "addMoreActionsButtons" hook to subscription form
NEW: Add an option in GUI to show a Quick add button into top menu bar
NEW: Module Recruitment - Add a public page with all list of open job positions.
NEW: Module Recruitment - Add a tab with list of application on the jobposition file.
NEW: Add a workflow to auto link contract on a ticket
NEW: Add column date of Signature on proposal list
NEW: Add column template invoice in invoice list
NEW: Add column "Total HT" to products array on document creation card
NEW: ADD configuration for text color of button action
NEW: Add constant to hide categories in TakePos
NEW: Add constant to show category description in TakePos
NEW: Add constant to show only the products in stock in TakePos
NEW: Add entity filter in exports
NEW: Show the event block on recurring invoices #20870
NEW: Add filter "opportunity status" on statistics of projects.
NEW: Add firstname, lastname and max number of attendees for module "Event Organization"
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 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: Add the possibility to add sub-BOMs to BOM
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: barcode rule to insert product in takepos
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: 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: 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 website now supports 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: Add tabs for nets Bom
NEW: on redirect of page in website module, GET parameters are kept.
NEW: optional display warning icons on ticket list
NEW: option to default check "notify tier at creation" in ticket module
NEW: option update prices on proposal cloning
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: New permission to report time on timesheet.
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
NEW: Show number of votes into the label of tab "Results" of a survey
NEW: Show product reference in Takepos
NEW: Some core tables are created only at module activation
NEW: split consumption line on MO
NEW: stock filter in reassort lists
NEW: stock limit in stock export CSV
NEW: Sub-bom are availables
NEW: Supplier order - Show ref supplier of reception in linked object block
NEW: support user_modif in order
NEW: TakePos - pagination on search results
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: Ticket triggers: allow to automatically send messages on new tickets
NEW: Accountancy - Add hidden feature for accounting reconciliation
NEW: Can store the session into database (instead of beeing managed by PHP)
Modules
NEW: Module Partnership Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Experimental module Partnership Management
For developers:
---------------
NEW: A lot of addition of hooks.
For developers or integrators:
------------------------------
NEW: dol_uncompress() supports more extensions (.gz, .bz2, .zstd). Only .zip was supported before.
NEW: Implement a generic method for Kaban views
NEW: Upgrade chartjs library to 3.7.1
NEW: update rank line is possible on API for customer invoices, sales orders and supplier invoice
NEW: stripe element with more gateways
NEW: solde() function evolution to be able to get solde until a chosen date
NEW: Suggest a way to run upgrade per entities.
NEW: Support html content for multiselect component.
NEW: ModuleBuilder - Add tabs view in module builder
NEW: ModuleBuilder - More feature that can be modifed after module generation
NEW: Hook getNomUrl available everywhere in tooltip of ref links
NEW: Identification of tr is possible with by attribute data-id on some pages
NEW: Import with select boxes V2
NEW: Can update rank of invoice, proposal and order lines with API update
NEW: Can use current entity filter on 'chkbxlst'
NEW: Creation of the function select_bom() used to display bom select list
NEW: add printFieldListWhere hook in product reassort card
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: API Proposals - Add POST lines
NEW: API REST filter states by country
NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END
NEW: Add option MAIN_API_DEBUG to save API logs into a file
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()"
NEW: addMoreActionsButtonsList hook for button in list
NEW: Add API to get a template invoice
NEW: Standardize a lot of code.
NEW: #20736 Allow extrafields SQL filters on REST API product lookup
NEW: #19294 implement detailed timespent in task of project API
NEW: Add a protection into PHPunit to avoid to forget a var_dump
NEW: Add datem and type parameters to API to create movements
NEW: Add hidden option on contract PDF line to hide qty and price
NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action
NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook
NEW: TakePos - add hooks complete product display
NEW: TakePos - add hooks for cart display
NEW: TakePos - add hooks to complete ajax return array
NEW: Add hook before the public ticket list
NEW: Add hook doaction in takepos invoice
NEW: Add Hook for Notif
NEW: Add hook for more buttons
NEW: Add hook printFieldListWhere in "show_contacts" function
NEW: Add hook printFieldWhere in load_state_board function
NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts
NEW: Add hook selectProductsListWhere in select_produits_list function
NEW: Add hooks in commercial index
NEW: Add hooks in customers and products boxes
NEW: Add hooks in thirdparty index page
NEW: Add hooks on project task time page
NEW: Add hooks on salaries and sociales card
NEW: Add hooks select product list and select thirdparty list function
NEW: Add hook to getSellPrice function
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
@ -39,6 +195,105 @@ Following changes may create regressions for some external modules, but were nec
* Move massaction 'confirm_createbills' from actions_massactions.inc.php to commande/list.php
* Method fetch_all_resources(), fetch_all_used(), fetch_all_available() of DolResource has been removed (they were not used by core code).
* Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions.
* The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced.
***** ChangeLog for 15.0.2 compared to 15.0.1 *****
FIX: #19777 #20281
FIX: #20140 #20301
FIX: #20279 Accountancy - PostGreSQL - Error on mass update lines already binded
FIX: #20476 migration postgresql 14.0.x to 15.0.x packaging type
FIX: #20733 Inventory: Do not use batch qty even if present if batch module is disabled.
FIX: action comm list: holiday last day not included + handle duration with halfdays
FIX: Add missing entity on salary's payment
FIX: Add 'recruitment' into check array
FIX: add tools to fix bad bank amount in accounting with multicurrency
FIX: assign member cateogry to a member
FIX: backport
FIX: bad bank amount in accounting with multicurrency
FIX: Bad condition on remx
FIX: Bad filter on date on salary list
FIX: bad link to add a customer price (token duplicated)
FIX: bad status of member on widget by type and status
FIX: better error management at product selling price update
FIX: Can't edit bank record
FIX: check mandatory thirdparty fields for mass action
FIX: check thirdparty object loaded and properties exist
FIX: comment
FIX: compatibility for ticket number sharing
FIX: compatibility with multicompany sharings
FIX: contact card: single extrafield update failed
FIX: country not visible into list of states
FIX: Delete an extrafield where type is double
FIX: deprecated module are not more viewed as external modules
FIX: Disable customer type by default if type prospect/customer is disabled
FIX: each time we create a supplier order, we need to give it a ref_supplier
FIX: Error management
FIX: fatal error for $db usage in tpl
FIX: filter into the list of product lots
FIX: Filter on Object Referent page give CRSF page
FIX: Fix default options ($hidedetails, $hidedesc, $hideref) with globales when generate PDF in mass actions
FIX: Fix search by filters
FIX: Fix the adding of lines in the create invoice functions
FIX: forgotten form confirm before various payment delete
FIX: holiday/leave requests: write status change emails in HTML
FIX: include discount price for PMP after a reception (Issue #20029)
FIX: incrementation
FIX: in salary stats and payment list, we must check right perms as well as salary list
FIX: intervention entity missing
FIX: label tax cat trad
FIX: Mass action ship orders
FIX: missing advanced perms
FIX: missing call to executeHooks()
FIX: Missing entity on adding new VAT
FIX: missing hook for row ordering
FIX: missing hook parameter ($possiblelinks)
FIX: missing parenthesis
FIX: missing picto in combo of mass actions of thirdparties.
FIX: missing signature library when ODT model is used
FIX: Missing unset fields after updateline expensereport
FIX: ModuileBuilder - Fix getLinesArray() error reporting
FIX: Move delete task time trigger position
FIX: Navigation between invoices
FIX: No empty line inserted into accounting_bookkeeping
FIX: Numbering of sepa files
FIX: object cloning: set unique extrafield values to null to prevent duplicates
FIX: on update with action reminder in future there is user key error
FIX: originproductline array td identification data-id
FIX: out of memory when more than 100 000 invoices.
FIX: permit access to medias when logged in a different entity
FIX: phpcs
FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted
FIX: project timesheet by week: cleanup unused code
FIX: project timesheet: public holidays offset by 1 day
FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed
FIX: propal list: bad error management when setting "not signed" mass action
FIX: propal list mass action translations and error management (v14 edition)
FIX: propal list: missing not signed massaction translation keys for transifex
FIX: PR returns
FIX: ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders
FIX: replenish and manage product stock by warhouse
FIX: sending email on payment of registration of event
FIX: SEPA ICS is not mandatory for bank transfer
FIX: Set datec when add time spent on a project task
FIX: status filter on supplierOrder stats doesn't work
FIX: stickler-ci
FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message
FIX: Supplier order stats
FIX: Tabulation must be allowed for HTML content
FIX: tool to fix bank account not in main currency for vendor invoice
FIX: translations
FIX: Travis + Update dev
FIX: truncate Customer Reference too long on PDF header (PR #20718)
FIX: uniformize code
FIX: Update of sale price (log not correctly updated)
FIX: user actions rights when mulit-company transverse mode is enabled
FIX: user employee tab: offset in open days messes up holiday length calculation
FIX: We need to have a different default_ref_supplier for each new fourn invoice
FIX: "WHERE" clause missing on resource export
FIX: #yogosha9754
***** ChangeLog for 15.0.1 compared to 15.0.0 *****

View File

@ -6,8 +6,9 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported |
| ---------- | ---------------------- |
| <= 14.0.4 | :x: |
| >= 14.0.5+ | :white_check_mark: except CSRF attacks|
| <= 15.0.0 | :x: |
| >= 15.0.1+ | :white_check_mark: except CSRF attacks|
| >= 16.0.0 | :white_check_mark: |
| >= develop | :white_check_mark: |
## Reporting a Vulnerability

View File

@ -27,12 +27,12 @@ OutputBaseFilename=__FILENAMEEXEDOLIWAMP__
;SourceDir=Z:\home\ldestailleur\git\dolibarrxxx
SourceDir=..\..\..
AppId=doliwamp
AppPublisher=NLTechno
AppPublisherURL=https://www.nltechno.com
AppPublisher=DoliCloud
AppPublisherURL=https://www.dolicloud.com
AppSupportURL=https://www.dolibarr.org
AppUpdatesURL=https://www.dolibarr.org
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql software.
AppCopyright=Copyright (C) 2008-2020 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
AppCopyright=Copyright (C) 2008-2022 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre)
DefaultDirName=c:\dolibarr
DefaultGroupName=Dolibarr
;LicenseFile=COPYING
@ -99,13 +99,12 @@ Source: "build\exe\doliwamp\startdoliwamp_manual_donotuse.bat.install"; DestDir:
Source: "build\exe\doliwamp\builddemosslfiles.bat.install"; DestDir: "{app}\"; Flags: ignoreversion;
Source: "build\exe\doliwamp\UsedPort.exe"; DestDir: "{app}\"; Flags: ignoreversion;
; PhpMyAdmin, Apache, Php, Mysql
; Apache, Php, Mysql
; Put here path of Wampserver applications
; Value OK: apache 2.2.6, php 5.2.5 (5.2.11, 5.3.0 and 5.3.1 fails if php_exif, php_pgsql, php_zip is on), mysql 5.0.45
; Value OK: apache 2.2.11, php 5.3.0 (if no php_exif, php_pgsql, php_zip), mysql 5.0.45
; Value OK: apache 2.4.9, php 5.5.12, mysql 5.0.45 instead of 5.6.17 (wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe)
; Value OK: apache 2.4.41, php 7.3.12, mariadb10.4.10 (wampserver3.2.0_x64.exe)
Source: "C:\wamp64\apps\phpmyadmin4.9.2\*.*"; DestDir: "{app}\apps\phpmyadmin4.9.2"; Flags: ignoreversion recursesubdirs; Excludes: "config.inc.php,wampserver.conf,*.log,*_log,darkblue_orange"
;Source: "C:\Program Files\Wamp\bin\apache\apache2.4.9\*.*"; DestDir: "{app}\bin\apache\apache2.4.9"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
Source: "C:\wamp64\bin\apache\apache2.4.41\*.*"; DestDir: "{app}\bin\apache\apache2.4.41"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,httpd.conf,wampserver.conf,*.log,*_log"
;Source: "C:\Program Files\Wamp\bin\php\php5.5.12\*.*"; DestDir: "{app}\bin\php\php5.5.12"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
@ -125,9 +124,7 @@ Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversi
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
; Config files
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
Source: "build\exe\doliwamp\config.inc.php.install"; DestDir: "{app}\apps\phpmyadmin4.1.14"; Flags: ignoreversion;
;Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.9\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\httpd.conf.install"; DestDir: "{app}\bin\apache\apache2.4.41\conf"; Flags: ignoreversion;
Source: "build\exe\doliwamp\my.ini.install"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion;
@ -196,7 +193,6 @@ var destFileA: String;
var srcContents: String;
var browser: String;
var mysqlVersion: String;
var phpmyadminVersion: String;
var phpDllCopy: String;
var batFile: String;
@ -246,7 +242,6 @@ begin
phpVersion := '7.3.12' ;
//mysqlVersion := '5.0.45';
mysqlVersion := '10.4.10';
phpmyadminVersion := '4.1.14';
smtpServer := 'localhost';
apachePort := '80';
@ -635,27 +630,6 @@ begin
begin
//----------------------------------------------
// Create file alias phpmyadmin (always)
//----------------------------------------------
destFile := pathWithSlashes+'/alias/phpmyadmin.conf';
srcFile := pathWithSlashes+'/alias/phpmyadmin.conf.install';
if FileExists(srcFile) then
begin
LoadStringFromFile (srcFile, srcContents);
//installDir et version de phpmyadmin
StringChangeEx (srcContents, 'WAMPROOT', pathWithSlashes, True);
StringChangeEx (srcContents, 'WAMPPHPMYADMINVERSION', phpmyadminVersion, True);
SaveStringToFile(destFile,srcContents, False);
end;
DeleteFile(srcFile);
//----------------------------------------------
// Create file alias dolibarr (if not exists)
//----------------------------------------------
@ -691,35 +665,6 @@ begin
//----------------------------------------------
// Create file configuration for phpmyadmin (if not exists)
//----------------------------------------------
destFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php';
srcFile := pathWithSlashes+'/apps/phpmyadmin'+phpmyadminVersion+'/config.inc.php.install';
if FileExists(srcFile) then
begin
if not FileExists (destFile) then
begin
LoadStringFromFile (srcFile, srcContents);
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
SaveStringToFile(destFile,srcContents, False);
end
else
begin
// We must replace to use format 2.4 of apache
DeleteFile(destFile);
LoadStringFromFile (srcFile, srcContents);
StringChangeEx (srcContents, 'WAMPMYSQLNEWPASSWORD', mypass, True);
StringChangeEx (srcContents, 'WAMPMYSQLPORT', myport, True);
SaveStringToFile(destFile,srcContents, False);
end;
end;
//----------------------------------------------
// Create file httpd.conf (if not exists)
//----------------------------------------------

View File

@ -582,9 +582,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/common/fontawesome-5/svgs`;
# Removed other test files
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;

View File

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

View File

@ -95,10 +95,11 @@ if ($conf->loan->enabled) {
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
if ($conf->societe->enabled) {
$list_account[] = '---Deposits---';
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
}
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
/*
* Actions
@ -134,6 +135,20 @@ if ($action == 'update') {
}
}
if ($action == 'setdisableauxiliaryaccountoncustomerdeposit') {
$setDisableAuxiliaryAccountOnCustomerDeposit = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT", $setDisableAuxiliaryAccountOnCustomerDeposit, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
* View
@ -231,6 +246,20 @@ foreach ($list_account as $key) {
}
}
if ($conf->societe->enabled) {
print '<tr class="oddeven">';
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setdisableauxiliaryaccountoncustomerdeposit&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
}
print "</table>\n";
print "</div>\n";

View File

@ -395,8 +395,8 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
@ -406,9 +406,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '';
@ -608,7 +608,7 @@ if ($result) {
$i = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
// Ref produit as link
$product_static->ref = $obj->ref;
@ -891,7 +891,7 @@ if ($result) {
print '</form>';
$db->free($result);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -349,7 +349,7 @@ if ($action != 'export_csv') {
$sql .= " GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$nrows = $db->num_rows($resql);
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();

View File

@ -431,12 +431,12 @@ if ($action == 'create') {
// Account movement
print '<tr>';
print '<td class="titlefield">'.$langs->trans("NumMvts").'</td>';
print '<td>'.$object->piece_num.'</td>';
print '<td>'.($mode == '_tmp' ? '<span class="opacitymedium" title="Id tmp '.$object->piece_num.'">'.$langs->trans("Draft").'</span>' : $object->piece_num).'</td>';
print '</tr>';
// Date
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('Docdate');
print '</td>';
if ($action != 'editdate') {

View File

@ -586,11 +586,11 @@ class AccountingAccount extends CommonObject
$sql .= ' WHERE a.rowid = ' . ((int) $id);
dol_syslog(get_class($this) . '::info sql=' . $sql);
$result = $this->db->query($sql);
$resql = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
@ -605,7 +605,7 @@ class AccountingAccount extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}
@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject
$reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$const_name = '';
if ($type == 'customer') {
$const_name = "SOLD";
} elseif ($type == 'supplier') {

View File

@ -1843,8 +1843,8 @@ class BookKeeping extends CommonObject
/**
* Transform transaction
*
* @param number $direction If 0 tmp => real, if 1 real => tmp
* @param string $piece_num Piece num
* @param number $direction If 0: tmp => real, if 1: real => tmp
* @param string $piece_num Piece num = Transaction ref
* @return int int <0 if KO, >0 if OK
*/
public function transformTransaction($direction = 0, $piece_num = '')
@ -1862,57 +1862,82 @@ class BookKeeping extends CommonObject
if ($next_piecenum < 0) {
$error++;
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' (doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
$sql .= ' SELECT doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
if (!$error) {
// Delete if there is an empty line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
if (!$error) {
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.' (doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
$sql .= ' SELECT doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
} elseif ($direction == 1) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'_tmp (doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
$sql .= ' SELECT doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
if (!$error) {
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'_tmp (doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
$sql .= ' SELECT doc_date, doc_type,';
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error '.$this->db->lasterror();
dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
}
}
}
if (!$error) {

View File

@ -266,14 +266,14 @@ class Lettering extends BookKeeping
$sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " LIMIT 1 ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqla = $this->db->query($sql);
if ($resqla) {
$obj = $this->db->fetch_object($resqla);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
if (!empty($obj->lettering_code)) {
$lettre++;
}
$this->db->free($result);
$this->db->free($resqla);
} else {
$this->errors[] = 'Error'.$this->db->lasterror();
$error++;
@ -281,14 +281,14 @@ class Lettering extends BookKeeping
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqlb = $this->db->query($sql);
if ($resqlb) {
$obj = $this->db->fetch_object($resqlb);
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
$error++;
}
$this->db->free($result);
$this->db->free($resqlb);
} else {
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
$error++;
@ -699,6 +699,8 @@ class Lettering extends BookKeeping
return $grouped_payments;
}
$save_payment_by_element = null;
$save_element_by_payment = null;
if ($element_id == 0) {
// Save list when is the begin of recursive function
$save_payment_by_element = $payment_by_element;

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@ -46,6 +47,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int');
// Select Box
$mesCasesCochees = GETPOST('toselect', 'array');
@ -434,12 +436,15 @@ if ($result) {
$arrayofmassactions = array(
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
if ($massaction !== 'set_default_account') {
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
print '<input type="hidden" name="action" value="ventil">';
@ -454,6 +459,14 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
if ($massaction == 'set_default_account') {
$formquestion[]=array('type' => 'other',
'name' => 'set_default_account',
'label' => $langs->trans("AccountancyCode"),
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
}
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
if ($msg) {
@ -712,7 +725,7 @@ if ($result) {
// Suggested accounting account
print '<td>';
print $formaccounting->select_account($suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facture_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox
@ -721,6 +734,14 @@ if ($result) {
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$ischecked = 1;
}
if (!empty($toselect)) {
$ischecked = 0;
if (in_array($objp->rowid."_".$i, $toselect)) {
$ischecked=1;
}
}
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facture_static_det->id.'" name="toselect[]" value="'.$facture_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
print '</td>';

View File

@ -558,11 +558,11 @@ if ($result) {
}
/*var_dump($tabpay);
var_dump($tabcompany);
var_dump($tabbq);
var_dump($tabtp);
var_dump($tabtype);*/
//var_dump($tabpay);
//var_dump($tabcompany);
//var_dump($tabbq);
//var_dump($tabtp);
//var_dump($tabtype);
// Write bookkeeping
if (!$error && $action == 'writebookkeeping') {
@ -594,9 +594,9 @@ if (!$error && $action == 'writebookkeeping') {
$db->begin();
// Introduce a protection. Total of tabtp must be total of tabbq
/*var_dump($tabpay);
var_dump($tabtp);
var_dump($tabbq);exit;*/
//var_dump($tabpay);
//var_dump($tabtp);
//var_dump($tabbq);exit;
// Bank
if (!$errorforline && is_array($tabbq[$key])) {
@ -1267,9 +1267,9 @@ if (empty($action) || $action == 'view') {
$accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger) {
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
/*var_dump($tabpay[$key]);
var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/
//var_dump($tabpay[$key]);
//var_dump($tabtype[$key]);
//var_dump($tabbq[$key]);
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
if (!empty($tabcompany[$key]['code_compta'])) {
if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {

View File

@ -418,9 +418,14 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
}
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
@ -897,12 +902,12 @@ if (empty($action) || $action == 'view') {
print "</td>";
// Subledger account
print "<td>";
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
} else {
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
print length_accounta($tabcompany[$key]['code_compta']);
}
} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
}
print '</td>';
$companystatic->id = $tabcompany[$key]['id'];

View File

@ -43,17 +43,6 @@ if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';
}
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
// Get information of journal
$object = new AccountingJournal($db);
$result = $object->fetch($id_journal);
@ -65,7 +54,7 @@ if ($result > 0) {
accessforbidden($langs->trans('ErrorRecordNotFound'));
}
$hookmanager->initHooks(array('globaljournal', $object->nature_text . 'journal'));
$hookmanager->initHooks(array('globaljournal', $object->nature.'journal'));
$parameters = array();
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
@ -93,6 +82,18 @@ if (!is_array($journal_data)) {
setEventMessages($object->error, $object->errors, 'errors');
}
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->socid > 0) {
accessforbidden();
}
if (empty($user->rights->accounting->mouvements->lire)) {
accessforbidden();
}
/*
* Actions
*/

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
@ -47,6 +48,7 @@ $show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$optioncss = GETPOST('optioncss', 'alpha');
$default_account = GETPOST('default_account', 'int');
// Select Box
$mesCasesCochees = GETPOST('toselect', 'array');
@ -442,12 +444,15 @@ if ($result) {
$arrayofmassactions = array(
'ventil'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Ventilate")
,'set_default_account'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
if ($massaction !== 'set_default_account') {
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n";
print '<input type="hidden" name="action" value="ventil">';
@ -462,6 +467,14 @@ if ($result) {
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
if ($massaction == 'set_default_account') {
$formquestion[]=array('type' => 'other',
'name' => 'set_default_account',
'label' => $langs->trans("AccountancyCode"),
'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmPreselectAccount"), $langs->trans("ConfirmPreselectAccountQuestion", count($toselect)), "confirm_set_default_account", $formquestion, 1, 0, 200, 500, 1);
}
print '<span class="opacitymedium">'.$langs->trans("DescVentilTodoCustomer").'</span></br><br>';
if ($msg) {
@ -736,7 +749,7 @@ if ($result) {
// Suggested accounting account
print '<td>';
print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print $formaccounting->select_account(($default_account > 0 && $confirm === 'yes' && in_array($objp->rowid."_".$i, $toselect)) ? $default_account : $suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
// Column with checkbox
@ -745,6 +758,14 @@ if ($result) {
if (!empty($suggestedid) && $suggestedaccountingaccountfor != '' && $suggestedaccountingaccountfor != 'eecwithoutvatnumber') {
$ischecked = 1;
}
if (!empty($toselect)) {
$ischecked = 0;
if (in_array($objp->rowid."_".$i, $toselect)) {
$ischecked=1;
}
}
print '<input type="checkbox" class="flat checkforselect checkforselect'.$facturefourn_static_det->id.'" name="toselect[]" value="'.$facturefourn_static_det->id."_".$i.'"'.($ischecked ? " checked" : "").'/>';
print '</td>';

View File

@ -64,7 +64,7 @@ if ($action == 'set_default') {
} elseif ($action == 'del_default') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
}
}
@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
}
print '</td>';
@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
print '<td class="center">';

View File

@ -95,12 +95,13 @@ if ($action == 'update') {
$form = new Form($db);
$title = $langs->trans("MembersSetup");
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
print load_fiche_titre($title, $linkback, 'title_setup');
$head = member_admin_prepare_head();

View File

@ -163,7 +163,7 @@ if ($object->id > 0) {
$newcardbutton = '';
if (!empty($conf->agenda->enabled)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).($object->id > 0 ? '?id='.$object->id : '').'&origin=member&originid='.$id);
}
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {

View File

@ -1286,7 +1286,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<tr><td>'.(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email', 'class="pictofixedwidth"').'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
// Website
@ -2030,7 +2030,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$MAX = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -121,6 +121,9 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
/** @var string string other */
public $other = array();
public $multilangs = array();

View File

@ -490,17 +490,17 @@ class Subscription extends CommonObject
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.((int) $id);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}

View File

@ -99,12 +99,12 @@ $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$adhtype = new AdherentType($db);
$adhtype->id = $objp->rowid;
@ -127,7 +127,7 @@ if ($result) {
$i++;
}
$db->free($result);
$db->free($resql);
}
$now = dol_now();
@ -143,16 +143,16 @@ $sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
$i++;
}
$db->free();
$db->free($resql);
}
/*

View File

@ -305,6 +305,8 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db);
$title = $langs->trans("Members");
$now = dol_now();
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
@ -471,42 +473,41 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit;
}
llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$titre = $langs->trans("MembersList");
if (GETPOSTISSET("search_status")) {
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
$titre = $langs->trans("MembersListQualified");
$title = $langs->trans("MembersListQualified");
}
if ($search_status == Adherent::STATUS_DRAFT) {
$titre = $langs->trans("MembersListToValid");
$title = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
$titre = $langs->trans("MenuMembersValidated");
$title = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
$titre = $langs->trans("MembersWithSubscriptionToReceive");
$title = $langs->trans("MembersWithSubscriptionToReceive");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'uptodate') {
$titre = $langs->trans("MembersListUpToDate");
$title = $langs->trans("MembersListUpToDate");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
$title = $langs->trans("MembersListNotUpToDate");
}
if ((string) $search_status == (string) Adherent::STATUS_RESILIATED) { // The cast to string is required to have test false when search_status is ''
$titre = $langs->trans("MembersListResiliated");
$title = $langs->trans("MembersListResiliated");
}
if ($search_status == Adherent::STATUS_EXCLUDED) {
$titre = $langs->trans("MembersListExcluded");
$title = $langs->trans("MembersListExcluded");
}
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
$title = $langs->trans("MembersListQualified");
}
if ($search_type > 0) {
$membertype = new AdherentType($db);
$result = $membertype->fetch($search_type);
$titre .= " (".$membertype->label.")";
$title .= " (".$membertype->label.")";
}
$param = '';
@ -623,7 +624,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "member";

View File

@ -85,11 +85,18 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'member') accessforbidden();
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') != 'member') {
accessforbidden('Partnership module is not activated for members');
}
if (empty($conf->partnership->enabled)) {
accessforbidden();
}
if (empty($permissiontoread)) {
accessforbidden();
}
if ($action == 'edit' && empty($permissiontoadd)) {
accessforbidden();
}
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) {
accessforbidden();
}

View File

@ -173,6 +173,9 @@ if (!empty($triggers)) {
if ($module == 'contact') {
$module = 'societe';
}
if ($module == 'facturerec') {
$module = 'facture';
}
// If 'element' value is myobject@mymodule instead of mymodule
$tmparray = explode('@', $module);

View File

@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
//$tabsqlsort[26]="code ASC";
$tabsqlsort[27] = "code ASC";
$tabsqlsort[28] = "country ASC, code ASC";
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC";
@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";

View File

@ -420,7 +420,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table

View File

@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
$error = 0;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range', 'int');
@ -62,9 +62,16 @@ if ($action == 'updateik') {
}
}
$expIk->setValues($_POST);
$result = $expIk->create($user);
$expIk->coef = $coef;
$expIk->ikoffset = $ikoffset;
$expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat;
$expIk->fk_range = $fk_range;
if ($expIk->id > 0) {
$result = $expIk->update($user);
} else {
$result = $expIk->create($user);
}
if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs');

View File

@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
$object = new ExpenseReportRule($db);
if (!$user->admin) {
accessforbidden();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
/*
* Action
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -51,7 +57,6 @@ if ($reshook < 0) {
if (empty($reshook)) {
//Init error
$error = false;
$message = false;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
@ -59,21 +64,20 @@ if (empty($reshook)) {
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user', 'int');
$fk_usergroup = GETPOST('fk_usergroup', 'int');
$fk_c_type_fees = GETPOST('fk_c_type_fees');
$restrictive = GETPOST('restrictive', 'int');
$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = GETPOST('amount');
$amount = price2num(GETPOST('amount'), 'MT', 2);
$object = new ExpenseReportRule($db);
if (!empty($id)) {
$result = $object->fetch($id);
if ($result < 0) {
dol_print_error('', $object->error, $object->errors);
}
}
// TODO do action
if ($action == 'save') {
$error = 0;
@ -104,8 +108,6 @@ if (empty($reshook)) {
}
if (empty($error)) {
$object->setValues($_POST);
if ($apply_to == 'U') {
$object->fk_user = (int) $fk_user;
$object->fk_usergroup = 0;
@ -122,18 +124,30 @@ if (empty($reshook)) {
$object->dates = $dates;
$object->datee = $datee;
$object->restrictive = $restrictive;
$object->fk_c_type_fees = $fk_c_type_fees;
$object->code_expense_rules_type = $code_expense_rules_type;
$object->amount = $amount;
$object->entity = $conf->entity;
$res = $object->create($user);
if ($object->id > 0) {
$res = $object->update($user);
} else {
$res = $object->create($user);
}
if ($res > 0) {
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
} else {
dol_print_error($object->db);
$error++;
}
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
} else {
$action = '';
}
}
} elseif ($action == 'delete') {
// TODO add confirm
@ -207,7 +221,7 @@ if ($action != 'edit') {
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount right" /></td>';
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
echo '</tr>';
@ -266,11 +280,11 @@ foreach ($rules as $rule) {
if ($rule->fk_c_type_fees == -1) {
echo $langs->trans('AllExpenseReport');
} else {
$key = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
$key = getDictionaryValue('c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key && $key != $langs->trans($key)) {
echo $langs->trans($key);
} else {
$value = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
$value = getDictionaryValue('c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
}
}
@ -304,10 +318,10 @@ foreach ($rules as $rule) {
}
echo '</td>';
// Amount
echo '<td class="linecolamount">';
if ($action == 'edit' && $object->id == $rule->id) {
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount width50 right" />';
} else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
}

View File

@ -442,23 +442,23 @@ print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "</tr>\n";
/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
*/
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
}
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
}
/*
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
*/
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
//var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
// Set working days
print '<tr class="oddeven">';

View File

@ -529,7 +529,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitleSeparator();
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= '</li></ul></div>';
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';

View File

@ -78,7 +78,7 @@ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
print '<td></td>';
@ -106,6 +106,15 @@ if (empty($conf->use_javascript_ajax)) {
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print '</td>';
print '<td></td>';
print '</tr>';
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans('DisabledResourceLinkUser').'</td>';
print '<td class="right">';
@ -122,15 +131,7 @@ echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print '</td>';
print '<td></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans('EnableResourceUsedInEventCheck').'</td>';
print '<td class="right">';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print '</td>';
print '<td></td>';
print '</tr>';
*/
print '</table>';
print '</div>';

View File

@ -74,7 +74,6 @@ llxHeader('', $langs->trans("ResourceSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ResourceSetup"), $linkback, 'title_setup');
print "<br>\n";
$head = resource_admin_prepare_head();

View File

@ -407,10 +407,10 @@ if (empty($error) && !empty($xml)) {
$checksumget = md5(join(',', $checksumconcat));
$checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
/*var_dump(count($file_list['added']));
var_dump($checksumget);
var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/
//var_dump(count($file_list['added']));
//var_dump($checksumget);
//var_dump($checksumtoget);
//var_dump($checksumget == $checksumtoget);
$resultcomment = '';

View File

@ -58,23 +58,6 @@ print $langs->trans("xcache.optimizer").': '.yn(ini_get('xcache.optimizer')).' (
print $langs->trans("xcache.stat").': '.yn(ini_get('xcache.stat')).'<br>'."\n";
print $langs->trans("xcache.coverager").': '.yn(ini_get('xcache.coverager')).'<br>'."\n";
//print xcache_get();
/*
$cacheinfos = array();
for ($i = 0; $i < 10; $i ++)
{
$data = xcache_info(XC_TYPE_PHP, $i);
$data['cacheid'] = $i;
$cacheinfos[] = $data;
}
var_dump($cacheinfos);
if ($action == 'clear')
{
xcache_clear_cache();
}
*/
// End of page
llxFooter();

View File

@ -99,6 +99,50 @@ if ($action == 'updateMask') {
// par appel methode canBeActivated
dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setvarworkflow') {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (GETPOSTISSET('product_category_id')) {
$param_ticket_product_category = GETPOST('product_category_id', 'int');
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
$param_delay_first_response = GETPOST('delay_first_response', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_delay_between_responses = GETPOST('delay_between_responses', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
} elseif ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
@ -146,50 +190,6 @@ if ($action == 'updateMask') {
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarworkflow') {
$param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarworkflowother' || $action == 'setvarworkflow') {
$param_ticket_product_category = GETPOST('product_category_id', 'int');
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($action == 'setvarother') {
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
@ -198,34 +198,9 @@ if ($action == 'setvarother') {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_delay_first_response = GETPOST('delay_first_response', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_delay_between_responses = GETPOST('delay_between_responses', 'int');
$res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
/*
* View
*/
@ -384,8 +359,8 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">';
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<table class="noborder cenpercent">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
@ -502,13 +477,14 @@ foreach ($dirmodels as $reldir) {
print '</table>';
print '</div><br>';
if (empty($conf->use_javascript_ajax)) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarworkflow">';
}
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarworkflow">';
print '<input type="hidden" name="page_y" value="">';
print load_fiche_titre($langs->trans("Other"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@ -563,34 +539,24 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp
print '</td>';
print '</tr>';
// Choose which product category is used for tickets
if ($conf->use_javascript_ajax) {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvarworkflowother">';
if (! empty($conf->product->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
print '<td class="left">';
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
if ($conf->use_javascript_ajax) {
print ajax_combobox('select_'.$htmlname);
}
print '</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
print '</td>';
print '</tr>';
}
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
print '<td class="left">';
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
if ($conf->use_javascript_ajax) {
print ajax_combobox('select_'.$htmlname);
}
print '</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Define wanted maximum time elapsed before answers to tickets
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="action" value="setvarother">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBeforeFirstAnswer")."</td>";
print '<td class="left">
<input type="number" value="'.$conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE.'" name="delay_first_response">
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
<input type="number" value="'.$conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE.'" name="delay_first_response" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
@ -600,8 +566,7 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TicketsDelayBetweenAnswers")."</td>";
print '<td class="left">
<input type="number" value="'.$conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE.'" name="delay_between_responses">
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
<input type="number" value="'.$conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE.'" name="delay_between_responses" class="width50">
</td>';
print '<td class="center">';
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
@ -610,9 +575,7 @@ print '</tr>';
print '</table><br>';
print '<div class="center">';
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
print '</div>';
print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
print '</form>';
@ -622,9 +585,10 @@ print load_fiche_titre($langs->trans("Notification"), '', '');
print '<table class="noborder centpercent">';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvar">';
print '<input type="hidden" name="page_y" value="">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Email").'</td>';
@ -699,7 +663,7 @@ print '</td></tr>';
print '</table>';
print $formcategory->buttonsSaveCancel("Save", '');
print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition');
print '</form>';

View File

@ -42,21 +42,24 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
$error = 0;
/*
* Actions
*/
$error = 0;
$errors = array();
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
if (GETPOST('value')) {
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
} else {
dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
}
}
if ($action == 'setvar') {
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
} elseif ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
if (GETPOSTISSET('TICKET_ENABLE_PUBLIC_INTERFACE')) { // only for no js case
@ -64,14 +67,7 @@ if ($action == 'setvar') {
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if (GETPOSTISSET('TICKET_EMAIL_MUST_EXISTS')) { // only for no js case
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
@ -80,6 +76,7 @@ if ($action == 'setvar') {
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
@ -88,6 +85,7 @@ if ($action == 'setvar') {
$res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
@ -99,6 +97,7 @@ if ($action == 'setvar') {
}
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml');
@ -109,6 +108,7 @@ if ($action == 'setvar') {
}
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'restricthtml');
@ -119,6 +119,7 @@ if ($action == 'setvar') {
}
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'restricthtml');
@ -129,6 +130,7 @@ if ($action == 'setvar') {
}
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
@ -139,12 +141,14 @@ if ($action == 'setvar') {
}
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
$param_public_notification_new_message_default_email = GETPOST('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL', $param_public_notification_new_message_default_email, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
@ -152,10 +156,60 @@ if ($action == 'setvar') {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1;
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
if (!$error) {
if ($code == 'TICKET_EMAIL_MUST_EXISTS') {
$res = dolibarr_del_const($db, 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
} elseif ($code == 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST') {
$res = dolibarr_del_const($db, 'TICKET_EMAIL_MUST_EXISTS', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
// enable captcha by default
$res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
}
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!($res > 0)) {
$error++;
$errors[] = $db->lasterror();
}
}
if ($action != '') {
if (!$error) {
$db->commit();
setEventMessage($langs->trans('SetupSaved'));
header("Location: " . $_SERVER['PHP_SELF']);
exit;
} else {
$db->rollback();
setEventMessages('', $errors, 'errors');
}
}
/*
@ -180,7 +234,7 @@ $head = ticketAdminPrepareHead();
print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php?entity='.$conf->entity.'" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).'</a>';
print dol_get_fiche_end();
@ -220,11 +274,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
// Check if email exists
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
print '</td>';
print '<td class="center width75">';
@ -232,6 +285,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '</td>';
print '</tr>';
// Create third-party with contact if email not linked to a contact
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
print '</td>';
print '<td class="center width75">';
print $form->textwithpicto('', $langs->trans("TicketCreateThirdPartyWithContactIfNotExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
@ -341,7 +408,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<br><br>';
print_fiche_titre($langs->trans("Emails"));
print load_fiche_titre($langs->trans("Emails"));
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';

View File

@ -444,9 +444,9 @@ if ($mode == 'overwrite') {
if ($mode == 'searchkey') {
$nbempty = 0;
/*var_dump($langcode);
var_dump($transkey);
var_dump($transvalue);*/
//var_dump($langcode);
//var_dump($transkey);
//var_dump($transvalue);
if (empty($langcode) || $langcode == '-1') {
$nbempty++;
}

View File

@ -568,10 +568,9 @@ class Documents extends DolibarrApi
{
global $db, $conf;
/*var_dump($modulepart);
var_dump($filename);
var_dump($filecontent);
exit;*/
//var_dump($modulepart);
//var_dump($filename);
//var_dump($filecontent);exit;
if (empty($modulepart)) {
throw new RestException(400, 'Modulepart not provided.');

View File

@ -100,7 +100,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$url = $_SERVER['PHP_SELF'];
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
$url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO'];
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
}
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
if (!empty($conf->global->MAIN_NGINX_FIX)) {

View File

@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -144,6 +144,7 @@ class Asset extends CommonObject
public $fk_disposal_type;
public $disposal_depreciated;
public $disposal_subject_to_vat;
public $supplier_invoice_id;
public $note_public;
public $note_private;
public $date_creation;

View File

@ -129,6 +129,7 @@ class AssetModel extends CommonObject
public $import_key;
public $model_pdf;
public $status;
public $asset_depreciation_options;
// /**
// * @var string Field with ID of parent key if this object has a parent

View File

@ -315,7 +315,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// $MAXEVENT = 10;
//
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
// $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id);
//
// // List of actions on element
// include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';

View File

@ -92,11 +92,11 @@ function formatObject($objtoshow, $prefix)
$s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
$s .= '<td>';
if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
/*var_dump(is_object($val));
var_dump(is_array($val));
var_dump(is_array($val));
var_dump(@get_class($val));
var_dump($val);*/
//var_dump(is_object($val));
//var_dump(is_array($val));
//var_dump(is_array($val));
//var_dump(@get_class($val));
//var_dump($val);
$s .= dol_print_date($val, 'dayhour');
} else {
$s .= $val;

View File

@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -742,7 +742,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
$morehtmlref = "";
llxHeader('', $title, $help_url);

View File

@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
@ -184,7 +185,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dol_get_fiche_end();
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':'')));
$viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':'')));
print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes');

View File

@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php

View File

@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
if (empty($TNetNeeds[$line->fk_product])) {
$TNetNeeds[$line->fk_product] = 0;
}
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}

View File

@ -113,7 +113,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_FK = array(
public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@ -125,7 +125,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_TABLE = array(
public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@ -136,7 +136,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_CLASS = array(
public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@ -178,7 +178,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_TABLE = array(
public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
/**
* @var array Childs
*/
public $childs = array();
/**
* Constructor
*

View File

@ -102,7 +102,8 @@ if (empty($nosearch)) {
print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>';
print '<tr class="oddeven nohover"><td>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.dol_escape_htmltag($catname).'"></td>';
print '<td><input type="submit" class="button small" value="'.$langs->trans("Search").'"></td></tr>';
print '</table></form>';

View File

@ -461,6 +461,13 @@ if (empty($reshook) && $action == 'add') {
}
}
// Modify $moreparam so we are sure to see the event we have just created, whatever are the default value of filter on next page.
/*$moreparam .= ($moreparam ? '&' : '').'search_actioncode=0';
$moreparam .= ($moreparam ? '&' : '').'search_status=-1';
$moreparam .= ($moreparam ? '&' : '').'search_filtert='.$object->userownerid;
*/
$moreparam .= ($moreparam ? '&' : '').'disabledefaultvalues=1';
if ($error) {
$db->rollback();
} else {
@ -674,7 +681,7 @@ if (empty($reshook) && $action == 'update') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
// already in use
// Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@ -853,7 +860,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
$object->errors[] = $object->error;
} else {
if ($db->num_rows($resql) > 0) {
// already in use
// Resource already in use
$error++;
$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
while ($obj = $db->fetch_object($resql)) {
@ -952,16 +959,17 @@ if ($action == 'create') {
console.log("setdatefields");
setdatefields();
});
$("#selectcomplete").change(function() {
if ($("#selectcomplete").val() == 100)
{
console.log("we change the complete status - set the doneby");
if ($("#selectcomplete").val() == 100) {
if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\');
}
if ($("#selectcomplete").val() == 0)
{
if ($("#selectcomplete").val() == 0) {
$("#doneby").val(-1);
}
});
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");
@ -1019,59 +1027,15 @@ if ($action == 'create') {
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
// Full day
print '<tr><td><label for="fullday">'.$langs->trans("EventOnFullDay").'</label></td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday') ? ' checked' : '').'><label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) {
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
}
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) {
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
}
if (empty($datef) && !empty($datep)) {
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
}
}
// Date start
print '<tr><td class="nowrap">';
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
//print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print '</td></tr>';
// Date end
/*print '<tr><td>';
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td>';
print '<td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
}
print '</td></tr>';*/
// Dev in progress
// Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
print '<tr><td></td><td colspan="3">';
//print '<tr><td></td><td colspan="3" class="opacitymedium">';
print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">';
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@ -1120,34 +1084,51 @@ if ($action == 'create') {
});
});
</script>';
print '</td></tr>';
print '</div>';
//print '</td></tr>';
}
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
$percent = GETPOST('percentage', 'int');
} else {
if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
$datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep));
if (GETPOST('datep', 'int', 1)) {
$datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser');
}
$datef = ($datef ? $datef : $object->datef);
if (GETPOST('datef', 'int', 1)) {
$datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser');
}
if (empty($datef) && !empty($datep)) {
if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) {
$datef = dol_time_plus_duree($datep, (empty($conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS) ? 1 : $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS), 'h');
}
}
// Date start
print '<tr><td class="nowrap">';
/*
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.(GETPOST("actioncode", 'aZ09') == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
*/
print '</td><td>';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo"
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel');
}
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
// Assigned to
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
print '<tr><td class="tdtop nowrap"><span class="fieldrequired">'.$langs->trans("ActionAffectedTo").'</span></td><td>';
$listofuserid = array();
$listofcontactid = array();
$listofotherid = array();
@ -1181,6 +1162,29 @@ if ($action == 'create') {
print '</td></tr>';
}
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
}
// Status
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent = $complete !=='' ? $complete : -1;
if (GETPOSTISSET('status')) {
$percent = GETPOST('status');
} elseif (GETPOSTISSET('percentage')) {
$percent = GETPOST('percentage', 'int');
} else {
if ($complete == '0' || GETPOST("afaire") == 1) {
$percent = '0';
} elseif ($complete == 100 || GETPOST("afaire") == 2) {
$percent = 100;
}
}
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
if ($conf->categorie->enabled) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
@ -1523,6 +1527,7 @@ if ($id > 0) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
if ($object->type_code != 'AC_OTH_AUTO') {
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ? GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto", 0, 0, 0, 1);
} else {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
@ -1533,40 +1538,19 @@ if ($id > 0) {
}
// Title
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Date").'</span></td><td colspan="3" class="valignmiddle height30 small"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'>';
print '<label for="fullday">'.$langs->trans("EventOnFullDay").'</label>';
// Date start - end
print '<tr><td class="nowrap">';
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print '</td></tr>';
// Dev in progress
// Recurring event
$userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent) {
// Repeat
print '<tr><td></td><td colspan="3">';
//print '<tr><td></td><td colspan="3">';
print ' &nbsp; &nbsp; &nbsp; &nbsp; <div class="opacitymedium inline-block">';
print img_picto($langs->trans("Recurrence"), 'recurring', 'class="paddingright2"');
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$selectedrecurrulefreq = 'no';
$selectedrecurrulebymonthday = '';
@ -1615,19 +1599,37 @@ if ($id > 0) {
});
});
</script>';
print '</td></tr>';
print '</div>';
//print '</td></tr>';
}
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
// Date start - end
print '<tr><td class="nowrap">';
/*print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
print ' - ';
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
*/
print '</td><td td colspan="3">';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
} else {
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
}
print '</td></tr>';
print '<tr><td class="">&nbsp;</td><td></td></tr>';
// Assigned to
$listofuserid = array(); // User assigned
@ -1678,6 +1680,18 @@ if ($id > 0) {
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
print '</td></tr>';
}
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="width500" value="'.$object->location.'"></td></tr>';
}
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent = GETPOSTISSET("percentage") ? GETPOST("percentage", "int") : $object->percentage;
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Tags-Categories
if ($conf->categorie->enabled) {
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
@ -1786,7 +1800,7 @@ if ($id > 0) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor('note', $object->note_private, '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -1598,7 +1598,7 @@ class ActionComm extends CommonObject
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_from);
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to);
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to);
if (!empty($this->email_tocc)) {
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_tocc);
}
@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject
$label = $langs->trans("ShowAction");
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"';
$linkclose .= ' class="'.$classname.' classfortooltip"';
/*
$hookmanager->initHooks(array('actiondao'));

View File

@ -49,6 +49,8 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
}
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$check_holiday = GETPOST('check_holiday', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
@ -110,7 +112,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W");
$day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d");
$pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3);
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo'
$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW;
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
@ -128,14 +130,11 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -1191,7 +1190,8 @@ if (count($listofextcals)) {
foreach ($icalevents as $icalevent) {
//var_dump($icalevent);
//print $icalevent['SUMMARY'].'->'.var_dump($icalevent).'<br>';exit;
//print $icalevent['SUMMARY'].'->';
//var_dump($icalevent);exit;
if (!empty($icalevent['RRULE'])) {
continue; // We found a repeatable event. It was already split into unitary events, so we discard general rule.
}

View File

@ -45,6 +45,11 @@ $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$mode = GETPOST('mode', 'aZ09');
if (empty($mode) && preg_match('/show_/', $action)) {
@ -54,12 +59,9 @@ $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid",
$pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3);
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
$type = GETPOST('search_type', 'alphanohtml') ?GETPOST('search_type', 'alphanohtml') : GETPOST('type', 'alphanohtml');
$optioncss = GETPOST('optioncss', 'alpha');
$year = GETPOST("year", 'int');
$month = GETPOST("month", 'int');
$day = GETPOST("day", 'int');
$toselect = GETPOST('toselect', 'array');
$confirm = GETPOST('confirm', 'alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('search_actioncode', 'array')) {
@ -68,11 +70,9 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$search_id = GETPOST('search_id', 'alpha');
$search_title = GETPOST('search_title', 'alpha');
$search_note = GETPOST('search_note', 'alpha');
@ -83,7 +83,7 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int')
$dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel');
$dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel');
if ($search_status == '' && !GETPOSTISSET('search_status')) {
$search_status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -216,7 +216,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$datestart_dtend = '';
$dateend_dtstart = '';
$dateend_dtend = '';
$actioncode = '';
$search_status = '';
$pid = '';
$socid = '';
$resourceid = '';
$filter = '';
$filtert = '';
$usergroup = '';
$toselect = array();
$search_array_options = array();
}
@ -299,7 +306,7 @@ if ($actioncode != '') {
if ($resourceid > 0) {
$param .= "&search_resourceid=".urlencode($resourceid);
}
if ($search_status != '' && $search_status > -1) {
if ($search_status != '') {
$param .= "&search_status=".urlencode($search_status);
}
if ($filter) {

View File

@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$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);
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@ -145,7 +144,7 @@ $begin_d = 1;
$end_d = 53;
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
$mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
@ -961,7 +960,9 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
$ymd = sprintf("%04d", $year).sprintf("%02d", $month).sprintf("%02d", $day);
$nextindextouse = count($colorindexused); // At first run, this is 0, so fist user has 0, next 1, ...
//if ($username->id && $day==1) var_dump($eventarray);
//if ($username->id && $day==1) {
//var_dump($eventarray);
//}
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused) {

View File

@ -45,6 +45,8 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$action = GETPOST('action', 'aZ09');
$disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
$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);
@ -110,10 +112,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
if ($actioncode == '' && empty($actioncodearray)) {
$actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
@ -154,7 +153,7 @@ if ($end_d < $begin_d) {
}
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = (empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
}
if (empty($mode) && !GETPOSTISSET('mode')) {
@ -1130,7 +1129,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
$nextindextouse = count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
//if ($username->id && $day==1) var_dump($eventarray);
//if ($username->id && $day==1) {
//var_dump($eventarray);
//}
// We are in a particular day for $username, now we scan all events
foreach ($eventarray as $daykey => $notused) {

View File

@ -634,7 +634,11 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
print $s;
print '</td>';
print '<td class="right nowrap tddate">'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
$datem = $db->jdate($objp->tms);
print '<td class="right nowrap tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
print dol_print_date($datem, 'day', 'tzuserrel');
print '</td>';
print '</tr>';
$i++;
@ -725,7 +729,11 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
print $s;
print '</td>';
print '<td class="right tddate">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
$datem = $db->jdate($objp->dm);
print '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
print dol_print_date($datem, 'day', 'tzuserrel');
print '</td>';
print '</tr>';
$i++;
@ -922,7 +930,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
print '</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
$datem = $db->jdate($obj->dp);
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
print dol_print_date($datem, 'day', 'tzserver');
print '</td>';
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
@ -1039,7 +1050,11 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
print '</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dv), 'day').'</td>';
$datem = $db->jdate($obj->dv);
print '<td class="center tddate" title="'.dol_escape_htmltag($langs->trans("DateValue").': '.dol_print_date($datem, 'day', 'tzserver')).'">';
print dol_print_date($datem, 'day', 'tzserver');
print '</td>';
print '<td class="right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>';

View File

@ -961,7 +961,7 @@ if ($action == 'create') {
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) {
if (($object->statut == 1) && ($user->rights->mailing->valider || $object->user_validation == $user->id)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=settodraft&token='.newToken().'&id='.$object->id.'">'.$langs->trans("SetToDraft").'</a>';
}
@ -1066,7 +1066,7 @@ if ($action == 'create') {
print dol_get_fiche_end();
print dol_set_focus('#sendto');
dol_set_focus('#sendto');
}

View File

@ -86,6 +86,11 @@ class Mailing extends CommonObject
*/
public $email_from;
/**
* @var string email to
*/
public $sendto;
/**
* @var string email reply to
*/
@ -175,6 +180,11 @@ class Mailing extends CommonObject
*/
public $statuts = array();
/**
* @var array substitutionarray
*/
public $substitutionarray;
/**
* Constructor

View File

@ -692,7 +692,7 @@ if (empty($reshook)) {
$deposit = null;
$locationTarget = '';
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . '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 (
!$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on'
@ -1999,7 +1999,7 @@ if ($action == 'create') {
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
);
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . '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';

View File

@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
}
// Add external contacts ids.
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->propal->contacts_ids = $tmparray;
}
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
$proposal_static = new Propal($this->db);
if ($proposal_static->fetch($obj->rowid)) {
// Add external contacts ids
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
$tmparray = $proposal_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$proposal_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
}
$i++;
@ -519,7 +527,9 @@ class Proposals extends DolibarrApi
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice,
0,
isset($request_data->rang) ? $request_data->rang : $propalline->rang
);
if ($updateRes > 0) {
@ -643,7 +653,7 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$contacts = $this->invoice->liste_contact();
$contacts = $this->propal->liste_contact();
foreach ($contacts as $contact) {
if ($contact['id'] == $contactid && $contact['code'] == $type) {

View File

@ -296,8 +296,8 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@ -317,7 +317,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', '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),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'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),
@ -327,7 +327,7 @@ class Propal extends CommonObject
'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),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
@ -490,7 +490,6 @@ class Propal extends CommonObject
$line->subprice = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefined
$line->qty = 1;
$line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@ -736,7 +735,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@ -806,9 +804,10 @@ class Propal extends CommonObject
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @param integer $rang line rank
* @return int 0 if OK, <0 if KO
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
{
global $mysoc, $langs;
@ -894,6 +893,7 @@ class Propal extends CommonObject
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {
@ -934,7 +934,6 @@ class Propal extends CommonObject
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@ -1518,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@ -1601,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
$this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);
@ -1898,14 +1899,15 @@ class Propal extends CommonObject
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
$i++;
}
@ -3991,6 +3993,7 @@ class PropaleLigne extends CommonObjectLine
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
/**
* Class line Contructor
*
@ -4130,9 +4133,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->rang)) {
$this->rang = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
$this->remise_percent = 0;
}
@ -4362,9 +4362,6 @@ class PropaleLigne extends CommonObjectLine
if (empty($this->price)) {
$this->price = 0; // TODO A virer
}
if (empty($this->remise)) {
$this->remise = 0; // TODO A virer
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}

View File

@ -377,14 +377,14 @@ if ($action == 'validate' && $permissiontovalidate) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user) > 0) {
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
} else {
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
}
} else {
$langs->load("errors");
setEventMessage($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), 'errors');
setEventMessages($langs->trans('ErrorIsNotADraft', $tmpproposal->ref), null, 'errors');
$error++;
}
} else {
@ -410,7 +410,7 @@ if ($action == "sign" && $permissiontoclose) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
} else {
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
$error++;
@ -765,12 +765,12 @@ if ($resql) {
if ($socid > 0) {
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfProposals').' - '.$soc->name;
$title = $langs->trans('Proposals').' - '.$soc->name;
if (empty($search_societe)) {
$search_societe = $soc->name;
}
} else {
$title = $langs->trans('ListOfProposals');
$title = $langs->trans('Proposals');
}
$num = $db->num_rows($resql);
@ -2133,7 +2133,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
print "</tr>\n";
print '</tr>'."\n";
$i++;
}
@ -2141,6 +2141,17 @@ if ($resql) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);

View File

@ -1184,7 +1184,7 @@ if (empty($reshook)) {
$error = 0;
$deposit = null;
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . '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 (
GETPOST('generate_deposit', 'alpha') == 'on' && ! empty($deposit_percent_from_payment_terms)
@ -1733,10 +1733,10 @@ if ($action == 'create' && $usercancreate) {
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
// Terms of the settlement
// Terms of payment
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'paiment', 'class="pictofixedwidth"');
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent);
print img_picto('', 'payment', 'class="pictofixedwidth"');
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
print '</td></tr>';
// Payment mode
@ -1836,7 +1836,7 @@ if ($action == 'create' && $usercancreate) {
print '<tr>';
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">';
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code');
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
}
@ -2025,7 +2025,7 @@ if ($action == 'create' && $usercancreate) {
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
$deposit_percent_from_payment_terms = getDictionaryValue(MAIN_DB_PREFIX . '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';

View File

@ -133,7 +133,10 @@ class Orders extends DolibarrApi
}
// Add external contacts ids
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->commande->contacts_ids = $tmparray;
}
$this->commande->fetchObjectLinked();
// Add online_payment_url, cf #20477
@ -234,7 +237,10 @@ class Orders extends DolibarrApi
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
$tmparray = $commande_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$commande_static->contacts_ids = $tmparray;
}
// Add online_payment_url, cf #20477
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
@ -439,7 +445,8 @@ class Orders extends DolibarrApi
$request_data->fk_unit,
$request_data->multicurrency_subprice,
0,
$request_data->ref_ext
$request_data->ref_ext,
$request_data->rang
);
if ($updateRes > 0) {

View File

@ -313,8 +313,8 @@ class Commande extends CommonOrder
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@ -334,14 +334,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', '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'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@ -1666,7 +1666,6 @@ class Commande extends CommonOrder
// TODO Ne plus utiliser
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options;
@ -2010,7 +2009,6 @@ class Commande extends CommonOrder
$line->price = -$remise->amount_ht;
$line->fk_product = 0; // Id produit predefini
$line->qty = 1;
$line->remise = 0;
$line->remise_percent = 0;
$line->rang = -1;
$line->info_bits = 2;
@ -2154,9 +2152,11 @@ class Commande extends CommonOrder
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@ -3087,9 +3087,10 @@ class Commande extends CommonOrder
* @param double $pu_ht_devise Amount in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext external reference
* @param integer $rang line rank
* @return int < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
{
global $conf, $mysoc, $langs, $user;
@ -3214,6 +3215,7 @@ class Commande extends CommonOrder
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {
@ -3260,7 +3262,6 @@ class Commande extends CommonOrder
// TODO deprecated
$this->line->price = $price;
$this->line->remise = $remise;
if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options
@ -4402,9 +4403,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->rang)) {
$this->rang = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}
@ -4445,7 +4443,7 @@ class OrderLine extends CommonOrderLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
$sql .= ' fk_unit';
@ -4468,7 +4466,6 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
$sql .= " '".price2num($this->remise)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';
@ -4577,9 +4574,6 @@ class OrderLine extends CommonOrderLine
if (empty($this->marge_tx)) {
$this->marge_tx = 0;
}
if (empty($this->remise)) {
$this->remise = 0;
}
if (empty($this->remise_percent)) {
$this->remise_percent = 0;
}

View File

@ -1015,12 +1015,12 @@ if ($resql) {
if ($socid > 0) {
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfOrders').' - '.$soc->name;
$title = $langs->trans('CustomersOrders').' - '.$soc->name;
if (empty($search_company)) {
$search_company = $soc->name;
}
} else {
$title = $langs->trans('ListOfOrders');
$title = $langs->trans('CustomersOrders');
}
if (strval($search_status) == '0') {
$title .= ' - '.$langs->trans('StatusOrderDraftShort');

View File

@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
$this->element = 'payment_various';

View File

@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) {
$id = GETPOST('rowid', 'int');
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
$rowid = GETPOST("rowid", 'int');
$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id
$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$rowid = GETPOST("rowid", 'int');
$orig_account = GETPOST("orig_account");
$backtopage = GETPOST('backtopage', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
@ -69,7 +70,7 @@ if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
accessforbidden();
}
@ -124,18 +125,26 @@ if ($user->rights->banque->modifier && $action == "update") {
$error = 0;
$acline = new AccountLine($db);
$acline->fetch($rowid);
$result = $acline->fetch($rowid);
if ($result <= 0) {
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.
$acline->id = $rowid;
}
$acsource = new Account($db);
$acsource->fetch($id);
$acsource->fetch($accountoldid);
$actarget = new Account($db);
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
$actarget->fetch(GETPOST('accountid', 'int'));
} else {
$actarget->fetch($id);
$actarget->fetch($accountoldid);
}
if (!($actarget->id > 0)) {
setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors');
$error++;
}
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') {
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++;
@ -229,7 +238,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
$sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
$sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
if (empty($num_rel)) {
$sql .= ", rappro = 0";
} else {
@ -307,7 +316,6 @@ if ($result) {
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
print '<input type="hidden" name="account" value="'.$acct->id.'">';
print '<input type="hidden" name="id" value="'.$acct->id.'">';
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
@ -326,11 +334,12 @@ if ($result) {
// Bank account
print '<tr><td class="titlefieldcreate">'.$langs->trans("Account").'</td>';
print '<td>';
if (!$objp->rappro && !$bankline->getVentilExportCompta()) {
print img_picto('', 'bank_account', 'class="paddingright"');
print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1);
} else {
// $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it.
if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) {
print $acct->getNomUrl(1, 'transactions', 'reflabel');
} else {
print img_picto('', 'bank_account', 'class="paddingright"');
print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1);
}
print '</td>';
print '</tr>';

View File

@ -534,7 +534,7 @@ foreach ($accounts as $key => $type) {
// Ref
if (!empty($arrayfields['b.ref']['checked'])) {
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$objecttmp->getNomUrl(1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -586,7 +586,7 @@ foreach ($accounts as $key => $type) {
// Accountancy journal
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
print '<td>';
print '<td class="tdoverflowmax125">';
if (!empty($conf->accounting->enabled)) {
if (empty($objecttmp->fk_accountancy_journal)) {
print img_warning($langs->trans("Mandatory"));
@ -606,7 +606,7 @@ foreach ($accounts as $key => $type) {
// Currency
if (!empty($arrayfields['b.currency_code']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print $objecttmp->currency_code;
print '</td>';
if (!$i) {
@ -616,7 +616,7 @@ foreach ($accounts as $key => $type) {
// Transactions to reconcile
if (!empty($arrayfields['toreconcile']['checked'])) {
print '<td class="center">';
print '<td class="center tdoverflowmax125">';
$conciliate = $objecttmp->canBeConciliated();
if ($conciliate == -2) {
@ -663,7 +663,7 @@ foreach ($accounts as $key => $type) {
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['b.datec']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_creation, 'dayhour');
print '</td>';
if (!$i) {
@ -672,7 +672,7 @@ foreach ($accounts as $key => $type) {
}
// Date modification
if (!empty($arrayfields['b.tms']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($objecttmp->date_update, 'dayhour');
print '</td>';
if (!$i) {

View File

@ -40,7 +40,6 @@ $socid = GETPOST("socid", "int");
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'banque', '', '', '');
$optioncss = GETPOST('optioncss', 'alpha');
@ -173,6 +172,11 @@ $arrayfields = array(
$arrayfields = dol_sort_array($arrayfields, 'position');
$object = new PaymentVarious($db);
$result = restrictedArea($user, 'banque', '', '', '');
/*
* Actions
*/
@ -271,19 +275,19 @@ if ($search_all) {
$sql .= $db->order($sortfield, $sortorder);
$totalnboflines = 0;
$result = $db->query($sql);
if ($result) {
$totalnboflines = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$totalnboflines = $db->num_rows($resql);
}
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
// Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$id);
exit;
@ -535,13 +539,13 @@ if ($result) {
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
print '</tr>';
$totalarray = array();
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
$variousstatic->id = $obj->rowid;
$variousstatic->ref = $obj->rowid;
@ -652,7 +656,7 @@ if ($result) {
if ($arrayfields['account']['checked']) {
$accountingaccount->fetch('', $obj->accountancy_code, 1);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$obj->accountancy_label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -660,7 +664,7 @@ if ($result) {
// Accounting subledger account
if ($arrayfields['subledger']['checked']) {
print '<td>'.length_accounta($obj->subledger_account).'</td>';
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
@ -704,7 +708,7 @@ if ($result) {
$totalarray['nbfield']++;
}
print "</tr>";
print '</tr>'."\n";
$i++;
}
@ -712,11 +716,27 @@ if ($result) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print '</div>';
print '</form>';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($result);
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
print '</form>'."\n";
} else {
dol_print_error($db);
}

View File

@ -121,7 +121,7 @@ class Deplacement extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;

View File

@ -158,7 +158,7 @@ if ($resql) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
}
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';

View File

@ -1695,7 +1695,20 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div></div>';
print '</div>';
print '<div class="fichehalfright">';
$MAXEVENT = 10;
//$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
print '</div>';
print '</div>';
}
}

View File

@ -305,7 +305,7 @@ if (empty($reshook)) {
$object->fetch($id);
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $object->willBeLastOfSameType();
$last_of_type = $object->willBeLastOfSameType(true);
if (empty($object->date_validation) && !$last_of_type[0]) {
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
$action = '';
@ -3290,7 +3290,7 @@ if ($action == 'create') {
$typedeposit = GETPOST('typedeposit', 'aZ09');
$valuedeposit = GETPOST('valuedeposit', 'int');
if (empty($typedeposit) && ! empty($objectsrc->deposit_percent)) {
$origin_payment_conditions_deposit_percent = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id);
$origin_payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id);
if (! empty($origin_payment_conditions_deposit_percent)) {
$typedeposit = 'variable';
}

View File

@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
if(is_array($tmparray)) {
$this->invoice->contacts_ids = $tmparray;
}
}
$this->invoice->fetchObjectLinked();
@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
$invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$invoice_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@ -451,7 +456,8 @@ class Invoices extends DolibarrApi
$request_data->fk_unit,
$request_data->multicurrency_subprice,
0,
$request_data->ref_ext
$request_data->ref_ext,
$request_data->rang
);
if ($updateRes > 0) {
@ -1767,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->template_invoice->contacts_ids = $tmparray;
}
}
$this->template_invoice->fetchObjectLinked();

View File

@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
'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),
@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}
@ -270,6 +270,7 @@ class FactureRec extends CommonInvoice
if ($result > 0) {
// On positionne en mode brouillon la facture
$this->brouillon = 1;
$this->fk_soc = $facsrc->socid;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (";
$sql .= "titre";
@ -301,7 +302,7 @@ class FactureRec extends CommonInvoice
$sql .= ", suspended";
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
$sql .= ", ".((int) $facsrc->socid);
$sql .= ", ".((int) $this->fk_soc);
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0');
@ -1256,9 +1257,10 @@ class FactureRec extends CommonInvoice
*
* @param int $restrictioninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
* @param int $notrigger Disable the trigger
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0)
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0, $notrigger = 0)
{
global $conf, $langs, $db, $user, $hookmanager;
@ -1338,6 +1340,8 @@ class FactureRec extends CommonInvoice
$this->error = $facture->error;
$error++;
}
if (!$error && ($facturerec->auto_validate || $forcevalidation)) {
$result = $facture->validate($user);
if ($result <= 0) {
@ -1356,6 +1360,16 @@ class FactureRec extends CommonInvoice
$error++;
}
}
if (!$error && !$notrigger) {
// Call trigger
$result = $facturerec->call_trigger('BILLREC_CREATEBILL', $user);
if ($result < 0) {
$this->errors = $facturerec->errors;
$this->error = $facturerec->error;
$error++;
}
// End call triggers
}
} else {
$error++;
$this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n";
@ -1788,10 +1802,13 @@ class FactureRec extends CommonInvoice
*
* @param int $frequency value of frequency
* @param string $unit unit of frequency (d, m, y)
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setFrequencyAndUnit($frequency, $unit)
public function setFrequencyAndUnit($frequency, $unit, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1815,6 +1832,16 @@ class FactureRec extends CommonInvoice
if (!empty($unit)) {
$this->unit_frequency = $unit;
}
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);
@ -1827,10 +1854,14 @@ class FactureRec extends CommonInvoice
*
* @param datetime $date date of execution
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setNextDate($date, $increment_nb_gen_done = 0)
public function setNextDate($date, $increment_nb_gen_done = 0, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1848,6 +1879,15 @@ class FactureRec extends CommonInvoice
if ($increment_nb_gen_done > 0) {
$this->nb_gen_done++;
}
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);
@ -1859,10 +1899,14 @@ class FactureRec extends CommonInvoice
* Update the maximum period
*
* @param int $nb number of maximum period
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setMaxPeriod($nb)
public function setMaxPeriod($nb, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setMaxPeriod was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1879,6 +1923,16 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setMaxPeriod", LOG_DEBUG);
if ($this->db->query($sql)) {
$this->nb_gen_max = $nb;
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);
@ -1890,10 +1944,13 @@ class FactureRec extends CommonInvoice
* Update the auto validate flag of invoice
*
* @param int $validate 0 to create in draft, 1 to create and validate invoice
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setAutoValidate($validate)
public function setAutoValidate($validate, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setAutoValidate was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1906,6 +1963,16 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setAutoValidate", LOG_DEBUG);
if ($this->db->query($sql)) {
$this->auto_validate = $validate;
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);
@ -1917,10 +1984,13 @@ class FactureRec extends CommonInvoice
* Update the auto generate documents
*
* @param int $validate 0 no document, 1 to generate document
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setGeneratePdf($validate)
public function setGeneratePdf($validate, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setGeneratePdf was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1933,6 +2003,16 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setGeneratePdf", LOG_DEBUG);
if ($this->db->query($sql)) {
$this->generate_pdf = $validate;
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);
@ -1944,10 +2024,12 @@ class FactureRec extends CommonInvoice
* Update the model for documents
*
* @param string $model model of document generator
* @param int $notrigger Disable the trigger
* @return int <0 if KO, >0 if OK
*/
public function setModelPdf($model)
public function setModelPdf($model, $notrigger = 0)
{
global $user;
if (!$this->table_element) {
dol_syslog(get_class($this)."::setModelPdf was called on objet with property table_element not defined", LOG_ERR);
return -1;
@ -1960,6 +2042,16 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG);
if ($this->db->query($sql)) {
$this->model_pdf = $model;
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('BILLREC_MODIFY', $user);
if ($result < 0) {
return $result;
}
// End call triggers
}
return 1;
} else {
dol_print_error($this->db);

View File

@ -428,7 +428,7 @@ class Facture extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}
@ -560,7 +560,6 @@ class Facture extends CommonInvoice
$this->array_options = $_facrec->array_options;
//if (! $this->remise) $this->remise = 0;
if (!$this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
@ -1501,7 +1500,7 @@ class Facture extends CommonInvoice
return null;
}
$payment_conditions_deposit_percent = getDictionaryValue(MAIN_DB_PREFIX . 'c_payment_term', 'deposit_percent', $origin->cond_reglement_id);
$payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $origin->cond_reglement_id);
if (empty($payment_conditions_deposit_percent)) {
$origin->error = 'ErrorPaymentConditionsNotEligibleToDepositCreation';
@ -1652,13 +1651,13 @@ class Facture extends CommonInvoice
0, // date_start
0, // date_end
0,
$lines[$i]->info_bits, // info_bits
0, // info_bits
0,
'HT',
0,
0, // product_type
1,
$lines[$i]->special_code,
0, // special_code
$deposit->origin,
0,
0,
@ -2194,9 +2193,11 @@ class Facture extends CommonInvoice
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
$line = new Product($this->db);
$line->fetch($objp->fk_product);
$line->getMultiLangs();
$tmpproduct = new Product($this->db);
$tmpproduct->fetch($objp->fk_product);
$tmpproduct->getMultiLangs();
$line->multilangs = $tmpproduct->multilangs;
}
$this->lines[$i] = $line;
@ -3009,7 +3010,7 @@ class Facture extends CommonInvoice
return -1;
}
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $this->willBeLastOfSameType();
$last_of_type = $this->willBeLastOfSameType(true);
if (!$last_of_type[0]) {
$this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref, dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day'));
return -1;
@ -3840,9 +3841,10 @@ class Facture extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext External reference of the line
* @param integer $rang rank of line
* @return int < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
{
global $conf, $user;
// Deprecation warning
@ -3970,6 +3972,7 @@ class Facture extends CommonInvoice
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
$this->line->rang = $rang;
// Reorder if fk_parent_line change
if (!empty($fk_parent_line) && !empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) {
@ -5022,7 +5025,7 @@ class Facture extends CommonInvoice
$sql .= " WHERE f.entity IN (".getEntity('invoice', 0).")";
$resql = $this->db->query($sql);
if ($resql) {
if ($resql->num_rows > 0) {
if ($this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$ref = $res['max(situation_cycle_ref)'];
$ref++;
@ -5067,7 +5070,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
$res = array();
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
while ($row = $this->db->fetch_object($resql)) {
$id = $row->rowid;
$situation = new Facture($this->db);
@ -5145,7 +5148,7 @@ class Facture extends CommonInvoice
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$last = $res['max(situation_counter)'];
return ($last == $this->situation_counter);
@ -5501,6 +5504,7 @@ class Facture extends CommonInvoice
$sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1);
// Recipient
$to = '';
$res = $tmpinvoice->fetch_thirdparty();
$recipient = $tmpinvoice->thirdparty;
if ($res > 0) {
@ -5522,7 +5526,7 @@ class Facture extends CommonInvoice
$error++;
}
if (!$error) {
if (!$error && $to) {
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
@ -5565,9 +5569,10 @@ class Facture extends CommonInvoice
/**
* See if current invoice date is posterior to the last invoice date among validated invoices of same type.
* @param boolean $allow_validated_drafts return true if the invoice has been validated before returning to DRAFT state.
* @return boolean
*/
public function willBeLastOfSameType()
public function willBeLastOfSameType($allow_validated_drafts = false)
{
// get date of last validated invoices of same type
$sql = "SELECT datef";
@ -5584,7 +5589,12 @@ class Facture extends CommonInvoice
$last_date = $this->db->jdate($obj->datef);
$invoice_date = $this->date;
return [$invoice_date >= $last_date, $last_date];
$is_last_of_same_type = $invoice_date >= $last_date;
if ($allow_validated_drafts) {
$is_last_of_same_type = $is_last_of_same_type || (!strpos($this->ref, 'PROV') && $this->status == self::STATUS_DRAFT);
}
return [$is_last_of_same_type, $last_date];
} else {
// element is first of type to be validated
return [true];
@ -6278,7 +6288,7 @@ class FactureLigne extends CommonInvoiceLine
$sql = "SELECT situation_percent FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->fk_prev_id);
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
if ($resql && $this->db->num_rows($resql) > 0) {
$res = $this->db->fetch_array($resql);
$returnPercent = floatval($res['situation_percent']);

View File

@ -57,7 +57,7 @@ class FactureStats extends Stats
* @param int $typentid Id typent of thirdpary for filter
* @param int $categid Id category of thirdpary for filter
*/
public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
{
global $user, $conf;

View File

@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -857,7 +857,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.datec']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($objp->datec), 'dayhour');
print '</td>';
if (!$i) {
@ -865,7 +865,7 @@ if ($resql) {
}
}
if (!empty($arrayfields['f.tms']['checked'])) {
print '<td class="center">';
print '<td class="center nowraponall">';
print dol_print_date($db->jdate($objp->tms), 'dayhour');
print '</td>';
if (!$i) {

View File

@ -2415,16 +2415,27 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
}
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print '</div>';
print '</table>'."\n";
print '</div>'."\n";
print "</form>\n";
print '</form>'."\n";
// Show the file area only when this page is not opend from the Extended POS
if ($contextpage != 'poslist') {

View File

@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
if ($object->user_author) {
$author->fetch($object->user_author);
if ($object->fk_user_author) {
$author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {
@ -310,9 +310,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
if ($result_sql) {
$num = $db->num_rows($result_sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$numopen = $num;
} else {
dol_print_error($db);
@ -695,9 +695,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$result_sql = $db->query($sql);
if ($result_sql) {
$obj = $db->fetch_object($result_sql);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$pending = $obj->amount;
}
@ -797,17 +797,17 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
$resql = $db->query($sql);
$num = 0;
if ($result_sql) {
if ($resql) {
$i = 0;
$tmpuser = new User($db);
$num = $db->num_rows($result);
while ($i < $num) {
$obj = $db->fetch_object($result_sql);
$obj = $db->fetch_object($resql);
$tmpuser->id = $obj->user_id;
$tmpuser->login = $obj->login;
@ -840,7 +840,7 @@ if ($object->id > 0) {
$i++;
}
$db->free($result_sql);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -102,7 +102,7 @@ if ($mode == 'customer') {
$stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
}
if (is_array($custcats) && !empty($custcats)) {
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat OmdN (f.fk_soc = cat.fk_soc)';
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (f.fk_soc = cat.fk_soc)';
$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
}
}

View File

@ -172,7 +172,7 @@ if ($resql) {
print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
}
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);

View File

@ -102,7 +102,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time());
print $formother->select_month($cmonth, 'remonth');
print $formother->select_year($syear, 'reyear');
print $formother->selectyear($syear, 'reyear');
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '</form>';

View File

@ -198,7 +198,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -194,7 +194,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -1066,8 +1066,8 @@ class BonPrelevement extends CommonObject
// This also set the property $this->total with amount that is included into file
$result = $this->generate($format, $executiondate, $type);
if ($result < 0) {
/*var_dump($this->error);
var_dump($this->invoice_in_error); */
//var_dump($this->error);
//var_dump($this->invoice_in_error);
$error++;
}
}

View File

@ -143,7 +143,8 @@ if ($resql) {
print price($total);
print '</td><td class="right">&nbsp;</td>';
print "</tr></table>";
$db->free();
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -863,7 +863,7 @@ if ($id > 0) {
/*
$MAXEVENT = 10;
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/mymodule/myobject_agenda.php', 1).'?id='.$object->id);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';

View File

@ -123,7 +123,7 @@ class ChargeSociales extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -105,7 +105,7 @@ class PaymentSocialContribution extends CommonObject
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
public function __construct(DoliDB $db)
{
$this->db = $db;
}

View File

@ -713,16 +713,35 @@ while ($i < min($num, $limit)) {
$totalarray['nbfield']++;
}
print '</tr>';
print '</tr>'."\n";
$i++;
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print '</table>';
print '</div>';
print '</form>';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";
print '</div>'."\n";
print '</form>'."\n";
// End of page
llxFooter();

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